Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy not working on Real Time Kagi Chart

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

    Strategy not working on Real Time Kagi Chart

    I'm trying to use this strategy: https://ninjatraderecosystem.com/use...-strategy-nt8/, published by NinjaTrader_Jim, on Kagi Charts (settings are 2, Minute, 1, Tick) and when running on historical data, it results in completely different trades than real time data. Is there anything I can do to fix this? Relevant pictures are attached below:

    Thank you for your help.

    Here are the results from this morning:

    Historical Trades:
    Click image for larger version

Name:	image_2022-06-08_140711392.png
Views:	342
Size:	51.6 KB
ID:	1204428
    Real Time Trades:
    Click image for larger version

Name:	image_2022-06-08_140802363.png
Views:	297
Size:	40.6 KB
ID:	1204429 Here are the strategy settings:
    Click image for larger version

Name:	image_2022-06-08_141036435.png
Views:	299
Size:	49.0 KB
ID:	1204432
    Attached Files

    #2
    Hello akm39,

    Thank you for your post.

    You should expect that a strategy running real-time (live brokerage account, live market simulation, in Playback using Market Replay etc...) will produce different results than the performance results generated during a backtest, either in the Strategy Analyzer or over historical data on a chart. This difference may be more easily seen on certain Bars types (e.g. Point and Figure, Renko) than others due to their inherent nature in bar formation.

    During a backtest you can select conservative or liberal fill algorithms which will produce different results. Fills are determined based on 4 data points, OHLC of a bar since that is the only information that is known during a backtest 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'.

    Also, here is a link to the differences on real-time vs backtest (historical).

    http://ninjatrader.com/support/helpG...ime_vs_bac.htm

    Adding intra-bar granularity can help with this.

    Intra-bar granularity adds a second data series such as a 1 tick series so that the strategy has finer granularity in the historical data in between the OHLC of the primary series. This allows for more accurate trades by supplying the correct price at the correct time for the order to fill with.

    In NinjaTrader 8, there have been two new enhancements so that programmers do not have to manually add this secondary series and code the script to for high accuracy fills (Order Fill Resolution) and for intra-bar actions (TickReplay).

    Here is a link to another post on our forums that goes into depth on using Order Fill Resolution and Tick Replay to ensure your backtests are as close to real time results as possible:

    https://ninjatrader.com/support/foru...mance?t=102504

    High Fill Order Resolution and TickReplay cannot be used together. If it is necessary to have both, it is still possible to add intra-bar granularity to a script in the code itself for order fill accuracy and use TickReplay to update indicators with Calculate set to OnPriceChange or OnEachTick historically.

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

    Comment


      #3
      Hi Kate.

      Thank you for your help but changing the order fill processing to high didnt affect my final result. They simply resulted in the exact same trades as before, with slightly different entries and exits. So what else could I use to improve the accuracy of my backtest?

      Comment


        #4
        I think this is probably because even in the backtested strategy, I use “on bar close” so adding inter bar tick data doesn’t seem to affect the result. I wanted to know why there are such huge differences between the theoretical strategy and the actual one.

        Comment


          #5
          Hello akm39,

          Thank you for your reply.

          The issue here is really the use of kagi bars. The issue of backtests being different from real time would be seen with exotic bars types like PnF and Kagi. - http://www.ninjatrader.com/support/h.../bar_types.htm

          To backtest those more accurately we normally suggest either running in Playback using Market Replay or submitting orders to an added 1 tick series in backtesting, so a higher fidelity fill can be worked with - however, the 1 tick series would simply provide more accurate fill prices. You'd get the most accurate to real time results using Playback.

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

          Comment


            #6
            Hi Kate,

            Thanks for your help yet again. Regarding market replay, what is an appropriate speed to use? I'd imagine 1x would be the most accurate, but it would take ages to do. I'd also image a really high speed has the risk of missing trades or interpreting data incorrectly.

            Thank you for your support.

            Comment


              #7
              Hello akm39,

              Thank you for your reply.

              You can experiment, but I would expect the same trades to be taken when on max speed than would be taken at 1x speed, just more rapidly.

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

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NullPointStrategies, Today, 05:17 AM
              0 responses
              50 views
              0 likes
              Last Post NullPointStrategies  
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              126 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              69 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              42 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              46 views
              0 likes
              Last Post TheRealMorford  
              Working...
              X