fxDreema

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

    closing other pending orders when one is filled?

    Questions & Answers
    3
    12
    3774
    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
      mcmillan last edited by

      Fxdreema,

      I have (thanks to your help) an EA that places a buy stop above the last candle high and a sell stop below last candle's low.

      Once one of the orders is filled , I want the other pending order closed, so one cancels the other.

      Here is what I have:

      https://fxdreema.com/shared/YTzJ06x2b

      Step 7 is delete pending orders if a trade is running.

      Am I doing this correctly ?

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

        If it works, yes. But I think I'm gonna add some option for this OCO thing, because there is always someone asking for this.

        1 Reply Last reply Reply Quote 0
        • M
          mcmillan last edited by

          Radoslav,

          Thank you for your quick reply. Yes, I think an OCO option would be wonderful.
          You are doing a great job . Thank you so much!

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

            I never traded like that and this idea was never close to me, so I will ask something stupid here. If OCO means to have Buy and Sell order at the same distance from the current price, is it also right to say that we can have OCO with two Buy or two Sell orders (stop and limit)? I mean, is there some practice, someone is doing it that way?

            1 Reply Last reply Reply Quote 0
            • M
              mcmillan last edited by

              Radoslav,

              Well, that's a good question. I think an OCO could work on both stop and limit orders. But I'm not sure about multiple orders. Maybe it will work. I'll try it out and see what happens.

              I have been experimenting a little and this seems to work:

              https://fxdreema.com/shared/2wUb08h0d

              The OCO seems to require being placed "on trade" rather than "on tick". OK, I learned something new!
              What do you think? Any suggested improvements will be appreciated 🙂

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

                No nooo.... under "on Trade" you should filter the event. This event is fired often. And look what you have - If trade/order exists -> Delete pending orders. The same as if you only have the command of "Delete pending orders"

                1 Reply Last reply Reply Quote 0
                • M
                  mcmillan last edited by

                  Radoslav,

                  Should I have the delete pending orders under "on tick"? I think I see what you mean - I tried the ea when I had the delete pending orders
                  "on trade" and everything got deleted. Even pending orders for other currency pairs.

                  1 Reply Last reply Reply Quote 0
                  • P
                    peteyteichroeb last edited by

                    Hi, I've been having some trouble figuring some stuff out, i'm fairly new to all this but what i'm trying to create is a strategy calleed Zone Recovery, where you open a trade in any direction (buy or sell) and simulatanously open a pending order in the opposite direction, in case the market doesn't go in the favor of your original trade, it hits your pending order and keeps going to your take profit, if the market should reverse again before hiting your take profit you open another pending order exacly where your orginal buy or sell trade was placed, i really need help cause seems like i've tried everything on FXDREEMA and can't make this work, everytime my original trade takes a profit, my pending order doesn't get deleted, it stays, and if i put the "delete pending order" in, it deletes everything, please help

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

                      mcmillan, I just added this OCO option, find it in Buy pending order and Sell pending order. I use the comment attribute of the second order to store the ticket number of the first one, so they are linked by this comment. Then, on every tick the EA will look if one of both orders is missing and will delete the other one if that is true. The overall backtest speed is probably now a little bit down again, but this happens when I add options 🙂 Notify me if something is wrong.

                      peteyteichroeb, I will suggest to use normal strategies with SL instead of these hedge strategies. I sent you some examples and good luck with understanding them. I also have big troubles creating such strategies, but most importantly, I think that this is not needed at all, because hedging (in the same symbol!) is nothing more that some very weird way to make things complex and hard to maintain.

                      1 Reply Last reply Reply Quote 0
                      • M
                        mcmillan last edited by

                        Radoslav,

                        Thank you! You are awesome!

                        1 Reply Last reply Reply Quote 0
                        • M
                          mcmillan last edited by

                          Radoslav,

                          I tried the OCO option - two buy and sell pending orders were placed. Is it supposed to do that?

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

                            Yes, because you are using two blocks now 🙂 This option is supposed to create 2 orders from 1 block. If the block is Buy pending order, it will add second Sell order.

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

                            Online Users

                            D
                            L
                            H

                            6
                            Online

                            146.7k
                            Users

                            22.4k
                            Topics

                            122.6k
                            Posts

                            Powered by NodeBB Forums | Contributors