Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Accessing Heiken Ashi bars

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

    Accessing Heiken Ashi bars

    Hello,
    How do I access a Heiken Ashi bar for open, close, high, low in NT8?
    In NT7, it was referenced as follows:
    Code:
     
    HeikenAshi().HAClose[int barsAgo]
    Can I access it the same way in NT8?
    Thanks.

    #2
    Hello, aaadetos.

    Thank you for the post.

    If your chart is already using Heiken Ashi, you may use Close[0] to access the close since it is already the primary series.

    Code:
    protected override void OnBarUpdate() 
    { 
            double heikenLast = Close[0];
    }
    We can also add a Heiken Ashi series as a second series in your script.

    You will add the series in OnStateChange, namely State.SetDefault. Then, in OnBarUpdate(), you may access the bars with either CurrentBars or

    Code:
    protected override void OnStateChange()
    {
      if (State == State.SetDefaults)
      {
          Name = "Examples Indicator";           
      }
      else if (State == State.Configure)
      {
          // Add a 1 minute Heiken Ashi Bars object for the ES 09-14 contract - BarsInProgress index = 1 
          AddHeikenAshi("ES 09-14", BarsPeriodType.Minute, 1, MarketDataType.Last);
      }
    } 
     
    protected override void OnBarUpdate() 
    { 
        // Ignore the primary Bars object and only process the Heiken Ashi object 
        if (BarsInProgress == 1)
        {
            // Do something;
        }
    }
    Here are links to the help guide on AddHeikenAshi and working with multiple series scripts.




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

    Comment


      #3
      Thank you. Is HeikenAshi used as an indicator in NT7?

      Comment


        #4
        Hello aaadetos,

        That is correct, the Heiken Ashi is an indicator in NinjaTrader 7, it became part of the default bar types in NinjaTrader 8.
        There is also a Heiken Ashi indicator for NinjaTrader 8 on the forum:


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

        Comment


          #5
          Thanks Chris

          Comment


            #6
            Hi ChrisL,

            What is the formula that is used in NT8 to calculate OHLC of HA bars based on original price bars?

            Originally posted by NinjaTrader_ChrisL View Post
            Hello aaadetos,

            That is correct, the Heiken Ashi is an indicator in NinjaTrader 7, it became part of the default bar types in NinjaTrader 8.
            There is also a Heiken Ashi indicator for NinjaTrader 8 on the forum:
            https://ninjatrader.com/support/foru...d=7&linkid=730

            Please let us know if we may be of any further assistance.
            Last edited by Arrow21; 10-17-2018, 12:53 AM.

            Comment


              #7
              Hello Arrow21,

              Thank you for the post.

              I have attached the code for you to review. To import the code, go to Tools>Import>NinjaScript Add-on.

              Please let me know if I can assist further.
              Attached Files

              Comment


                #8
                Thanks ChrisL. File is read successfully in NT8. Now will HA be a default option as chart type? Also how do I review the code? Total Newbie here. Sorry for simple questions

                Comment


                  #9
                  Hello Arrow21,

                  Thank you for the reply.

                  The script is an indicator, you should see it if you right-click the chart and select Indicators, then apply that indicator to the chart.

                  You may review the code for the indicator by going to New>NinjaScript Editor>Indicators folder.

                  Note that NinjaTrader 8 has a Heiken Ashi bar type by default in the "Type" field of the Data Series menu.

                  Please let me know if I can assist further.

                  Comment

                  Latest Posts

                  Collapse

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