Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Back Test not accurate when compared to daily break down

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

    Back Test not accurate when compared to daily break down

    Hello I am trying to back test a strategy and having a hard time getting accuarate results.

    I am testing a short time frame (MES 09-24 / CME US Index Futures RTH)
    Only parameters being changed are the dates (so I can see what the strategy did on a daily basis over the bigger time frame)
    The bigger time frame shows a Total net profit ( I will try and break down each day to articulate the issue

    09/04/24 - 09/11/24 - Total net profit 317.71 / Total trades 7 / Winning 2 / Losing 5

    09/04/24 - 09/04/24 - Total net profit (-58.66) / Total trades 3 / Winning 0 / Losing 3
    ​09/05/24 - 09/05/24 - Total net profit (-17.41)​ / Total trades 3 / Winning 1 / Losing 2
    ​09/06/24 - 09/06/24 - Total net profit (-53.66)​ / Total trades 3 / Winning 0 / Losing 3
    ​09/07/24 - 09/07/24 - Total net profit 0.00 / Total trades 0 / Winning 0 / Losing 0 (This is a weekend, so expect this based on RTH)
    ​09/08/24 - 09/08/24 - Total net profit 0.00 / Total trades 0 / Winning 0 / Losing 0 (This is a weekend, so expect this based on RTH)
    ​09/09/24 - 09/09/24 - Total net profit (-56.16)​ / Total trades 3 / Winning 0 / Losing 3
    ​09/10/24 - 09/10/24 - Total net profit 47.56 / Total trades 1 / Winning 1 / Losing 1
    ​09/11/24 - 09/11/24 - Total net profit (-54.85)​​ / Total trades 5 / Winning 1 / Losing 4

    So based on the daily break down only one day was profitable of 47.56 total trades where 18 / Winning 3 / Losing 16
    Prior to running these tests I have cleared NT Cache in db folder.

    If this data is not accurate it makes my back test unusable and testing under longer time frames is miss leading


    Please advise how I can get the longer time frame to match daily check.​
    ​​

    #2
    Hello jstaft,

    Thank you for your post.

    Whether or not backtesting over a larger timeframe will match your results from a strategy run on a single day depends on your code. It is likely that they will not match, as adding days to the testing range can change any indicator values used in the strategy and change the orders that have been made.

    Also note that there is a difference between backtest and live. Live orders are filled on an exchange with a trading partner on an agreed upon price based on market dynamics. Backtest orders are not using these market dynamics. Instead these are filled based on logical rules from processing historical data.
    • When in historical data, only the Open, High, Low, and Close will be available and there will be no intra-bar data.
      • This means actions cannot happen intra-bar, fills cannot happen intra-bar. All prices and actions come from and occur when the bar closes as this is all the information that is known
      • Because of this, OnBarUpdate will only update 'On bar close' as it does not have the intra-bar information necessary for 'On price change' or 'On each tick' and the script will not have the intra-bar information to accurately fill an order at the exact price and time.
    Intra-bar granularity adds a second data series such as a 1 tick series using AddDataSeries() so that the strategy or indicator has the individual ticks in the historical data in between the High and Low of the primary series.
    In NinjaTrader 8, there have been two new enhancements so that programmers may not have to manually add this secondary series and code the script for high accuracy fills (Order Fill Resolution) or for intra-bar actions (TickReplay) depending on the needs of the script.
    Note: bar types that are IsRemoveLastBarSupported cannot be used with TickReplay and generally cause inaccurate results when backtesting in historical data.
    Note: High Order Fill Resolution allows for intra-bar order fills with historical processing, but is not compatible with Tick Replay.

    Please see this support article for a detailed explanation:

    https://support.ninjatrader.com/s/ar...ar-granularity

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    56 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    132 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    73 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
    49 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X