fxDreema

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

    Simple EA for Percentage Change

    Questions & Answers
    4
    8
    1292
    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 am trying to create a simple EA that will trade Percentage change per currency. Coming from an Excel environment, I created more than one block trying to achieve the following simple formula:
      If Open>close the Percentage change is (Close - Low) / (High - Low) * 100
      If Open< Close the Percentage Change is (Close - High) / (High - Low) * 100

      The EA will execute if a certain percentage is achieved. The default is set to 90%.

      The EA is not taking any traded in backtesting. I am attaching my project and if you could help me with two things:
      1- How to input these formulas in the (Formula Block) by typing a simple Code.
      2-what am I missing or doing wrong.

      https://fxdreema.com/shared/lMEVJchhc

      Thanks in advance

      jstap l'andorrà 3 Replies Last reply Reply Quote 0
      • jstap
        jstap @Mohamed80 last edited by

        @mohamed80 Hi Mohamed, try changing all your candle ID's to 1, 0 is the current candle so it will only ever have a split second to catch the candle close.

        In this link is how to do an if statement, NAME & RESULT are variables, what you have written above can be put into MX code but probably easier to store data, if you wat to do a formula in custom code then like XL you put it in brackets as you did above, E.G (1+9)/8)}.

        Hope this helps

        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! 😊

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

          @jstap forgot to add link.

          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! 😊

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

            @jstap

            Thank you for your reply.

            1-With setting Candle ID to 1, won't the EA be trading based on previous candle data? In this case, if I use Daily for the candle's strength, the EA will only rely on the previous candle. But it is not what I am after.

            2-I am trying to understand the second part of the reply but I can not so far. Do you mind showing me an example for how to put in Brackets.

            3-I will look more into Modify Variables and storing variables.

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

              @mohamed80 AFAIK you will not be able to backtest any EA which is dependent of external files (as per your EXCEL). You need to include those data inside the EA code to backtest it.

              (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 0
              • jstap
                jstap @Mohamed80 last edited by

                @mohamed80 This is true and previous candle close = current candle open (unless there is a gap).

                VARIABLE 1= (VARIABLE 2/100*23+VARIABLE 3);
                You can also add if's like this
                if(VARIABLE 1 < VARIABLE 2 ) { VARIABLE 3 = 2.00; }

                you can add multiple lines into the block, I always put anything that needs calculated first above the rest.

                if you put this in custom code then the result will be put into VARIABLE 1, This is for MT4 but I think is the same for MT5, the best you can do is candle open >or< current price as at any point within candle 0 there will be no close. If you start a new project and just put different versions of custom code into variable and place tis into a comment block you will be able to see what your code is doing.

                In here link text you will see some examples of code I have used, another tip I will use excel if and = formulas to convert 1 line into multiple, I separate the line into cells and then copy/change it all down until I copy all into the custom code, at this point it will go back into 1 line, probably better ways but I don't know them.

                Good luck

                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

                  @mohamed80 If this helps, putting a calculation in a calculation:

                  WINM= (PROFIT_PER_MIN_LOT*(LOT*100));

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

                    i would advise against using candle 0 for calculations on this because only the open has been established on 0. On C1, you will have a clearly defined OHLC.

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

                    Online Users

                    H
                    E
                    A
                    G
                    Q

                    22
                    Online

                    146.7k
                    Users

                    22.4k
                    Topics

                    122.6k
                    Posts

                    Powered by NodeBB Forums | Contributors