fxDreema

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

    Find recent High/Low with specific conditions

    Questions & Answers
    2
    8
    2315
    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.
    • drayzen
      drayzen last edited by drayzen

      Hi @roar & @miro1360 ,
      I'm hoping one of you guys can help me with this one as you seem to be the resident Variable experts, which I'm sure will be needed to solve this one.

      I'm wanting to find the recent high, but only when both preceding candles have highs that are <= their following candle.
      I then need to get the value of that high to set SL at.

      0_1526725466437_fxDreema - Recent High (Specific).png

      I thought I could do it with many many pairs of conditions that work back through the candles then put out that candle number to a variable, but I'm sure there must be a more elegant way to get the job done...

      cheers! đŸ™‚

      ..the alien does not concern itself with the opinions of humans..

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

        Hello!

        Maybe some loop works, like this:

        0_1526761048286_3d72bfc8-b88c-4cde-892b-119b4af08404-image.png

        It first looks for candle ID 1, and then compares it to ID 2 and then ID 2 to ID 3. If conditions are not met, ID 1 becomes ID 2 and the loop continues from there until it finds what it is looking for.

        Be careful though, loop like this doesn't have any "expiration", so if it doesnt find what it looks for - your metatrader crashes. Thats why I put block # 6 there, to limit the loop.

        https://fxdreema.com/shared/v3WrPoSO

        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 0
        • drayzen
          drayzen last edited by drayzen

          Hi @roar ,
          Thanks so much for this, incredibly useful!
          I'm sure I'll use this for many projects...
          I had an idea of the blocks required but couldn't get it sorted in my head how to connect them.
          I never would have thought about the limiter either, nice how it's path is also a double redundancy.

          Though does the value in Block 7 need to be '+1'?
          ...or does that need to be done by the Adjust field?
          Do the Condition blocks 2 & 3 looking at the candles also need to be '+1' so they head backwards through the candles?

          I'll need to increment the start points of everything anyway because my trade indicator appears at ID1.

          cheers! đŸ˜„

          ..the alien does not concern itself with the opinions of humans..

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

            @drayzen oops, youre absolutely right, the IDs go in the wrong way in my example. I should sleep more đŸ˜„

            https://fxdreema.com/shared/XYqEDtP9c
            Here's the fixed blocks, but I'm sure you already got the idea.

            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 0
            • drayzen
              drayzen last edited by

              Even better, we make an EA that can read the future! xD

              Yeah, I'm just working my way through testing, did a build and had some strange results initially with virtual stops (some trades not getting stops set).
              Doing another ground up build testing along the way with hard stops first...

              Do you know if the exact syntax with spaces in calculations matters?
              e.g. Do these all work?
              Variable+1
              Variable +1
              Variable + 1

              cheers

              ..the alien does not concern itself with the opinions of humans..

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

                I'm fairly sure you can put as many spaces as you want, if its a math operation

                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 0
                • drayzen
                  drayzen last edited by

                  I did my own goof, went off visual and linked 7 -> 6 instead of 6 -> 7...
                  Much better now! xD

                  ..the alien does not concern itself with the opinions of humans..

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

                    Oh, yeah, that connection is not very clear in my picture

                    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 0
                    • 1 / 1
                    • First post
                      Last post

                    Online Users

                    S
                    Z
                    E
                    H
                    J
                    S
                    S
                    C

                    16
                    Online

                    146.8k
                    Users

                    22.4k
                    Topics

                    122.6k
                    Posts

                    Powered by NodeBB Forums | Contributors