Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    Brandon H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by timko, Today, 06:45 AM
    1 response
    7 views
    0 likes
    Last Post gaz0001
    by gaz0001
     
    Started by Waxavi, 04-19-2024, 02:10 AM
    3 responses
    41 views
    0 likes
    Last Post gaz0001
    by gaz0001
     
    Started by Max238, Today, 01:28 AM
    2 responses
    26 views
    0 likes
    Last Post NinjaTrader_ChristopherJ  
    Started by Shansen, 08-30-2019, 10:18 PM
    25 responses
    949 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by JonesJoker, 04-22-2024, 12:23 PM
    8 responses
    42 views
    0 likes
    Last Post JonesJoker  
    Working...
    X