Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Backtesting review - Chart Summary

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

    Backtesting review - Chart Summary

    I have successfully created entries and exits based off some simple EMA cross overs. It appears to be entering and exiting as designed so far. However, I want to make sure that all the entries I want to capture are captured.

    For instance, lets say for a rising 200SMA I want to capture all bullish EMA cross overs for a 5-20 cross and close if the 5-20 crosses in a bearish way. I am doing this over the past 10 years.

    So I run my strategy analyzer. When my results come back I switch to chart view. This is where I am encountering my problem. My chart view is not showing all the entries and exits, or at least it does not appear to be. I do see some trades on the chart which match my criteria - It shows the entries and exits. The ones I see make sense. However, scrolling backward it appears that some opportunities are clearly meeting my criteria but are not showing up on the chart. Is there a minimum number of times that the strategy shows up on your chart or something else which would limit the number of times the strategy would show up on the chart?

    I can tell my time frame is active, because if I set my time frame for 2 years my results change.

    Thanks in advance.

    #2
    Hello RISKYBUSINEZZ,

    Thank you for your post.

    Some discrepancies between realtime and backtest results and be expected due to the way historical order fills are processed based on OHLC values of bars. This is explained in more detail here:


    In a backtest, there is no intrabar granularity. OnBarUpdate is processed On Bar Close rather than On Price Change or On Each Tick In order to get more granular order fills, you could change the order fill processing to High instead of Standard resolution. This will allow you to select a secondary data series to be added for processing orders, including the most granular option of 1-tick. It is important to note that high order fill processing uses increased resources and could result in longer processing times for the backtest to complete.

    Another option would be to develop your strategy with a 1-tick added data series on which the orders are processed. For a reference sample demonstrating this type of strategy, please see the following link:


    Please let us know if we may be of further assistance.

    Comment


      #3
      I have played around with both "On Price Change" and "On Each Tick" it didn't appear to drastically change the outcomes of this strategy. I will try to take a screen shot a little later showing what I mean.

      Comment


        #4
        Hello RISKYBUSINEZZ,

        In a backtest, Calculate cannot be set to OnPriceChange or OnEachTick unless TickReplay is enabled. As TickReplay does not provide intra-bar information for order fills, it is necessary add a 1-tick series and use this for order submissions to provide 1-tick intra-bar granularity.

        Below is a link to a forum post that provides details.


        The chart will show all executions made to the primary instrument. The chart will be showing all executions that appear on the Executions display for the primary instrument.

        If the expected trade(s) are not appearing, this would indicate that the condition to place the order is not evaluating as true and the order is not being submitted, or the order is being ignored for other reasons, or the order is being cancelled.

        To understand why the script is behaving as it is, such as placing orders or not placing orders or drawing objects when expected, it is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.

        In the strategy add prints (outside of any conditions) that print the date time of the bar and all values compared in every condition that places an order.
        The prints should include the time of the bar and should print all values from all variables and all hard coded values in all conditions that must evaluate as true for this action to be triggered. It is very helpful to include a text label for each value and for each comparison operator in the print to understand what is being compared in the condition sets.

        Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).

        Further, enable TraceOrders which will let us know if any orders are being ignored and not being submitted when the condition to place the orders is evaluating as true.

        We are happy to assist you with analyzing the output from the output window.

        Run or backtest the script and when the output from the output window appears save this by right-clicking the output window and selecting Save As... -> give the output file a name and save -> then attach the output text file to your reply.

        Below is a link to a forum post that demonstrates using informative prints to understand behavior and includes a link to a video recorded using the Strategy Builder to add prints.
        https://ninjatrader.com/support/foru...121#post791121

        Please let me know if I may further assist with analyzing the output or if you need any assistance creating a print or enabling TraceOrders.​
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          This is what I was afraid of. I will definitely check these posts out.

          Comment

          Latest Posts

          Collapse

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