fxDreema

    • Register
    • Login
    • Search
    • Back to the main page
    • Categories
    • Recent
    • Tags
    • Popular
    • Search

    How to do I build a multi timeframe\symbol portfolio?

    Questions & Answers
    4
    51
    5955
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • gooseman
      gooseman @roar last edited by

      @roar sorry I forgot to note that block 25 is still on the on init tab, I just copied the block over for the purpose to show all blocks.

      1 Reply Last reply Reply Quote 0
      • roar
        roar last edited by roar

        What error are you getting, exactly?
        If its the 'x' - undeclared identifier in your latest shared, its referring to your constants list - x is not a number. I believe you can delete those symbol constants anyway.

        image.png

        Need small help? Tag me in your post
        Need big help? https://www.fiverr.com/big_algo/automate-your-winning-strategy-in-mql4-or-mql5

        gooseman 1 Reply Last reply Reply Quote 1
        • gooseman
          gooseman @roar last edited by gooseman

          @roar Heres the error

          0da93643-57c1-4244-b55d-4610355c93a4-image.png

          and heres the latest project

          https://fxdreema.com/shared/C9f0bjrG

          I have cleaned up the constant and variables. Still receiving this error. I have the symbol activated in MT5.

          S 1 Reply Last reply Reply Quote 0
          • S
            sktsec @gooseman last edited by sktsec

            @gooseman
            Block 18. Try:
            Set variable to Text (you have set it to numeric)

            1 Reply Last reply Reply Quote 2
            • gooseman
              gooseman last edited by

              @sktsec that was it! now its trading now. thanks! lets see how it handles all symbols now.

              1 Reply Last reply Reply Quote 1
              • roar
                roar last edited by roar

                So the mistake was in my own example. Eh, sorry 😅

                I usually do that step in the quick adjust, no need to select datatype

                Need small help? Tag me in your post
                Need big help? https://www.fiverr.com/big_algo/automate-your-winning-strategy-in-mql4-or-mql5

                1 Reply Last reply Reply Quote 1
                • gooseman
                  gooseman last edited by gooseman

                  @roar It's all good! no worries. I am just glad you guys are helping.

                  The system backtest zero issues now which is great. unfortunately putting the system live returns error code 4806. I don't get it. MT5 client is using < 2% of RAM (total 16GB). Nothing else intensive is going on. Could it be the fact that the MT5 is reading the MA block before the Once Per Bar? I'm thinking since 4 ticks are being delivered per second, then MT5 is attempting to read the MA block 4 times a second. Could it be the custom MQL code block? Is there a more efficient way to structure the code? I am just thinking out loud here.

                  brain_full_of_fuck.jpg

                  S 1 Reply Last reply Reply Quote 0
                  • S
                    sktsec @gooseman last edited by sktsec

                    @gooseman
                    Probably due to retrieval of data from some symbols, as it takes time, in particular if those symbols and TFs were not opened in any other chart window.
                    Are you reading multiple symbols? Have you tried with only one symbol first and does error still persist?
                    BTW, CPU speed seems more important nowaday as RAM is often adequate.

                    gooseman 1 Reply Last reply Reply Quote 1
                    • roar
                      roar last edited by

                      To "wake up" your symbols before getting indicator data on them, you can use CopyTime function:
                      https://www.mql5.com/en/docs/series/copytime

                      CopyTime("EURUSD", PERIOD_D1, 100, 1, time_arr)
                      

                      This prepares 100 days of history data, for example

                      Need small help? Tag me in your post
                      Need big help? https://www.fiverr.com/big_algo/automate-your-winning-strategy-in-mql4-or-mql5

                      1 Reply Last reply Reply Quote 2
                      • gooseman
                        gooseman @sktsec last edited by

                        @sktsec yes, many symbols. check out the first page for more details. The system works on a single TF, symbol, and RSI level. but when you have over 200 iterations or even just half, that's when ill get the error code 4806
                        cf1d699e-88e0-4fa9-b811-6ec6937b1347-image.png

                        S 1 Reply Last reply Reply Quote 0
                        • S
                          sktsec @gooseman last edited by

                          @gooseman
                          @roar suggested using CopyTime, does it work for you?

                          1 Reply Last reply Reply Quote 1
                          • S
                            sktsec last edited by sktsec

                            I've make some modification to your shared link by adding a time interval just after switching to any other symbol/TF :
                            https://fxdreema.com/shared/C9f0bjrG
                            NB: After appending to your own project, you have to check to confirm the item in 27 should still the same as the one in 26. (sure you can change it to any other number)

                            gooseman 1 Reply Last reply Reply Quote 1
                            • gooseman
                              gooseman @sktsec last edited by

                              @sktsec Ive been reading up on it to understand the CopyTime function and understand it but implementing it in fxdreema is a whole other story. I am not a mql5 programmer...yet. But I have tried adding CopyTime Function using chatGPT but that did not end well haha.

                              bool CopyTime(
                                 const string      EURUSD, // Symbol name
                                 const ENUM_TIMEFRAMES  PERIOD_D1, // Period
                                 const uint start_pos, // Start position
                                 const uint 100, // Data count to copy
                                 datetime&    time_array[] // Array of time values
                              );
                              
                              

                              Does this look right? I take it I have to create a time_array[] variable as well?

                              Also, I am not seeing the modification you made to the project. I imported the project and found no changes.

                              So close! thanks guys.

                              roar S 2 Replies Last reply Reply Quote 0
                              • roar
                                roar @gooseman last edited by

                                @gooseman you need a time array, yes.

                                If you use custom mql code block, you can put this inside it:

                                datetime time_arr[1];  // Creates an array sized 1
                                CopyTime("EURUSD", PERIOD_D1, 100, 1, time_arr);
                                

                                Thats it. This code doesnt need any constants or variables from your list. You will however need to replace "EURUSD" in some loop.

                                Need small help? Tag me in your post
                                Need big help? https://www.fiverr.com/big_algo/automate-your-winning-strategy-in-mql4-or-mql5

                                gooseman 1 Reply Last reply Reply Quote 2
                                • S
                                  sktsec @gooseman last edited by

                                  @gooseman
                                  I think the code by @roar have solved your problem.

                                  Anyway, if you are interested you can try inserting the following blocks above the block "No position"
                                  https://fxdreema.com/shared/htWDZuxqc

                                  gooseman 1 Reply Last reply Reply Quote 1
                                  • gooseman
                                    gooseman @roar last edited by gooseman

                                    @roar will this block go under onInit? Also, Will this be for for each symbol\TF combo I have? for ex

                                    datetime time_arr[2];  // Creates an array sized 1
                                    CopyTime("EURUSD", PERIOD_D1, 100, 1, time_arr);
                                    CopyTime("EURUSD", PERIOD_H1, 100, 1, time_arr);
                                    

                                    But since were looking to retrieve just history, would this be more appropriate?

                                    datetime time_arr[4];  // Creates an array sized 1
                                    CopyTime("EURUSD", PERIOD_D1, 100, 1, time_arr);
                                    CopyTime("AUDUSD", PERIOD_D1, 100, 1, time_arr);
                                    CopyTime("CADCHF", PERIOD_D1, 100, 1, time_arr);
                                    CopyTime("GBPJPY", PERIOD_D1, 100, 1, time_arr);
                                    
                                    1 Reply Last reply Reply Quote 0
                                    • gooseman
                                      gooseman @sktsec last edited by

                                      @sktsec Ive tried adding the blocks, but it seems to only limit to one symbol.

                                      roar 1 Reply Last reply Reply Quote 0
                                      • roar
                                        roar @gooseman last edited by roar

                                        @gooseman MT5 data handling is sometimes a mystery, but I would assume getting only D1 time is enough to refresh all timeframes.

                                        Also, you can keep the time array sized 1. It will just be written over again and again, and its not a problem because we dont actually use the time value.

                                        I use this method On Tick, but On Init should work fine.

                                        Need small help? Tag me in your post
                                        Need big help? https://www.fiverr.com/big_algo/automate-your-winning-strategy-in-mql4-or-mql5

                                        gooseman 1 Reply Last reply Reply Quote 1
                                        • gooseman
                                          gooseman @roar last edited by gooseman

                                          @roar alright! making lots of progress here. Adding the CopyTime function looks to have solved the error! however, the system is not taking all trades. I have tested 1 year of historical data between my original build and this new build. I have tracked down the missing pairs in backtest to: EURAUD, GBPJPY, NZDJPY

                                          Original build
                                          432792d1-46af-4b6f-bcd8-02169e076ddf-image.png b2535cbb-286c-4627-87f9-c7d8a93726c0-image.png

                                          New build
                                          7a234eda-f942-4b0a-b1f9-08d89043e941-image.png
                                          1b2aaddf-b034-46a2-b120-153e71c1646a-image.png

                                          Ive tried changing the No Position block to
                                          299fda8b-e34e-49e0-b1d0-75ad222b3311-image.png
                                          No difference, so I went back to default.

                                          These are on the on Init tab
                                          fbff298b-c93b-410c-a47c-89483f3c7a42-image.png

                                          Heres the code for the missing symbols in the backtest
                                          326d7493-81e6-49aa-9ff2-5e7653d1eeb0-image.png
                                          85bdc162-3ecc-4e63-91c7-a45ef5e74c57-image.png
                                          977be931-8ae2-4cc9-bdae-2bb21962255e-image.png

                                          The missing symbols are there but don't seem to take trades. any ideas?

                                          gooseman 1 Reply Last reply Reply Quote 0
                                          • gooseman
                                            gooseman @gooseman last edited by gooseman

                                            @roar I am looking at the previous post, I have to apologize, that's just bad practice\troubleshooting. To try and figure out why the system is not taking all trades is not on you. I should have known better as I am in the IT industry lol. I think I've figured it out though. What I did is start with 1 symbol and tested it. the system was able to take all trades. no problems and is working as intended. I added another, but different symbol. the backtest results show the correct amount of trades. it works. great! let's try 2 of the same symbol this time with different parameters.

                                            image.png

                                            Ah ha! found the issue! historically, H1 CADCHF LV1 has a total of 142 trades. H12 CADCHF LV2 has a total of 32 trades. when combined, the backtest should have a total of 174. but what Im getting is only 32 trades. Meaning the system is ignoring the H1 version and just trading the H12. so I tried this (don't laugh)

                                            7cbe8a5d-f8d6-4053-8a43-7d064bb593d5-image.png

                                            When backtested, Im getting 32 trades still. (H12 lv2 only) I believe adding pipes (or) will be used here. just not sure where.

                                            Ive also tested
                                            aff7d7f4-4a43-4049-9998-bd303a60a8cd-image.png

                                            with this, it'll trade the H1\LV1 (174 trades) but ignore the H12\LV2 (32 trades)

                                            Tested this
                                            8ab2741b-1451-4f29-b8f0-464ca706c242-image.png

                                            with this, it'll trade the first set of curly brackets and ignore the 2nd set.

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 3
                                            • 2 / 3
                                            • First post
                                              Last post

                                            Online Users

                                            J
                                            A
                                            Z

                                            16
                                            Online

                                            146.7k
                                            Users

                                            22.4k
                                            Topics

                                            122.6k
                                            Posts

                                            Powered by NodeBB Forums | Contributors