fxDreema

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

    Check Candle 1-5 if Price was higher then MA

    Questions & Answers
    5
    19
    3477
    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.
    • S
      Siggi12345 last edited by

      Hi, I did an EA who checks if one of the Candles with ID 1-5 had a Price higher then an MA.

      I did use 1 Condition Block for each Candle, which leads leads to 5 consecutive Conditions, it is working but it looks bad.

      So I want to ask: Is there another design to check if one of the Candle 1-5 has crossed the MA?

      https://fxdreema.com/shared/JhtXIHbjc

      Thanks in Advance!

      l'andorrà 1 Reply Last reply Reply Quote 0
      • l'andorrà
        l'andorrà @Siggi12345 last edited by

        @siggi12345 Yes, you can create a loop to get that same result, but don't worry to create 'ugly' block trees. If they work, they work. Period. 🙂

        (English) I will try to help everyone in these fxDreema forums. But if you want to learn how to use the platform in depth or more quickly, I can help you with my introductory fxDreema course in English at https://www.theandorraninvestor.eu.

        (Català) Miraré d’ajudar tothom en aquests fòrums d’fxDreema. Tanmateix, si vols aprendre a fer servir la plataforma amb més profunditat o més de pressa, t’hi puc ajudar amb el meu curs d’introducció a fxDeema en català a https://www.theandorraninvestor.eu/ca.

        (Español) Intentaré ayudar a todo el mundo en estos foros de fxDreema. Sin embargo, si quieres aprender a usar la plataforma en profundidad o más deprisa, te puedo ayudar con mi curso de introducción a fxDreema en español en https://www.theandorraninvestor.eu/es.

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

          @l-andorrà
          would you be so kind and show me how to do it with loops? I never worked with loops before and I might need that in future... Thank you very much 🙂

          l'andorrà 1 Reply Last reply Reply Quote 0
          • l'andorrà
            l'andorrà @Siggi12345 last edited by

            @siggi12345 Man, I wish I was an expert at loops as roar is. 🙂 He is by the the 'loop man' here. Maybe him could give us a hand? 😉

            (English) I will try to help everyone in these fxDreema forums. But if you want to learn how to use the platform in depth or more quickly, I can help you with my introductory fxDreema course in English at https://www.theandorraninvestor.eu.

            (Català) Miraré d’ajudar tothom en aquests fòrums d’fxDreema. Tanmateix, si vols aprendre a fer servir la plataforma amb més profunditat o més de pressa, t’hi puc ajudar amb el meu curs d’introducció a fxDeema en català a https://www.theandorraninvestor.eu/ca.

            (Español) Intentaré ayudar a todo el mundo en estos foros de fxDreema. Sin embargo, si quieres aprender a usar la plataforma en profundidad o más deprisa, te puedo ayudar con mi curso de introducción a fxDreema en español en https://www.theandorraninvestor.eu/es.

            S 1 Reply Last reply Reply Quote 1
            • S
              Siggi12345 @l'andorrà last edited by

              @l-andorrà alright, i will ask him.

              Hello Mrs/Mr/Person @roar it would be very grateful if you could inform us how we could solve this with a loop. I would appreciate your generosity!

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

                @siggi12345 sure!

                To operate our loop, we need to first create 2 variables. The variables menu opens from the top of blocks list.
                0_1600969360771_59128d43-7e79-4105-b78a-31afac339e16-image.png

                The idea in my loop is to first set some boolean variable ("success" in the example) to TRUE, and then loop through all 5 candles -> if some of them breaks our condition, the variable is set to FALSE.
                After the loop, we can simply check if our variable has stayed TRUE, which would mean that all conditions were ok.
                https://fxdreema.com/shared/6Zmxnuj6c

                Edit: wrong pic

                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

                S 1 Reply Last reply Reply Quote 1
                • S
                  Siggi12345 @roar last edited by Siggi12345

                  @roar wow! this is more complicated that i thought. Thank you very much!

                  It works and i think i understand the most part.

                  The first condition checks if idvar is below 5, if true it checks if candle idvar (currently 1, because of idvar+1) is below the MA. If true the Variable "success" stays true. but since the candle idvar stayed below the MA the yellow dot was not activated.

                  I have one questios:

                  0_1601027731662_conditions.PNG

                  Thank you very much!

                  Edit: I have just found out that the bool variables have to be in lower case in MQL5

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

                    @siggi12345 yes this is pretty technical stuff, youre smart for learning it so fast!

                    Answer to question: "Pass orange first" is my method of organizing the whole algorithm. It first does the loop thing, and later does other things (whatever is connected to yellow output).
                    Basically just to make sure the EA doesnt check the loop results before the loop has even done its calculations.

                    Oh, didnt know about the casing.. I don't use boolean variables myself, just integers 0 and 1 for true/false, but I thought that would confuse others..

                    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

                    S 1 Reply Last reply Reply Quote 1
                    • S
                      Siggi12345 @roar last edited by

                      @roar thank for this detailed answer, i think i have to try out more to get a full understanding.

                      I have tried your code again, but unfortunetly I was wrong, it does not work as expected and I dont know how to fix it.

                      0_1601044522621_conditions.PNG

                      Candle 1-5 have not touched the EMA9 on this GBPUSD M15 Chart @ 5. Feb 2017 but as candle 0 crosses the EMA it should trigger the sell. I dont know why. The loops says:
                      -candle 1-5 high below EMA
                      and the Condition before the Sell:
                      -candle 0 Crosses Above...

                      This is exactly what happend here, right? So I have no idea how to fix it. Can you help me again please.

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

                        candle 0 might not of closed above that EMA, that could be the high ? Block 7 = 0_1601045557315_7c4a7e37-f40b-48ac-8570-9aa0ea229e74-image.png

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

                          @siggi12345 I think the logic is right and you do understand the structure, but there is just some minor bug. Maybe the MA is not 9, instead its 20, etc... Does the EA make trades at all, even in "weird" situations? Share a link?

                          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

                          S 1 Reply Last reply Reply Quote 1
                          • S
                            Siggi12345 @roar last edited by

                            @roar yes, he is doing "weird" trades and he is also doing correct trades:

                            0_1601193652645_conditions.PNG

                            link: https://fxdreema.com/shared/LgfUz4Uod

                            Thanks!

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

                              @siggi12345 I think I got it, try this version
                              https://fxdreema.com/shared/cV7V8KE9e

                              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

                              S G 2 Replies Last reply Reply Quote 1
                              • S
                                Siggi12345 @roar last edited by

                                @roar alright. Thank you very much. You are right, the Candle idvar was missing at one condition!

                                Such a small mistake but still such a big difference. Thanks for the finding and everything!

                                1 Reply Last reply Reply Quote 1
                                • G
                                  gobeef @roar last edited by

                                  @roar I try to use your loop but I got error like this.
                                  "Compilation errors
                                  'TRUE' - undeclared identifier
                                  'FALSE' - undeclared identifier
                                  'TRUE' - undeclared identifier
                                  'TRUE' - undeclared identifier"

                                  What's the mistake on this loop?:D
                                  https://fxdreema.com/shared/R0VTg6MRc

                                  Thank you.

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

                                    @gobeef when you copy blocks between projects, the variables dont actually copy properly to the destination. You have to declare them manually, or:

                                    Download the .mq5 file from my example, and then import the .mq5 to your builder. Then the variables will be declared properly.

                                    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

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

                                      @roar In this project I download your .mq4 and convert to .mq5 but still doesn't work. Do I have to set something more on .mq5 version? Thank you.
                                      https://fxdreema.com/shared/xog76xzBd

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

                                        @gobeef you have to also change all "TRUE" values to "true" - mql5 is picky about the capitalizing there.

                                        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

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

                                          @roar It works ! thank you for your help. 😄

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

                                          Online Users

                                          A
                                          V
                                          C

                                          19
                                          Online

                                          146.7k
                                          Users

                                          22.4k
                                          Topics

                                          122.6k
                                          Posts

                                          Powered by NodeBB Forums | Contributors