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 last edited by

      @sktsec any advice on the previous post?

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

        @gooseman

        if a then b=1; if a then b=2; -> b must be 2
        if a then b=1 else if a then b=2 -> b must be 1

        I am afraid the logic is clear.

        In your case, it may need an array to handle the list of TFs

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

          @gooseman oh, you need to repeat the same symbol on multiple timeframes?

          22f235b8-90f6-49ae-b686-da2e2e9220c0-image.png

          Then I think its best to use the Set TF loop block with multiple fixed timeframes (just put all the timeframes you ever use in this block).

          Next 2 blocks will filter out the symbol-timeframe pairs that are not allowed. Then we continue with the rsi target setting block.

          And yes, we can use the pipes again, but only in the condition block
          https://fxdreema.com/shared/aGKfK5Btd

          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
          • gooseman
            gooseman @roar last edited by gooseman

            @roar hmm. ive tried what you suggested and its trading but something isnt right. I say that because im comparing the total trades to my historical test and getting lower results. So I just wanted to make sure were on the same page here. Here is a small sample of the portfolio. Each row is independant from each other, an asset. Column D are the historical total trades of n years. The ones that are marked with the red line, ive ammended to the project

            image.png

            f6534667-b316-4ccb-bdbf-4b1e4197eb03-image.png

            This will backtest all symbols but not all trades. in other words, the total trades do not match my historical total trades (352 trades) I can confirm symbols being traded but not sure if its either the TF or LV variable is the culprit here. I understand the mql code but guess what I dont understand is the logic here so please forgive me if im repeating myself here. Once this portfolio is live, my next step is learn how to code in mql5. Between you guys helping, chatgpt, mql5 youtube videos, Im finding it more interesting and cant wait. so thank you guys for being patient with me.

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

              @roar ive turned the RSI parameter to a constant instead of a variable. Now each RSI parameter has its own set of blocks.

              image.png

              now that we have the TF and SYMBOL as variables
              2657729f-dee7-4cf1-a90e-191cdd7496ac-image.png

              CADCHF H1 has 142 historical trades
              CADCHF H2 has 101 historical trades

              I've removed the code and tested it individually and does return the correct amount of trades. but when together

              (market == "CADCHF_QDM_FTMO_II" && (TF == PERIOD_H2 || TF == PERIOD_H1))
              

              I get a total result of 190 when it should be 243 total amount of trades. any ideas?

              43aabb72-735c-469c-b7d3-3d2db8e43f2a-image.png

              EDIT

              Ive tried out the old code as well:

              if(market == "CADCHF_QDM_FTMO_II")
              {
              	TF = PERIOD_H1;
              }
              if(market == "CADCHF_QDM_FTMO_II")
              {
              	TF = PERIOD_H2;
              }
              

              This results in H1 only being traded. H2 is ignored.

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

                @roar finally! no more error codes! I eliminated the LV variable and made that into different constants instead and created separate block structures for each of those LV. I coded all the symbol and TF into the project and I loaded up the robot on a demo last night to see if I woke up to any codes. I woke up and found no codes and its trading! the portfolio still doesn't match historical results

                897f1ef5-be97-400f-a1f6-781ffdd70086-image.png

                A - Current version
                B - Original version

                but it is fine! ill run with this portfolio in the meantime. I will learn mql5 language and dissect this portfolio and get it running at 100%. still! missing over 4k trades is not bad at all. Thanks @roar @sktsec for the help. I really appreciate it.

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

                  Hey, @roar !

                  I'm using your example here as a learning opportunity for myself.

                  I have a question (I'm trying to learn arrays). In this instance, what was the purpose of subtracting one off of the loop id pre block, but then adding it back on after?

                  Wouldn't this mean that it would keep doing the same index in the array repeatedly and never move on to another?

                  image.png

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

                    Hi @MrDaisyBates! I'm not subtracting one off, I'm setting its value to exactly -1. Furthermore, the white section executes only once, even with loop blocks. Orange section executes for each loop iteration.

                    So effectively the loop_id is -1 before the loop starts, and it will be 0 when the loop starts working with the array. You need to start at 0 with arrays.

                    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

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

                      @roar AH! Okay! Thanks!

                      So, it sets it to -1 on the initial hit, it obviously exits on the "true" side of the block, which takes it to 0, which is used for the first index of the array. And then each time the loop completes, it comes all the way back to the "loop" block, adds one, and keeps going until the loop breaks?

                      I'm okay with the loop idea, but I'm still new with arrays. Will this "Loop" block (I've never used it) break (give a false output) if we get to an index one larger than the array? Or does this specific loop actually break on the "Set Market" block when we hit the snag of trying to load an index that doesn't exist?

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

                        @MrDaisyBates the loop works as you described in the upper part of you reply.

                        It doesnt automatically break if the array range is exceeded, but when you set "Cycles" to ArraySize(), this shouldn't be a problem.

                        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

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

                          @roar Gotcha! Thanks again. That makes sense.

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

                          Online Users

                          G
                          R
                          E
                          P
                          T
                          B
                          G
                          J
                          F
                          Z
                          M
                          W

                          26
                          Online

                          146.7k
                          Users

                          22.4k
                          Topics

                          122.6k
                          Posts

                          Powered by NodeBB Forums | Contributors