Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Need to cancel pending order once any of placed order executed

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

    Need to cancel pending order once any of placed order executed

    Hi ,
    As i will be placing multiple order based on strategy i need to cancel any pending order as soon as any one order executed , i tried with onexecutionupdate() but this method is not called when
    order is executed so please help me asap

    // Example
    protected override void OnExecutionUpdate(Execution execution, string executionId, double price, int quantity, MarketPosition marketPosition, string orderId, DateTime time)
    {
    Print("OnExecutionUpdate="+executionId+"quantity=" +quantity+"marketPosition="+marketPosition+"orderI d="+orderId+"time="+time);
    Print(execution.ToString());
    if ( stv2atmStrategyId.Length != 0 ) { AtmStrategyClose(stv2atmStrategyId);stv2atmStrateg yId = string.Empty ; stv2orderId= string.Empty;}
    if ( atmStrategyId.Length != 0 ) { AtmStrategyClose(atmStrategyId);atmStrategyId = string.Empty ; orderId= string.Empty;}
    if ( sqsatmStrategyId.Length != 0 ) { AtmStrategyClose(sqsatmStrategyId);sqsatmStrategyI d = string.Empty ; sqsorderId= string.Empty;}
    if ( sqlatmStrategyId.Length != 0 ) { AtmStrategyClose(sqlatmStrategyId);sqlatmStrategyI d = string.Empty ; sqlorderId= string.Empty;}
    }

    #2
    Hello shankar.deshapande,

    Thanks for your post.

    Atm strategies are separate strategies from NinjaScript strategies.

    You could consider using the Account class with Account.ExecutionUpdate since that is tied to the account, and the NinjaScript strategy is not actually submitting orders.

    See the help guide documentation below for more information.

    Account: https://ninjatrader.com/support/help...ount_class.htm
    Account.ExecutionUpdate: https://ninjatrader.com/support/help...tionupdate.htm

    Let us know if we may assist further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

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