Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Backtesting an /ES Strategy That Uses Heiken Ashi Candles

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

    Backtesting an /ES Strategy That Uses Heiken Ashi Candles

    I saw an /ES strategy on YouTube & wanted to backtest it, hopefully someone can help me out.

    The strategy uses Heiken Ashi candles & goes as follows -
    On a 5 minute chart you would go long /ES after two green flat bottomed Heiken Ashi candles & exit when a wick appears below a candle or on a candle color change, in this case green to red. For shorting it would be two red flat topped candles exiting when a wick appears above a candle or a red to green color change.

    Ideally I'd like to run two backtests - one that exits when a wick appears below or above a candle & one that exits on a candle color change.

    Thanks!

    #2
    Originally posted by preqc View Post
    I saw an /ES strategy on YouTube & wanted to backtest it, hopefully someone can help me out.
    Welcome to the forums!

    Can you provide the YouTube link?

    Comment


      #3
      Originally posted by bltdavid View Post

      Welcome to the forums!

      Can you provide the YouTube link?
      You asked - I answered...or well, tried to answer in my own special way.00:00 Here's Lies $5K...We hardly knew Ye...00:44 Q1 - When is the next challenge?02:...


      skip to 7:00

      Comment


        #4
        Hello preqc,

        Thank you for your posts.

        If you're going to be backtesting a Heiken Ashi strategy, you should be aware that Heiken-Ashi candles present false information concerning each candle.

        Here is how the Heiken-ashi is calculated:
        HAClose = ((Open[0] + High[0] + Low[0] + Close[0]) * 0.25); // Calculate the close
        HAOpen = ((HAOpen[1] + HAClose[1]) * 0.5); // Calculate the open
        HAHigh = (Math.Max(High[0], HAOpen[0])); // Calculate the high
        HALow = (Math.Min(Low[0], HAOpen[0])); // Calculate the low

        When you place an order it can only fill on real price data.

        The strategy analyzer does not know what the base data is that created the Heiken-Ashi bar and it will backtest based on the false information presented.

        A work around, for backtesting in the strategy analyzer, would be to use the indicator HeikenAshi8 in your strategy and use standard bars in the chart/analyzer so that the backtest results are based on real data points and your strategy can use the Heiken-ashi values for your entry conditions

        The HeikenAshi8 indicator can be found here: https://ninjatraderecosystem.com/use...heiken-ashi-8/ Please note: 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.

        For what you're wanting to do, you would want to compare whether HAOpen[0] == HALow[0] and HAOpen[1] = HALow[1] for a long entry as that would tell you if there have been 2 flat bottomed green candles. For red candles with flat tops, HAOpen[0] == HAHigh[0] and HAOpen[1] = HAHigh[1] for two of those. Candles with wicks would have highs and lows that do not match the open or close (depending on candle direction and which end the wick is on. You can check whether a candle is red or green by checking whether the HAClose is greater or less than HAOpen.

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

        Kate W.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by StockTrader88, 03-06-2021, 08:58 AM
        45 responses
        3,991 views
        3 likes
        Last Post johntraderuser2  
        Started by TAJTrades, Today, 09:46 AM
        0 responses
        7 views
        0 likes
        Last Post TAJTrades  
        Started by rhyminkevin, Yesterday, 04:58 PM
        5 responses
        62 views
        0 likes
        Last Post dp8282
        by dp8282
         
        Started by realblubb, Today, 09:28 AM
        0 responses
        8 views
        0 likes
        Last Post realblubb  
        Started by AaronKoRn, Yesterday, 09:49 PM
        1 response
        19 views
        0 likes
        Last Post Rikazkhan007  
        Working...
        X