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

NT8 Strategies take a long time to start

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

    NT8 Strategies take a long time to start

    I am having an issue where by when I start my strategies it some times take over 20 minutes for them to start. It is as if the system hangs. I am using range and wicked renko charts. If I load the indicators used in the strategy to the chart manually, they all come up just fine. However when I run the strategy with them, it takes forever.
    I have even gone as far as trying to ensure nothing much is executed until realtime and any files loaded are only loaded once prior to realtime state. There is nothing showing up in the logs, nothing showing in the trace print for the outoutto say it is even processing the strategy to get it started?

    What am I missing here? It works fine on Ninjatrader 7 and started up in less than 20 seconds.

    Any pointers for where to look? It seems other people are experiencing freezing which may seem to indicate something is wrong.

    #2
    Hello,

    Thank you for the post.

    Based on the description it sounds like one of the items used in the strategy or the strategy its self is taking a long time to complete whatever it was programmed to do.

    To resolve this you would likely need to do some testing with the strategies code to further isolate what specifically is causing the slowdown.

    You noted that the indicators apply manually fine, I would likely suggest starting there with the strategies logic or to remove the indicators and see if it still takes a long time to load. If so, the logic in the script is somehow creating that situation, otherwise, something in one of the indicators would be.

    There can be differences in how an indicator reacts when being hosted from a strategy as it will inherit some of the strategies properties so this can change the outcome of manually applying an item versus using a strategy.

    If the strategies logic requires the indicators for it to work, you may also try replacing the current indicators with more simple ones like SMA's for testing purposes.


    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Ok. I think i found my issue.

      else if (State == State.DataLoaded)
      {

      VB = VarianceImbalance3();
      AddChartIndicator(VB);



      The AddChartIndicator is what freezes trying to add the indicators. I have about 5 such add chart indicators.Seems I can only leave one. If I don't put those addChartIndicator and just assign the indicator, the strategy runs fine and is not sluggish. The moment I try to add them, it takes a long time to get going. A really long time so I am assuming something is wrong in that addChartIndicator.

      Comment


        #4
        Hello,

        Thank you for the additional details.

        Based on this information, I couldn't say that AddChartIndicator has anything wrong at this point as a custom indicator is being used. I would likely suggest that you debug this situation further when using that specific indicator to see what in its logic is performing differently when used with AddChartIndicator.

        If you instead try using an SMA as one example, does the same slowness occur? If so, that would be a case where we would want to look at the actual method to see why that is happening.

        Very likely there is something different happening when manually applying the item versus AddChartIndciator. The AddChartIndciator method hosts the indicator so it can perform differently especially if you are not calling it later from OnBarUpdate. There is a note in the help guide surrounding this concept and how to have a hosted item have its OnBarUpdate called https://ninjatrader.com/support/help...ChartIndicator

        This information may or may not apply I wouldn't have enough details at this point to really say. Debugging the situation should result in an answer as to why this indicator causes the slowdown when used with this method.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Well the indicators work just fine and load fine if I add them manually to the strategy. My work around until the update that fixes this would be to simply not have the strategy add them visually to the chart, but add them my self. This seems to work just perfect so that my fix till the official.

          Thanks for your assistance.

          Comment


            #6
            Hello,

            Thank you for the reply.

            To be clear at this point I have not submitted anything to development and there would be nothing to report for a fix as we have not yet discovered what is causing the slowness while using your custom code. In the prior posts, I had noted some steps you can take to test your custom code, you would need to do this step if something is not working as expected while using that indicator.

            If you choose to not add the indicator visually as the solution that is fine if that is what you want but if you do want to use the custom indicator visually in this situation, you would need to debug it. By just removing the AddChartIndicator that does not answer the question of why that is happening, nor does it tell us the indicator is in a stable condition.

            Adding an indicator manually to a chart versus the strategy adding it can lead to differences and I would not suggest trying to compare the two. Only AddChartIndicator will be accurate to what the strategy is actually seeing. If you need to see the item visually you will need to debug the indicator further as I would not suggest what you have done as a solution to your question.

            There is likely a difference happening in how the logic in the indicator is executed when hosted. Manually applying an indicator is not exactly the same as a strategy hosting an indicator. If you have a case that is causing a slowness you would need to isolate the syntax in the indicator causing that slowness. If that is not apparent why that syntax it is being slow, we would need a sample of only that logic to review.

            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment


              #7
              If your Strategy is Multi-Timeframe, the below may be pertinent.
              If your Strategy is not Multi-Timeframe, please disregard.

              You may wish to vote for FEATURE REQUEST - Strategy Properties in the Control Center Strategy Grid (ticket ID SFT-2875).

              As an interim solution, where your Strategy is applied to a Chart where the DataSeries is based on, for example, 2 Bars, BarsArray[1] (and all subsequent BarsArrays) will also be based on 2 Bars. Where your Strategy is applied via the Control Centre Strategy Grid, I believe your only recourse is to limit DaysToLoad. This distinction becomes critical with a Multi-Timeframe Strategy where BarsArrays Periods differ significantly (e.g. periods including 1tick and 1month).

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Skifree, Today, 03:41 AM
              1 response
              2 views
              0 likes
              Last Post Skifree
              by Skifree
               
              Started by usazencort, Today, 01:16 AM
              0 responses
              1 view
              0 likes
              Last Post usazencort  
              Started by kaywai, 09-01-2023, 08:44 PM
              5 responses
              603 views
              0 likes
              Last Post NinjaTrader_Jason  
              Started by xiinteractive, 04-09-2024, 08:08 AM
              6 responses
              23 views
              0 likes
              Last Post xiinteractive  
              Started by Pattontje, Yesterday, 02:10 PM
              2 responses
              23 views
              0 likes
              Last Post Pattontje  
              Working...
              X