Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Replace Stop-Limit with a limit order if order gets skipped

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

    Replace Stop-Limit with a limit order if order gets skipped

    Hi,

    I have a custom order entry indicator where I can push a button and it creates a stop-limit order based on my logic at a certain price.

    Offset ticks for the stop-limit order is 0 so it happens from time to time that the order gets skipped.

    Is there a way to program my indicator that it can detect (assuming a long entry) that if current price is higher than the stop-limit order -> replace stop-limit with a limit order at the same price? How would I go about it?

    Thanks!

    #2
    Hello Orion1504,

    If you are submitting an order using the addon approach in an indicator, this would mean the order is being assigned to a variable before being supplied to <Account>.Submit().

    You can check the state of the order held by the variable and the price.

    if (myOrderVariable != null && myOrderVariable.OrderState == OrderState.Working && Close[0] > myOrderVariable.StopPrice)
    {
    CancelOrder(myOrderVariable);
    }

    In the <Account>.OrderUpdate event handler method:

    if (e.Order == myOrderVariable && myOrderVariable.OrderState == OrderState.Cancelled)
    {
    replacementOrder = mAccount.CreateOrder(Instrument, OrderAction.Sell, OrderType.Limit, OrderEntry.Automated, TimeInForce.Day, 1, 0, 1400, string.Emtpy, "limitOrder", Core.Globals.MaxDate, ull);
    myAccount.Submit(new Order[] { replacementOrder } );
    }
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    553 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    324 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    100 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    543 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    546 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X