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 pibrew, Today, 06:37 AM
      0 responses
      4 views
      0 likes
      Last Post pibrew
      by pibrew
       
      Started by rbeckmann05, Yesterday, 06:48 PM
      1 response
      14 views
      0 likes
      Last Post bltdavid  
      Started by llanqui, Today, 03:53 AM
      0 responses
      6 views
      0 likes
      Last Post llanqui
      by llanqui
       
      Started by burtoninlondon, Today, 12:38 AM
      0 responses
      11 views
      0 likes
      Last Post burtoninlondon  
      Started by AaronKoRn, Yesterday, 09:49 PM
      0 responses
      16 views
      0 likes
      Last Post AaronKoRn  
      Working...
      X