fxDreema

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

    How to open next order after 5 bars if there is already open order and conditions are met, so there won't be a lot of open trades???

    Questions & Answers
    4
    9
    2415
    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.
    • N
      nanana last edited by nanana

      Open next order after 5 bars if there is already open order and conditions are met, so there won't lot of open trades.

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

        • Make variable barcount
        • On every bar, barcount = barcount+1
        • Condition before order: barcount > 5
        • After order: set barcount = 0

        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

        N 1 Reply Last reply Reply Quote 0
        • fxDreema
          fxDreema last edited by

          Well, if the reason is to not open lot of trades, the easiest way is to have "Once per bar" somewhere above the Buy/Sell block. You can set different timeframe in this block.

          Another way is to have "For each Trade" (or Closed Trade, it depends) with "not more than..." set to 1, so only the last trade is loaded, and then "check age" and then the Buy/Sell block.

          N 1 Reply Last reply Reply Quote 0
          • N
            nanana @fxDreema last edited by

            @fxdreema I tried Once per bar in 5m Timeframe but it still sometimes opens 5 trades in 1 minute when the crossover happens in 1 minute chart.

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

              @roar Please if you can help me how to create the variable, i'll try the condition by myself barcount>5. and how to reset to 0.

              Please can you send me an example?

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

                Sure, here's how to create the variable and how the logic goes.
                https://fxdreema.com/shared/5XfmFTFbb
                0_1525867221092_a7476f00-9078-4357-a356-1579de04d257-image.png
                0_1525867236906_e32586a5-ece3-426a-a773-74613d04db74-image.png

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

                  0_1525871410652_192972ef-57d0-4359-b2f2-65954928b72f-image.png

                  What is wrong in here? since i put this on the project no trades are opened on backtest

                  1 Reply Last reply Reply Quote 0
                  • N
                    nanana last edited by

                    https://fxdreema.com/shared/e1d9Sdh5d

                    1 Reply Last reply Reply Quote 0
                    • J
                      josecortesllobat last edited by

                      @nanana

                      Take a look at the @roar project. The variable "barcount" has been placed in a wrong place (adjust field) in your project. This is not correct.

                      0_1525877950298_d6a22c01-3eaf-4905-8af1-ec4a23f20caa-image.png

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

                      Online Users

                      E
                      S
                      N
                      O
                      M
                      D

                      11
                      Online

                      146.7k
                      Users

                      22.4k
                      Topics

                      122.6k
                      Posts

                      Powered by NodeBB Forums | Contributors