fxDreema

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

    Buy a EUR pair when Conditions are met from three Pairs

    General Discussions
    3
    38
    5988
    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.
    • M
      Mohamed80 last edited by Mohamed80

      Hello,

      I have a very simple EA to build on later.

      The EA will buy EURUSD if the price of each pair (EURUSD, EURGBP, EURJPY) is above SMA 5.

      I created this for MT5 https://fxdreema.com/shared/ggHkL4Fjb but is not working in backtesting.

      I just created a condition for each symbol to be above its SMA 5.

      Can someone comment on what is missing?

      Thanks

      jstap 1 Reply Last reply Reply Quote 0
      • jstap
        jstap @Mohamed80 last edited by jstap

        @mohamed80 As is your conditions are never true because for example GBPUSD C1 MA will never be above GBPUSD C1 MA because it is always the same, instead of pass you need a no position block, this prevents more than 1 trade being placed. in these links you will see the two options to achieve what yo desire, 1 is to check if current price is above MA, 2 is to check candle has closed (or another position) above MA.

        link text

        link text

        Haven't tested but either of these should work.

        Learn fxDreema Without the Wait!

        My comprehensive book, available on Amazon, is packed with examples and invaluable insights to help you fast-track your learning journey.

        The paperback and hardback editions include MT4 & MT5 QR codes for easy access to all prebuilt projects and robots, including my latest gold trading robot!

        Don’t miss out

        Click here➡️ https://mybook.to/fxDreema to get your copy today!

        Enjoy! 😊

        1 Reply Last reply Reply Quote 0
        • M
          Mohamed80 last edited by

          @jstap

          How silly of me! It might have been after spending so many hours on numerous projects.

          Thank you for correcting me.

          jstap 1 Reply Last reply Reply Quote 0
          • jstap
            jstap @Mohamed80 last edited by jstap

            @mohamed80 No problem, I quite often find if I spend too long, any problems are found easily after a sleep

            Learn fxDreema Without the Wait!

            My comprehensive book, available on Amazon, is packed with examples and invaluable insights to help you fast-track your learning journey.

            The paperback and hardback editions include MT4 & MT5 QR codes for easy access to all prebuilt projects and robots, including my latest gold trading robot!

            Don’t miss out

            Click here➡️ https://mybook.to/fxDreema to get your copy today!

            Enjoy! 😊

            1 Reply Last reply Reply Quote 0
            • M
              Mohamed80 last edited by

              @jstap

              I created this EA that would trade on one EUR pair based on the overall bullish score of EUR.
              The calculation is simple. For each pair: (current - Low) / (High - Low) *100. Then averaging all values and assigning a threshold.

              I am not sure what is wrong with the structure I made as it is not executing any trades in backtesting.

              https://fxdreema.com/shared/dqieJ3eYd

              Thanks,

              jstap 1 Reply Last reply Reply Quote 0
              • jstap
                jstap @Mohamed80 last edited by

                @mohamed80 Hi Mohamed, I will gladly go over this and see what I can, first though the symbols are correct in being strings but, to me there was no string in the constant? is this how it is for you? Also put variables/constants in a comment block then you can see if correct result is within, allows for easier fault finding.

                Learn fxDreema Without the Wait!

                My comprehensive book, available on Amazon, is packed with examples and invaluable insights to help you fast-track your learning journey.

                The paperback and hardback editions include MT4 & MT5 QR codes for easy access to all prebuilt projects and robots, including my latest gold trading robot!

                Don’t miss out

                Click here➡️ https://mybook.to/fxDreema to get your copy today!

                Enjoy! 😊

                M 1 Reply Last reply Reply Quote 0
                • M
                  Mohamed80 @jstap last edited by Mohamed80

                  @jstap said in Buy a EUR pair when Conditions are met from three Pairs:

                  @mohamed80 Hi Mohamed, I will gladly go over this and see what I can, first though the symbols are correct in being strings but, to me there was no string in the constant? is this how it is for you? Also put variables/constants in a comment block then you can see if correct result is within, allows for easier fault finding.

                  I used the parameter (Candle Total Size in Pips) to give me the same value as (High - Low).

                  0_1627879676657_70a52c42-c0ad-4428-a709-626f2f521a0f-yuyu (2).png
                  0_1627879715640_bffc5ded-ec1f-4175-b609-3a9da6d01513-yuyu2 (2).png

                  jstap 1 Reply Last reply Reply Quote 0
                  • jstap
                    jstap @Mohamed80 last edited by jstap

                    @mohamed80 That's ok but the currency constants need to have something like EURUSD, otherwise the calculation for each formula cant happen, it uses the string to find the candle for the specific market. If you change this depending on what you are doing, put an example it so when I look I can reference why it's not working.

                    Learn fxDreema Without the Wait!

                    My comprehensive book, available on Amazon, is packed with examples and invaluable insights to help you fast-track your learning journey.

                    The paperback and hardback editions include MT4 & MT5 QR codes for easy access to all prebuilt projects and robots, including my latest gold trading robot!

                    Don’t miss out

                    Click here➡️ https://mybook.to/fxDreema to get your copy today!

                    Enjoy! 😊

                    M 1 Reply Last reply Reply Quote 0
                    • M
                      Mohamed80 @jstap last edited by Mohamed80

                      @jstap

                      I wanted to input the pairs myself in the EA when applying it on a chart or for backtesting.

                      However, I now have inserted the symbols inside the blocks and removed all strings so there is no referencing for symbols.

                      Still, it is not working.

                      When you have some time, please check the formulas for the first two blocks (pairs) and that will suffice for the overall logic.

                      Thanks

                      https://fxdreema.com/shared/ukY9fbD2c

                      jstap 1 Reply Last reply Reply Quote 0
                      • jstap
                        jstap @Mohamed80 last edited by

                        @mohamed80 Ok I will have a look.

                        Learn fxDreema Without the Wait!

                        My comprehensive book, available on Amazon, is packed with examples and invaluable insights to help you fast-track your learning journey.

                        The paperback and hardback editions include MT4 & MT5 QR codes for easy access to all prebuilt projects and robots, including my latest gold trading robot!

                        Don’t miss out

                        Click here➡️ https://mybook.to/fxDreema to get your copy today!

                        Enjoy! 😊

                        M 1 Reply Last reply Reply Quote 0
                        • M
                          Mohamed80 @jstap last edited by Mohamed80

                          @jstap

                          0_1627974676054_2ebb1f34-3cb0-4689-a90d-9aaca910d6a5-2021-08-03.png

                          Your suggestion to use the comments helped a lot to track down what is wrong.
                          First, the Total Size of the Candle in Pips was causing a problem. So I substituted it with raw calculation (High - Low).
                          And a second block for (Current - Low). Lastly, a third block for the calculation (Current - Low) / (High - Low) * 100.

                          I can now continue with the project. I wish if I knew how to write simple Arthimetic formulas in the Coding Block. I would use much fewer Blocks.

                          BTW: How to round numbers in the Comments? and Also to get rid of the last number next to the readings?

                          jstap 1 Reply Last reply Reply Quote 0
                          • M
                            Mohamed80 last edited by

                            @jstap

                            In case I want the EA to check the Pair so I can inverse it. For example, I want to inverse AUDUSD to read as USDAUD.
                            Is there a block to check the (string constant) and reverse the value? I mean to be done automatically.
                            Thanks

                            1 Reply Last reply Reply Quote 0
                            • M
                              Mohamed80 last edited by Mohamed80

                              @jstap

                              I am thinking that to be more practical I need to customize an indicator for my currency strength formula. I will hire a coder.

                              Should I ask the coder to output buffers in numbers or in color or both? What buffers are easier for FX Dreema to pick?

                              jstap 1 Reply Last reply Reply Quote 0
                              • jstap
                                jstap @Mohamed80 last edited by

                                @mohamed80 Sorry I haven't been able to check, my mt5 has been busy optimising, FX uses numbers, the colours just help you know which buffer to choose, you can have them all black, works fine but difficult to remember which number to use when you have lots.

                                Learn fxDreema Without the Wait!

                                My comprehensive book, available on Amazon, is packed with examples and invaluable insights to help you fast-track your learning journey.

                                The paperback and hardback editions include MT4 & MT5 QR codes for easy access to all prebuilt projects and robots, including my latest gold trading robot!

                                Don’t miss out

                                Click here➡️ https://mybook.to/fxDreema to get your copy today!

                                Enjoy! 😊

                                1 Reply Last reply Reply Quote 0
                                • jstap
                                  jstap @Mohamed80 last edited by jstap

                                  @mohamed80 I can help you with most of this, I am not a coder and what I know is self learnt. In here you will see a few examples of what you can do, anything your not sure about just ask, a simple formula would be variable1=(132+(45-5/2)); link text

                                  I will also say that I try not to use too many formula blocks, previously I have found unexpected results, results that are corrected by using custom code, I still use formula blocks just not as many as I used to.

                                  Learn fxDreema Without the Wait!

                                  My comprehensive book, available on Amazon, is packed with examples and invaluable insights to help you fast-track your learning journey.

                                  The paperback and hardback editions include MT4 & MT5 QR codes for easy access to all prebuilt projects and robots, including my latest gold trading robot!

                                  Don’t miss out

                                  Click here➡️ https://mybook.to/fxDreema to get your copy today!

                                  Enjoy! 😊

                                  M 1 Reply Last reply Reply Quote 0
                                  • TipsyWisdom
                                    TipsyWisdom last edited by

                                    and dont forget that most blocks can be adjusted at the bottom of each after you expand the adjustment section. Formulas can be entered right into that block.

                                    1 Reply Last reply Reply Quote 0
                                    • M
                                      Mohamed80 @jstap last edited by Mohamed80

                                      @jstap

                                      Thanks for your help

                                      So lets say I want this simple formula: (Close (0) - Low(0) )/(High (0) - Low (0)) and assign it to a variable and a specific pair.
                                      I will type seven of them for example.
                                      Where do you think I should start from for such basic formulas? I mean to learn how to use the minimum needed.

                                      I am more of an Excel user and never coded anything in MQL4.

                                      TipsyWisdom jstap 2 Replies Last reply Reply Quote 0
                                      • TipsyWisdom
                                        TipsyWisdom @Mohamed80 last edited by

                                        @mohamed80

                                        each candle parameter that you want would need to be made into a variable, then use that named variable in place just like that formula.

                                        side note, you can't refer to C0, high, low, and close because they have not been defined. Only C0 open is defined logically. Only on C1 do you have a OHLC.

                                        You can use high and low cross, but i typically use Ask or Bid of market properties if I need immediate entries

                                        M 1 Reply Last reply Reply Quote 0
                                        • jstap
                                          jstap @Mohamed80 last edited by jstap

                                          @mohamed80 Tipsy is correct there is a candle 0 close but it happens at the same time as the new candle opens, in code you can specify C0 close (I am unsure how to do it) but it potentially moves until the candle closes, using C1 for everything, and then C0 open for C1 close is the best way. In this link you can see how I would achieve this link text

                                          Learn fxDreema Without the Wait!

                                          My comprehensive book, available on Amazon, is packed with examples and invaluable insights to help you fast-track your learning journey.

                                          The paperback and hardback editions include MT4 & MT5 QR codes for easy access to all prebuilt projects and robots, including my latest gold trading robot!

                                          Don’t miss out

                                          Click here➡️ https://mybook.to/fxDreema to get your copy today!

                                          Enjoy! 😊

                                          M 1 Reply Last reply Reply Quote 0
                                          • M
                                            Mohamed80 @TipsyWisdom last edited by Mohamed80

                                            @tipsywisdom

                                            Iam calculating strength over a group of pairs by averaging the strength of seven pairs per currency and then conditioning based on a threshold.

                                            EX: if EUR > 80 percent and USD < 20 percent then Buy EURUSD.

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

                                            Online Users

                                            B
                                            A
                                            H
                                            E
                                            A

                                            19
                                            Online

                                            146.7k
                                            Users

                                            22.4k
                                            Topics

                                            122.6k
                                            Posts

                                            Powered by NodeBB Forums | Contributors