fxDreema

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

    Using a Delay Function in the MT5 Tester

    Questions & Answers
    4
    16
    1225
    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.
    • Archer
      Archer last edited by Archer

      Hello Forum!

      I'm trying to build an EA but I'm having an issue with the tester on MT5 right from the first few blocks.
      Funny enough, on the live market everything works fine and according to my expectations, at least at this early stage of building.
      For some reason, the tester is not fully respecting Block #19, which is supposed to disable the buy function:

      https://fxdreema.com/shared/1bPrMQl4b

      Even though the log shows that the block has been disabled, the EA still immediately opens a new position.
      Based on logs, it seems to me that the problem lies in the lack of time/tick delay in the tester and the EA sees both the disabled block and the condition to open a position at the same time:

      sample.png

      I've tried adding functions like "skip ticks" or "delay" after Block 18/19, but the tester completely ignores them and doesn't delay anything.

      I did manage to create an "artificial" delay in the tester by adding a condition before the BUY block:

      sample_2.png

      and everything starts working as it should. Unfortunately, even such a small variable affects the tester results compared to when this variable is absent, rendering the entire backtesting meaningless.

      So, my question is: how can I delay the BUY block in the tester so that the EA waits for at least 1 second before taking any action after the execution of Block #19?

      1 Reply Last reply Reply Quote 0
      • B
        BBMess last edited by

        There is a 'Delay' block found under "More" and it's use is described in the picture below;
        You will need to go into your MetaTrader terminal and go to "Tools/Options/Expert Advisors (Tab) and click the "Allow DLL Imports"
        This will ensure the delay actually happens naturally in the tester.

        image.png

        1 Reply Last reply Reply Quote 0
        • B
          BBMess last edited by BBMess

          You can add a constant in the seconds area to test if 1 second will be enough or change it in the EA Parameters without the need to compile a new version every time you want to test it.

          image.png

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

            Thank you, but as I mentioned in the first post, I've already tried using that block.
            It only pauses the tester for a selected period of time and doesn't affect the delay in trading itself.
            The conditions that were met during the pause are still being executed when the EA resumes its operation.

            In general, I'm looking for a method that will compel the EA on the tester to fully respect the fact that the BUY block has been turned off.
            It doesn't necessarily have to involve a time delay because I can see that the tester doesn't respect time-based blocks as it does on the live market.
            I only hope any proposed solution won't impact the delay in the price itself, similar to my suggestion in the first post, as it has an impact on backtesting results.
            In other words, in this case such a solution cannot be placed directly before the BUY NOW block. Unless I am mistaken... please correct me if I'm wrong.

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

              While still considering another logical function for this EA to work on the tester like on a live market, I was wondering if there is any method to limit the operation of blocks under 'ONCE PER CONDITION'?
              Something similar to the 'ONCE PER OBJECT' block, but in this case, the EA would open positions only once when a specific condition is met and somehow wait for a reset before opening a position again only after the condition is met once more.

              I applied this logic in the project I shared, and it works well on the live market thanks to enabling and disabling blocks. However, I'm unsure how to translate it to the tester.

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

                Hey guys, any suggestions regarding the above?
                All ideas are more than welcome. Don't be shy 😉

                1 Reply Last reply Reply Quote 0
                • l'andorrĂ 
                  l'andorrĂ  last edited by

                  I'm not an expert in this field but as far as I know time cannot be delayed in tester. Someone else with more knowledge could confirm, please?

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

                    I have the same request from my side as well.
                    And if it's not possible to achieve that, I kindly ask for a suggestion on how to construct the blocks in a way that they will function similarly to the ones in the project I presented but be customized for the tester's requirements.

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

                      What you can do is create a timer, so until enough seconds have passed, blocks won't activate.

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

                        @jstap Thank you for your suggestion.
                        I've tested all available time blocks on the platform to create such a timer, but none of them work on the tester.
                        They do work on the live market, though.
                        Could you please show me an example of the block structure you have in mind and where it should be placed?
                        Or perhaps you're referring to some form of formula or code that goes beyond the standard FX functions, which I personally am not familiar with.
                        I would appreciate further clarification.

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

                          Create one, start by adding 1 onto a variable every second, then reset this to 0 when needed. Then you can check this with a condition, and do what you want.

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

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

                            @jstap Just curious. How can you do that on tester? Backtest is using tick data, not real time. If there are no ticks for 3 seconds, for example, the timer will be wrong.

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

                              Backtest uses server time, not tested MT5 but should work the same as MT4:

                              MT4 https://fxdreema.com/shared/4cQR6lW9c
                              MT5 https://fxdreema.com/shared/IwxuA3zKd

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

                              Archer l'andorrĂ  2 Replies Last reply Reply Quote 2
                              • Archer
                                Archer @jstap last edited by

                                Thank you @jstap.
                                Your solution should work.
                                In the meantime, I managed to find another one. I added the "every n ticks" block here:

                                screenshot-fxdreema.com-2023.11.05-16_00_41.png

                                It doesn't significantly affect the backtest results because it's enough to set the value to 2 for the EA to have time to realize that the requested block has been disabled. Now, the EA waits to open a position only when the condition is met again, just like in the live market where this block is not needed at all.

                                However, if someone doesn't want to have the slightest difference in backtest results, a better solution is a timer that should appear after block 18 or 19.

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

                                  Great! I've solved one problem, and now another has appeared.
                                  EA works well only in visual mode. Otherwise, it only executes a few trades and terminates the backtesting.

                                  The only thing I added is a time filter block, which I always apply and it never caused any problems with other EAs of my.
                                  If I remove it, everything works fine. After adding it, it becomes chaotic and only works in visual mode.
                                  Do you guys know what could be the cause of this situation?

                                  https://fxdreema.com/shared/foWqnFkqb

                                  Why does everything have to be so hard to attain...

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

                                    @jstap Interesting. Thank you very much.

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

                                    Online Users

                                    N
                                    J
                                    A
                                    Z

                                    17
                                    Online

                                    146.7k
                                    Users

                                    22.4k
                                    Topics

                                    122.6k
                                    Posts

                                    Powered by NodeBB Forums | Contributors