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

Back testing Heiken Ashi

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

    Back testing Heiken Ashi

    Hi everyone

    If I wanted to back test the Heiken Ashi, how can I translate into code "if Heiken Ashi is trending up"?
    I see in the code
    Color barColor = (Values[3][0] > Values[0][0] ? BarColorUp : BarColorDown);
    Values[3].Set((Open[0] + High[0] + Low[0] + Close[0]) / 4); // Calculate the close
    Values[0].Set((Values[0][1] + Values[3][1]) / 2); // Calculate the open

    If I use the condition HeikenAshi().HAClose[0] > HeikenAshi().HAOpen[0] I get no trades.

    Thank you

    #2
    From the snippet provided I think you can directly work with the rule setting the right barColor - Values[3][0] > Values[0][0]

    You can also check this code - http://www.ninjatrader-support2.com/...2&d=1232051214
    BertrandNinjaTrader Customer Service

    Comment


      #3
      If I try to build the strategy from the wizard, I have 4 options for the Plot: HAOPen, HAClose, HAHIgh, HALow.
      I thought the green bars (up trend) were satisfied if HAClose > HAOpen, but yet it doesn't work (no trades).

      Thank you

      Comment


        #4
        stefy, the default HeikenAshi indicator is meant to be used on the chart only, not in the Strategy Wizard, please check the link I posted previously.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          I checked the link, but that is an indicator, not a strategy.

          How can I simply recall (writing a strategy) Values[3][0]?

          I tried:

          if (HeikenAshi().Values[3][0] > HeikenAshi().Values[0][0])

          it compiles, but it doesn't work.

          Thanks

          Comment


            #6
            As Bertrand mentioned, Heiken Ashi is a visualization only indicator. You cannot programmatically access the values for use in a strategy.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              PS, please recheck the link, it includes an indicator and a strategy.
              BertrandNinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_Bertrand View Post
                From the snippet provided I think you can directly work with the rule setting the right barColor - Values[3][0] > Values[0][0]

                You can also check this code - http://www.ninjatrader-support2.com/...2&d=1232051214
                Hi Bertrand,

                Tried your previous link: http://www.ninjatrader-support2.com/...2&d=1232051214

                Came up 404 not found. Do you have another link I could check please?

                Comment


                  #9
                  Hello mattyv,

                  Thank you for your post and welcome to the NinjaTrader Support Forum!

                  You can find the link here: http://ninjatrader.com/support/forum...2&d=1232051214

                  I have attached the file to this response as well.
                  Attached Files

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Waxavi, Today, 02:10 AM
                  0 responses
                  3 views
                  0 likes
                  Last Post Waxavi
                  by Waxavi
                   
                  Started by TradeForge, Today, 02:09 AM
                  0 responses
                  7 views
                  0 likes
                  Last Post TradeForge  
                  Started by Waxavi, Today, 02:00 AM
                  0 responses
                  2 views
                  0 likes
                  Last Post Waxavi
                  by Waxavi
                   
                  Started by elirion, Today, 01:36 AM
                  0 responses
                  4 views
                  0 likes
                  Last Post elirion
                  by elirion
                   
                  Started by gentlebenthebear, Today, 01:30 AM
                  0 responses
                  4 views
                  0 likes
                  Last Post gentlebenthebear  
                  Working...
                  X