Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Start strategy form script

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

    Start strategy form script

    Hello,

    Is it possible to start or close (enable\disable) strategy from NT script and not from control center or chart?

    Sincerely, Kobi



    #2
    Hello Kobi,

    Thanks for your post.

    There is not a way to programmatically enable strategies, but strategies can be programmatically disabled by looping through the Account.Strategies collection and calling CloseStrategy for each strategy in the collection. For example:

    Code:
    Account myAccount;
    
    lock (Account.All)
        myAccount = Account.All.FirstOrDefault(a => a.Name == "Sim101");
    
    foreach(StrategyBase strat in myAccount.Strategies)
        strat.CloseStrategy("Close Strategy");
    Account.Strategies - https://ninjatrader.com/support/help...es_account.htm

    CloseStrategy - https://ninjatrader.com/support/help...sestrategy.htm

    We look forward to assisting.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CaptainJack, 05-29-2026, 05:09 AM
    0 responses
    163 views
    0 likes
    Last Post CaptainJack  
    Started by CaptainJack, 05-29-2026, 12:02 AM
    0 responses
    82 views
    0 likes
    Last Post CaptainJack  
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    125 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    206 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    184 views
    0 likes
    Last Post CarlTrading  
    Working...
    X