Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Cancel Limit order that passed the stop price

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

    Cancel Limit order that passed the stop price

    Hi support,

    I have a situation as the followed. I have SetStoploss() and EnterLongLimit(), but the next candle gapped down beyond my stoploss. When this happens, I would like to cancel the order. How can I detect that the price gapped down beyond my stoploss?

    Thank you

    #2
    Hi op1031,
    You could compare the close of the previous bar with the open of the current bar. A "gap" is present, if the close of the previous bar is above, but the open of current bar is below your stoploss. Perhaps add some logic to determine that the gap must exceed a certain minimum size to qualify as such before cancelling your EnterLongLimit order?
    NT-Roland
    Last edited by NT-Roland; 05-09-2021, 09:04 AM.

    Comment


      #3
      Hello op1031,

      When using set methods you can get the stop price of the stop loss.

      Below is a link to a forum post with sample code.
      https://ninjatrader.com/support/foru...092#post786092

      The Close[0] price could be compared to this in OnBarUpdate, or the marketDataArgument in OnMarketData.

      The issue would be with cancelling an order. Set method orders cannot be cancelled or unset.

      I would recommend instead using exit orders or the unmanaged approach as these orders can be cancelled with CancelOrder().
      Chelsea B.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      54 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      131 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      73 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      44 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      49 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X