Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Backtest vs chart enable strategy

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

    Backtest vs chart enable strategy

    Hello,

    I have a strategy that utilizes 8 different Long Entries each with a different signal name. Each exit corresponds with a specific entry signal.

    When I back test the strategy in the strategy analyzer, the exit match up with the entries. (See below)

    Entry name Exit name
    LEn1 LEx1
    LEn8 LEx8
    LEn5 LEx5
    LEn6 LEx6
    LEn5 LEx5
    LEn4 LEx4
    LEn4 LEx4
    LEn1 LEx1
    LEn9 LEx9
    LEn1 LEx1
    LEn9 LEx9
    LEn5 LEx5
    LEn8 LEx8
    LEn5 LEx5
    LEn8 LEx8
    LEn4 LEx4
    LEn9 LEx9
    LEn9 LEx9
    LEn5 LEx5
    LEn5 LEx5
    LEn5 LEx5
    LEn6 LEx6
    LEn6 LEx6

    When I open a chart (same settings as back test) and enable my strategy, I get a different results. The exit signal names don't match up with the entry signal names. (See below)

    Entry name Exit name
    LEn8 LEx1
    LEn1 LEx8
    LEn5 LEx5
    LEn4 LEx6
    LEn4 LEx5
    LEn6 LEx4
    LEn5 LEx4
    LEn1 LEx1
    LEn9 LEx9
    LEn1 LEx1
    LEn9 LEx9
    LEn5 LEx5
    LEn8 LEx8
    LEn5 LEx5
    LEn4 LEx8
    LEn8 LEx4
    LEn9 LEx9
    LEn9 LEx9
    LEn4 LEx5
    LEn5 LEx5
    LEn4 LEx5
    LEn6 LEx6
    LEn4 LEx6
    LEn6 LEx6

    I would like to understand why my strategy works as expected in backtesting mode, but not when enabled on a chart.

    Thanks,
    eleven

    #2
    Hello eleven,

    When the strategy is run a chart, may I confirm you are viewing the Strategy Performance and not the Trade Performance window?


    Are you viewing both historical and real-time in the strategy performance window?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Yes. I'm viewing the Strategy Performance (historical only) in chart and not the Trade Performance Window.

      Comment


        #4
        Hello eleven,

        The historical data on a chart is the same as a backtest on the Strategy Analyzer.

        The only difference would be that you can open the strategy performance for real-time instead of just historical.

        May I test the script?

        To export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:
        1. Click Tools -> Export -> NinjaScript...
        2. Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
        3. Click the 'Export' button
        4. Enter a unique name for the file in the value for 'File name:'
        5. Choose a save location -> click Save
        6. Click OK to clear the export location message
        By default your exported file will be in the following location:
        • (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
        Below is a link to the help guide on Exporting NinjaScripts.
        http://ninjatrader.com/support/helpG...-us/export.htm

        Once exported, please attach the file as an attachment to your reply.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Chelsea,

          Here is my strategy that exhibits that behavior.

          Thanks,
          eleven
          Attached Files

          Comment


            #6
            Hello eleven,

            I am not able to reproduce this behavior.

            I have backtested the script over the last week of data, then added the strategy to a chart over the same date range, and the net profit, number of trades, and all the trades match.


            I am not seeing differences in the trades on the chart and strategy analyzer.

            To confirm, if you follow the exact steps in the video the behavior is different on your end?

            Are you using the latest release of NinjaTrader 8.0.26.1?
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              hmmm....I copied exactly what you did and same thing as before. I could not replicate what you observed in your video. The strategy back test entries/exit match up, but on chart they do not. I upgraded to the latest version of NT8 as well. Any ideas on how to fix or reset this on my end?

              Comment


                #8
                Hello eleven,

                I would suspect something is different in either the Data Series or Strategy parameters.

                May I have screenshots of the Strategy Analyzer parameters, the Data Series parameters from the chart, and the Strategy parameters from the chart?
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  Test for Chelsea

                  Comment


                    #10
                    Chelsea,

                    Here are screenshots of my settings. Please let me know what you see. Thanks, eleven
                    Attached Files
                    Last edited by eleven; 07-13-2022, 09:38 PM.

                    Comment


                      #11
                      Chelsea,

                      I tried this strategy on a different computer with the same result. Can you run the strategy on a year of daily bars and check again?

                      Thanks,
                      Tom

                      Comment


                        #12
                        Hello Tom,

                        I am seeing that the Strategy Analyzer is pairing executions in the trades correctly but the Strategy Performance from the chart is not pairing the correct executions in the trades.

                        The executions themselves appear to the be same, so the strategy execution is the same. Its just the Strategy Performance pairing that appears to be incorrect.

                        I'm inquiring more with our development.

                        Thanks for your patience with this.
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          Thanks Chelsea. This doesn't impact executions but thought I'd point it out.

                          Thanks,
                          Tom

                          Comment


                            #14
                            I think I could be here my other question:

                            In Ninja 7 when I test a strategy if the historical date I do not have it, the N7 automatically download, but not occur in Ninja 8,
                            I have to download in chart the data and only after I have to test the strategy.
                            Have some parameterize to solve this a problem?

                            Comment


                              #15
                              Hello jmagaia,

                              The Strategy Analyzer loads data the same as a chart.

                              Restart NinjaTrader to ensure there is an active connection to the historical data servers.

                              Connect to a data feed that provides the historical data for the data type.

                              Ensure Tools -> Options -> Market Data -> 'Get data from server' is checked an enabled.

                              Delete the historical data to cause this to reload.
                              Chelsea B.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by NullPointStrategies, Yesterday, 05:17 AM
                              0 responses
                              64 views
                              0 likes
                              Last Post NullPointStrategies  
                              Started by argusthome, 03-08-2026, 10:06 AM
                              0 responses
                              139 views
                              0 likes
                              Last Post argusthome  
                              Started by NabilKhattabi, 03-06-2026, 11:18 AM
                              0 responses
                              75 views
                              0 likes
                              Last Post NabilKhattabi  
                              Started by Deep42, 03-06-2026, 12:28 AM
                              0 responses
                              45 views
                              0 likes
                              Last Post Deep42
                              by Deep42
                               
                              Started by TheRealMorford, 03-05-2026, 06:15 PM
                              0 responses
                              50 views
                              0 likes
                              Last Post TheRealMorford  
                              Working...
                              X