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 kujista, Today, 06:23 AM
    4 responses
    14 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by traderqz, Yesterday, 09:06 AM
    2 responses
    16 views
    0 likes
    Last Post traderqz  
    Started by traderqz, Today, 12:06 AM
    3 responses
    6 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by RideMe, 04-07-2024, 04:54 PM
    5 responses
    28 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by f.saeidi, Today, 08:13 AM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Working...
    X