Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy builder backtest fills inaccurate

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

    Strategy builder backtest fills inaccurate

    Hello,

    I am testing a ninjatrader strategy which I have built. It uses Heiken Ashi candles however the backtest data fills/exits are very different from the actual fills/exits when comparing to regular candles. I was just wondering if there was a solution to this problem or if NT has something built in to remedy this for better backtesting data.

    #2
    Hello dgutz15,

    Thank you for your note.

    We have some notes in our help guide regarding possible discrepancies between real-time and backtest, including why Heiken Ashi bars are difficult to backtest. These bars use a "fake" open price. In real-time, there is a functionality to remove the last bar and replace it with a new open price, though this is challenging to simulate historically. One workaround would be to test your strategy in the Playback Connection because the bars could be built tick-by-tick and simulated as if they were in real-time. Another option would be to use High Order Fill Resolution or submit the orders to a 1-tick data series. One additional option would be to use a Heiken Ashi indicator for your calculations in the strategy. These notes about discrepancies may be found at the following link:


    If you are interested in using a Heiken Ashi indicator, this indicator is publicly available on our NinjaTrader Ecosystem website:
    Here is a basic guideline of how to import NinjaScript add-ons in NinjaTrader 8:

    Note — To import NinjaScripts you will need the original .zip file.

    To Import:
    1. Download the NinjaScripts to your desktop, keep them in the compressed .zip file.
    2. From the Control Center window select the menu Tools > Import > NinjaScript Add-on...
    3. Select the downloaded .zip file
    4. NinjaTrader will then confirm if the import has been successful.

    Critical - Specifically for some NinjaScripts, it will prompt that you are running newer versions of @SMA, @EMA, etc. and ask if you want to replace, press 'No'

    Once installed, you may add the indicator to a chart by:
    • Right-click your chart > Indicators... > Select the Indicator from the 'Available' list on the left > Add > OK

    Here is a short video demonstration of the import process:
    Please let me know if I can be of further assistance.

    The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.
    Emily C.NinjaTrader Customer Service

    Comment


      #3
      Hi Emily, thank you. I downloaded the indicator and understand how to add it to the chart, but how can I implement it into my strategy in order to get correct historical data?

      Just adding the indicator to the chart and running the strategy just gives me historical data for the strategy using 1m regular candles or 1m Heikin Ashi (whichever I have my dataset set to)

      ----------------------------------------------------------------------

      Update: I have added the HA indicator to my strategy and set value to Close. I want to run this through strategy analyzer but am not sure if using 1m regular candles or 1m HA candles for data series is correct. Please advise, thank you.
      Last edited by dgutz15; 12-13-2022, 10:31 AM.

      Comment


        #4
        Hello dgutz15,

        Thank you for your reply.

        When using the indicator in your strategy, rather than setting your strategy logic to calculate on the OHLC values from the data series, you would use the plots from the Heiken Ashi indicator such as HAOpen, HAHigh, HALow, and HAClose. If you were previously using the data series settings with a Type of Heiken Ashi, base period type minute, and base period value of 1, then you would want to set the data series to simply a 1-minute candle type and the indicator will calculate the Heiken Ashi values based on the 1-minute data.

        I hope this helps to clarify. Please let us know if we may be of further assistance.
        Emily C.NinjaTrader Customer Service

        Comment


          #5
          Hi,
          I have several strategies that back test well using a Heiken Ashi 1 minute data series. They have good average trades, i.e., >=$60.

          I have the thought that since I am using relatively short intervals, e.g., 1 minute, the differences between the Heiken Ashi data and the real time data should not be too pronounced; in other words, a strategy that backtests very well with Heiken Ashi 1 minute data should probably work well in real time also. Is that a correct assumption?

          Comment


            #6
            Originally posted by drsclaud23 View Post
            Hi,
            I have several strategies that back test well using a Heiken Ashi 1 minute data series. They have good average trades, i.e., >=$60.

            I have the thought that since I am using relatively short intervals, e.g., 1 minute, the differences between the Heiken Ashi data and the real time data should not be too pronounced; in other words, a strategy that backtests very well with Heiken Ashi 1 minute data should probably work well in real time also. Is that a correct assumption?
            The OHLC values of Heiken Ashi bars are not truly the Open, High, Low, and Close prices. They are moving average values. This can skew backtest results, as the historical fill algorithm bases order fill prices on the OHLC prices. I suggest testing your strategy on the Playback connection and comparing those results with a backtest for the same period of time to understand how the two results could be different, then you could also consider using the Heiken Ashi indicator in your strategy rather than Heiken Ashi bars. Using the indicator allows you to get Heiken Ashi OHLC values (moving average values) and still utilize the actual OHLC prices of the bars type for the historical fill algorithm.

            Please let us know if we may be of further assistance.
            Emily C.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Option Whisperer, Today, 09:55 AM
            1 response
            11 views
            0 likes
            Last Post bltdavid  
            Started by port119, Today, 02:43 PM
            0 responses
            1 view
            0 likes
            Last Post port119
            by port119
             
            Started by Philippe56140, Today, 02:35 PM
            0 responses
            3 views
            0 likes
            Last Post Philippe56140  
            Started by 00nevest, Today, 02:27 PM
            0 responses
            2 views
            0 likes
            Last Post 00nevest  
            Started by Jonafare, 12-06-2012, 03:48 PM
            5 responses
            3,986 views
            0 likes
            Last Post rene69851  
            Working...
            X