Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Limit above ask / below bid generates error/reject

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Limit above ask / below bid generates error/reject

    I'm running an automated strategy with FXCM. I place orders at limit based on the previous bar close. Sometimes I get an error because this limit order is above ask (long) / below bid (short) and I get returned an rejection error and the whole strategy is disabled.

    Any way to solve this? I would like the limit order to fill at max/min or better. So if ask is lower, then just fill at ask. If bid is higher then just short at bid.

    Thanks

    #2
    Hi siroki, that could be the case correct, as you work then pretty closely with this order type to the current inside market, also you need to factor in also delays in submitting the order in (so once order is seen the price could have changed in the meantime invalidating the order).

    Since a marketable limit order would not be an option on this technology, you could for example trap the rejection and resubmit the order with a changed price until you got the fill.

    Comment


      #3
      Originally posted by siroki View Post
      I'm running an automated strategy with FXCM. I place orders at limit based on the previous bar close. Sometimes I get an error because this limit order is above ask (long) / below bid (short) and I get returned an rejection error and the whole strategy is disabled.

      Any way to solve this? I would like the limit order to fill at max/min or better. So if ask is lower, then just fill at ask. If bid is higher then just short at bid.

      Thanks
      Are you placing StopLimit orders? Unless so far ahead of the market that the broker deems them to be too aggressive, (and, therefore, likely erroneous), Limit orders cannot be rejected: they are filled at price of better.
      Last edited by koganam; 09-24-2014, 03:56 AM.

      Comment


        #4
        Thanks Bertrand,

        Could you provide an example on how to resubmit the order with a modified price in the OnOrderUpdate segment?

        What I would like to accomplish at least is that when an order is rejected, the strategy keeps on running so it can just try and get the next trade on the next signal.
        Last edited by siroki; 09-25-2014, 12:38 AM.

        Comment


          #5
          siroki, I've attached a simple idea how to start working those cases. The rejection popup though will be seen, the script would stay enabled though on take no action and allow you to resubmit at a difference price. Or if you don't take action here you could as well just sit out that signal but have the benefit of the non disabled script. Please keep in mind this puts more responsibility on your code and script monitoring though.
          Attached Files

          Comment


            #6
            Bertrand,

            Thanks for your help as always! Ninjatrader support as great as ever!

            Comment


              #7
              Koganam,

              No, I am placing regular EnterLongLimit and EnterShorLimit orders which get rejected by fractional pips. I indeed thought that Limit orders would get filled at that price, or better. I have to say I put the price as previous closing bar (without +/- 1 tick). Maybe I should also think about hitting it with +/- a tick based on Bid/Ask.

              I will look into the StopLimit orders. Thanks for your answer.

              Comment


                #8
                Originally posted by NinjaTrader_Bertrand View Post
                Hi siroki, that could be the case correct, as you work then pretty closely with this order type to the current inside market, also you need to factor in also delays in submitting the order in (so once order is seen the price could have changed in the meantime invalidating the order).

                Since a marketable limit order would not be an option on this technology, you could for example trap the rejection and resubmit the order with a changed price until you got the fill.

                https://www.ninjatrader.com/support/...orhandling.htm
                Bertrand,
                Can you clarify your remark re: "a marketable limit order would not be an option on this technology"? Are you saying that a marketable limit order is not possible with NinjaTrader?

                For example, I'm trying to get an EnterLongLimit() fill at the ask (i.e., a marketable limit order). I can simulate this order when backtesting with the Strategy Analyzer but I haven't been able to reproduce this order type trading live with a Sim101 account.

                Is the reason for this that NT does not support marketable limit orders?

                Thx,
                Lou
                Last edited by bluelou; 10-09-2014, 01:13 PM.

                Comment


                  #9
                  bluelou,

                  You would be able to place Limit orders at the Ask price without issue. If the last price is less than the ask at that time, it will get filled almost immediately.

                  Stop orders is where I would expect to see a rejection, typically due to being so close to the market price and could potentially end up on the wrong side of the market as soon as it is submitted
                  Cal H.NinjaTrader Customer Service

                  Comment


                    #10
                    Originally posted by NinjaTrader_Cal View Post
                    bluelou,

                    You would be able to place Limit orders at the Ask price without issue. If the last price is less than the ask at that time, it will get filled almost immediately.

                    Stop orders is where I would expect to see a rejection, typically due to being so close to the market price and could potentially end up on the wrong side of the market as soon as it is submitted
                    Cal,
                    Maybe you could help me with some guidance then? I've been trying to get my EnterLongLimit(GetCurrentAsk(),...) to get filled at the ask and it's not always happening.

                    To be specific, I'm using the Sim101 account in "live" trading and with output logs and watching the DOM I can see where the condition is met, limit == ask, but there is no fill. The market just trades through my limit like it doesn't exist and then it eventually gets cancelled.

                    This order should trade, get filled, very much like a market order; hence, the "marketable" part of marketable limit. Any ideas what's going on?

                    One idea... Is the limit order conditioned on the bars object used in any way or does EnterLongLimit(GetCurrentAsk(),...) literally submit a long limit at the current ask without any (possibly hidden) conditions?
                    Last edited by bluelou; 10-09-2014, 03:53 PM.

                    Comment


                      #11
                      Originally posted by bluelou View Post
                      Cal,
                      Maybe you could help me with some guidance then? I've been trying to get my EnterLongLimit(GetCurrentAsk(),...) to get filled at the ask and it's not always happening.

                      To be specific, I'm using the Sim101 account in "live" trading and with output logs and watching the DOM I can see where the condition is met, limit == ask, but there is no fill. The market just trades through my limit like it doesn't exist and then it eventually gets cancelled.

                      This order should trade, get filled, very much like a market order; hence, the "marketable" part of marketable limit. Any ideas what's going on?

                      One idea... Is the limit order conditioned on the bars object used in any way or does EnterLongLimit(GetCurrentAsk(),...) literally submit a long limit at the current ask without any (possibly hidden) conditions?
                      There is no guarantee of a fill on a limit order, unless the market trades by retreating behind the order. If you place a limit order and it does not fill and the market takes off away from the order, it will not get filled. That is the problem with using limit orders. They can be touched and not fill. Whether or not they are filled, if only touched, depends on your order's place in the queue. That the order is placed at the Ask just means that it goes to the end of the order queue, whether or not the Ask price is the trading price. To guarantee a fill, the market will have to trade down through the order as we are evidently talking about long orders here.

                      Comment


                        #12
                        Originally posted by koganam View Post
                        There is no guarantee of a fill on a limit order, unless the market trades by retreating behind the order. If you place a limit order and it does not fill and the market takes off away from the order, it will not get filled. That is the problem with using limit orders. They can be touched and not fill. Whether or not they are filled, if only touched, depends on your order's place in the queue. That the order is placed at the Ask just means that it goes to the end of the order queue, whether or not the Ask price is the trading price. To guarantee a fill, the market will have to trade down through the order as we are evidently talking about long orders here.
                        koganam,
                        I appreciate your answer and I agree with you in general. Now, here's the part I didn't get a chance to explain yet: Let's say the size is 100 bid x 100 ask and my long limit order for 10 contracts is in the queue at the ask. The issue I have is that the ask side of the book isn't trading out. The inventory is still there and eventually my limit becomes non-marketable.

                        I've watched this in real-time, in log data, and in market replay several times. I would agree with you 100% if the inside ask inventory traded out and I didn't get filled due to lousy queue position. But, I'm confident that's not what's happening.

                        Am I making sense to you or do you disagree? So, I'm not sure where that leads me. Is there something unique to the matching algo for Sim101 accounts? Or, is there a flaw somewhere else in my logic?

                        ~Lou

                        P.S. I think I just realized a flaw in my code logic. A portion of my marketable limit logic is in OnBarUpdate (using 1 tick bars). 1 tick means 1 trade occurred, correct? The logic should probably be entirely in OnMarketData to get the live and executable Level 1 / inside bid/ask data. Sound right, doesn't it?
                        Last edited by bluelou; 10-09-2014, 08:42 PM.

                        Comment


                          #13
                          Cal, koganam,
                          I think I've resolved the "marketable limit" issue. I was submitting a marketable limit correctly but my signal, which also uses bid/ask data, was using 1 tick bars in OnBarUpdate. By moving this part of the signal into OnMarketData my signal is now being updated "on quote" which obviously improves my queue position. Now, I'll have to wait and see how the results come in. Thx for your help.

                          ~Lou

                          Comment


                            #14
                            Thanks for the update Lou!

                            Glad to hear you got a solution
                            Cal H.NinjaTrader Customer Service

                            Comment


                              #15
                              Originally posted by bluelou View Post
                              Cal, koganam,
                              I think I've resolved the "marketable limit" issue. I was submitting a marketable limit correctly but my signal, which also uses bid/ask data, was using 1 tick bars in OnBarUpdate. By moving this part of the signal into OnMarketData my signal is now being updated "on quote" which obviously improves my queue position. Now, I'll have to wait and see how the results come in. Thx for your help.

                              ~Lou
                              Just remember that you cannot Backtest or Optimize when you use OnMarketData().

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by argusthome, 03-08-2026, 10:06 AM
                              0 responses
                              64 views
                              0 likes
                              Last Post argusthome  
                              Started by NabilKhattabi, 03-06-2026, 11:18 AM
                              0 responses
                              41 views
                              0 likes
                              Last Post NabilKhattabi  
                              Started by Deep42, 03-06-2026, 12:28 AM
                              0 responses
                              22 views
                              0 likes
                              Last Post Deep42
                              by Deep42
                               
                              Started by TheRealMorford, 03-05-2026, 06:15 PM
                              0 responses
                              25 views
                              0 likes
                              Last Post TheRealMorford  
                              Started by Mindset, 02-28-2026, 06:16 AM
                              0 responses
                              52 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Working...
                              X