fxDreema

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

    Help with loop module

    Questions & Answers
    3
    9
    1333
    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.
    • D
      djredwood last edited by djredwood

      Hi,

      I was hoping someone could help me, please.

      I have created an ea that places an order on every new bar.

      The order is placed 4 pips up from the open bar price. when that price is met, a buy trade is opened with TP of 16 pips and the SL of 4 pips (SL level is the same as open bar level)

      When the TP is hit, the trade is over and nothing else happens. The order is cancelled if the price goes down 20 pips from the open bar price This is simple.

      Bar opens, the pending order is placed 4 pips up. When the price goes 4 pips up from bar open, trade is opened. Thereafter when the price goes 4 pips down from trade open, SL is hit.

      I am not experienced and so I tried the loop module, the trade does not place one order each time, it places many. What am I doing wrong?

      0_1598075947127_WALKER EA buy 2020:08:21 3.ex4

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

        It´s always worthy to share the project (mqX file or, at least, one screenshot) in order to look at the project´s logic instead of the compiled file.

        Questions:

        • EA opens a pending order on Candle ID = 0 but the trade does not open because the trigger level is not reached. What do you want to do when a new bar opens: place a new pending order (you will have 2 and so on) or remove the previous one and open a new one (you will have just one)?

        • EA opens a pending order on Candle ID = 0 and trade opens. What do you want to do on when next bar opens: open a new pending order or do nothing while a trade is live?

        Those questions are important for the EA´s logic.

        1 Reply Last reply Reply Quote 0
        • D
          djredwood last edited by

          0_1598078671063_WALKER EA buy 2020:08:21 3.mq4 !
          0_1598079237551_Screenshot 2020-08-22 at 08.53.19.png

          Hi Thanks, I have attached my MQ4 file and screenshot.

          • EA opens a pending order on Candle ID = 0 but the trade does not open because the trigger level is not reached. When a new bar opens: place a new pending order (I will have 2 and so on). Do not remove the previous order. This is continuous regardless of how many orders or trades might currently be open. (I know there will be many pending orders and trades open at once, but that's the strength of this strategy.)

          • EA opens a pending order on Candle ID = 0 and trade opens on the trigger level. When the next bar opens: open a new pending order regardless of how many might currently be open.

          Thanks

          1 Reply Last reply Reply Quote 0
          • D
            djredwood last edited by

            0_1598079909692_WALKER EA buy 2020:08:22.mq4 0_1598079862874_Screenshot 2020-08-22 at 09.03.38.png

            Please see my updated mq4 and screenshot. I adjusted the Buy Pending Order parameters to what I initially intended.

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

              If you don´t mind how many pending orders are placed or how many trades are live, your logic regarding to blocks "Once per bar" and "Buy pending order" looks correct. When a new bar opens, a "Pending order" is placed.

              In relation to what happens with running trades, I would suggest that you give a try this

              0_1598082530057_2db6e637-9c44-43a8-aa13-4152b720791c-image.png

              The logic would be: if a trade is closed by "Stop Loss", a new perding order will open at "Ask" price. In other case (TP hit), nothing will happen. This part of the project is placed in "OnTrade" tab.

              D 1 Reply Last reply Reply Quote 0
              • R
                ramisignals last edited by

                Can you please share your project

                1 Reply Last reply Reply Quote 0
                • D
                  djredwood @josecortesllobat last edited by djredwood

                  @josecortesllobat said in Help with loop module:

                  In other cas

                  Thank you for this. It never occurred to me to use 'on trade'.

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

                    My example was cretaed in MQL5. There are blocks with different name between MQL4 and MQL5.

                    Yes, you can use both tabs. "OnTick" code is executed when a tick arrives while "OnTrade" regards to position/trade.

                    Not sure. You will have to check it out by running a backtest in Tick mode to be sure that works as you expect.

                    D 1 Reply Last reply Reply Quote 0
                    • D
                      djredwood @josecortesllobat last edited by

                      @josecortesllobat

                      Thanks for your help, I'll try it out.

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

                      Online Users

                      V
                      O
                      J
                      B

                      24
                      Online

                      146.7k
                      Users

                      22.4k
                      Topics

                      122.6k
                      Posts

                      Powered by NodeBB Forums | Contributors