Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy analyzer doesn't work with my custom strategy

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

    Strategy analyzer doesn't work with my custom strategy

    Hi! I built a custom strategy and when I tried to backtest it in the strategy analyzer I got no data displayed like on the post I linked below. The prebuilt sample strategies are working fine so I guess the problem is from my strategy but I don't know what I should do to enable backtesting on strategy analyzer.
    https://forum.ninjatrader.com/forum/ninjatrader-8/platform-technical-support-aa/1093330-strategy-analyzer-doesn-t-work

    #2
    Hello Tessan,

    If the strategy is in the Strategy Analyzer, is there data appearing on the Chart Display of the Strategy Analyzer?
    Importantly, are there errors appearing on the Log tab of the Control Center?

    Try testing the Sample MA Crossover strategy included with NinjaTrader on the same chart or Strategy Analyzer using the same instrument, bar type, interval, and date range.
    Do you see results with the Sample MA Crossover strategy? (This would confirm for us data is available and the issue is with the logic in the custom script)

    If the strategy is getting data and the strategy is enabled or a backtest is run with no errors in the Log tab of the Control Center, and the Sample MA Crossover is returning results, then would likely indicate the logic conditions in the custom strategy did not evaluate as true or orders are being ignored or cancelled.

    In order to better understand how the code is working, it will be necessary to use Print to see how the conditions are evaluating and enable TraceOrders to see if orders are being submitted, ignored, rejected, or cancelled.

    Below is a link to a support article that demonstrates using prints to understand behavior and includes a link to a video recorded using the Strategy Builder to add prints.


    Enable TraceOrders, print the time of the bar and all values used in the conditions that submit entry orders. Include labels for all values and comparison operators.
    Let me know if you need any assistance creating a print or enabling TraceOrders.
    Save the output from the output window to a text file and provide this with your reply.
    I'll be happy to assist with analyzing the output.​
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I tested the MA Crossover strategy included with NinjaTrader on the Strategy Analyzer using the same instrument, bar type, interval, and date range and it's working fine, it display all the datas.
      I don't have much information on the log about potential order submitting issue, I'll look foward with print function for deeper debugging.
      Does the logs are printed too when backtesting with the strategy analyzer?
      Do you know if a custom strategy needs a special parameter set to allow backtesting on historical datas maybe?

      Comment


        #4
        Hello Tessan,

        The Prints that appear in the NinjaScript Output window that I have directed you to add will also appear when backtesting.

        The log will not have information about backtests.

        "Do you know if a custom strategy needs a special parameter set to allow backtesting on historical datas maybe?"

        By default all strategies will process historical data. It is possible to explictly add logic to prevent a script from processing historical data.

        if (State == State.Historical)
        return;
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          I added some prints in my strategy script but data appears only when I launch the strategy on live data. Nothing appear on the NinjaScript Output during the backtest. It's weird

          Comment


            #6
            Hello Tessan,

            Importantly, are there errors appearing in orange on the Log tab of the Control Center?

            Did you add a print as the first line of the OnBarUpdate() block?
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            80 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            46 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            29 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            32 views
            0 likes
            Last Post TheRealMorford  
            Started by Mindset, 02-28-2026, 06:16 AM
            0 responses
            66 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Working...
            X