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

Strategy disable delay

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

    Strategy disable delay

    What would cause a long delay in a strategy disabling when clicking on the Enabled Button on the Strategies tab? I am talking about a one minute delay where NT control panel freezes until the strategy unchecks. Enabling is fine, disabling takes alot longer. No compiling / log errors apparent. Regards and many thanks. the code contains many of the following loops types:

    for (int esuhsc = 0, esuhscx = intSizeES; esuhsc < esuhscx; esuhsc++)
    {
    if (BarsInProgress == 1
    && Positions[1].MarketPosition == MarketPosition.Flat
    && CurrentBars[0] > barNumberOfOrderES + 5)
    {
    foreach(Order order in orderList)
    {
    if( order.Name == "ES SHORT LIMIT" + esuhsc)
    CancelOrder(order);
    gapEStradetoday = false;
    }
    }
    }
    Last edited by elliot5; 03-03-2021, 04:19 AM.

    #2
    Hello elliot5,

    Code being run in State.Terminated could cause behavior such as this.

    A large position that has to be exited, or a large amount of order cancellations could also cause this.

    Are you able to reproduce this behavior with the SampleMACrossOver included with NinjaTrader, in a new blank workspace with all other workspaces closed?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I have solved this issue by embedding the loops deeper into the code. Clearly the multiple loops were causing the delay. Regards and many thanks for your support

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by rocketman7, Today, 02:12 AM
      5 responses
      22 views
      0 likes
      Last Post rocketman7  
      Started by trilliantrader, 04-18-2024, 08:16 AM
      7 responses
      28 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by samish18, 04-17-2024, 08:57 AM
      17 responses
      66 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by briansaul, Today, 05:31 AM
      1 response
      15 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by PaulMohn, Today, 03:49 AM
      1 response
      12 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Working...
      X