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 argusthome, 03-08-2026, 10:06 AM
    0 responses
    94 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    49 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    31 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    34 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    71 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X