fxDreema

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

    Issue with Foreach Trade

    Questions & Answers
    2
    6
    429
    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
      mlumbreras last edited by

      I have created an EA that according to the configuration creates up to 5 pending buy orders (all at the same point) and 5 pending sell orders (all at the same point). This is configured in the "On tick" section and works correctly.

      In the "On trade" section, I want to configure that every time a pending trade enters the market, the pending orders of the opposite type are closed and if the option to make a second trade is activated, a second trade of the opposite type must be opened.

      For example: Initially a buy stop and a sell stop are placed simultaneously. The buy I am enters the market, a buy order is generated, at which point the initial sell stop is removed and another sell stop is opened for double the volume.

      I have tried several ways, but it does not remove the pending orders after opening the first trade or trades, does anyone know how I can do this?

      This is my project: https://fxdreema.com/shared/nJTEUPsbb

      P.S. In case anyone is wondering, I want to do this so that I can spread the total volume over several trades.

      Thank you in advance for your help.

      R 1 Reply Last reply Reply Quote 0
      • R
        RGoo @mlumbreras last edited by

        @mlumbreras
        Interesting theory. I changed your AE something. You only need the "Pass" block if a block would otherwise stand alone or for special other applications. The "OpB" block is also not necessary, since something is only executed after an event, and "for each trade" is also not required , because the search is for the trade that JUST was executed. Maybe that will help you first, I didn't fully understand your description of how the EA works, but I think you need an additional variable, maybe.

        https://fxdreema.com/shared/eye7h2kGb

        RGoo

        1 Reply Last reply Reply Quote 1
        • M
          mlumbreras last edited by

          Thank you very much for your reply @RGoo . I wanted to make it too complicated. Your example is more in line with what I want, but I still have a problem.

          Continuing with your example, blocks 139 and 141 should open a pending order with double the volume for each of the open trades. Currently, the pending orders are created, but one of them is closed and I don't know why.

          Captura.PNG

          R 1 Reply Last reply Reply Quote 0
          • R
            RGoo @mlumbreras last edited by RGoo

            @mlumbreras
            This can actually only be due to the expiration mode. You have to check that. I once inserted a control block for you, you can place it anywhere and you can then see whether the block is currently being run through and how often.

            00e5c27b-75a9-4a36-ad23-c970c7491037-image.png

            https://fxdreema.com/shared/kgmRSuKB

            RGoo

            1 Reply Last reply Reply Quote 1
            • M
              mlumbreras last edited by

              Excellent! Indeed, that was the problem. Thank you very much for your help @RGoo !

              R 1 Reply Last reply Reply Quote 0
              • R
                RGoo @mlumbreras last edited by

                @mlumbreras
                Try this out, it should work.
                fab3ac35-a785-4f5a-888e-bf59d74bc563-image.png
                https://fxdreema.com/shared/Mflx9sUWc

                RGoo

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

                Online Users

                E
                O
                R
                S

                13
                Online

                148.2k
                Users

                22.4k
                Topics

                122.7k
                Posts

                Powered by NodeBB Forums | Contributors