Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stop Loss order getting cancelled before fill

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

    Stop Loss order getting cancelled before fill

    My Stop Loss order getting cancelled before fill, If price difference more than 40 Ticks it placed the SL and when tick difference below 40 it cancels the SL. Can you check what I am missing?

    if (CrossAbove(EMA( 5), EMA( 21), 1))
    {
    EnterLong(Convert.ToInt32(DefaultQuantity), "");
    }



    if (CrossBelow(EMA( 5), EMA( 21), 1))
    {
    EnterShort(Convert.ToInt32(DefaultQuantity), "");
    }


    if (Position.MarketPosition == MarketPosition.Long && Close[0] > (Position.AveragePrice + 40 * TickSize) ) //if more than 200 SL 100
    {
    ExitLongStopMarket( (Position.AveragePrice + (20 * TickSize)) );
    }

    else if (Position.MarketPosition == MarketPosition.Short && (Position.AveragePrice - 40 * TickSize )> Close[0])
    {


    ExitShortStopMarket( (Position.AveragePrice - (20 * TickSize)) );
    }

    #2
    Hello Akee5,

    Use prints and TraceOrders to understand behavior.



    Orders that are automatically cancelled will have a message from TraceOrders.

    I'm seeing that these are not using isLiveUntilCancelled.


    May I confirm that the condition to re-submit the exit order is evaluating as true when the order becomes cancelled?
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    37 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, Yesterday, 02:41 AM
    0 responses
    17 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    25 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    40 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    34 views
    0 likes
    Last Post CarlTrading  
    Working...
    X