• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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.

    https://ninjatrader.com/support/help...heikenashi.htm
    https://ninjatrader.com/support/help...nstruments.htm

    Please let us know if we may be of any further assistance.
    Chris L.NinjaTrader Customer Service

    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:
        https://ninjatrader.com/support/foru...d=7&linkid=730

        Please let us know if we may be of any further assistance.
        Chris L.NinjaTrader Customer Service

        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-16-2018, 11:53 PM.

            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
              Chris L.NinjaTrader Customer Service

              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.
                  Chris L.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Dagamos, Today, 11:48 AM
                  1 response
                  9 views
                  0 likes
                  Last Post NinjaTrader_RyanS  
                  Started by kantkant2, Yesterday, 03:20 PM
                  4 responses
                  24 views
                  0 likes
                  Last Post eDanny
                  by eDanny
                   
                  Started by EnveousColnago, Today, 11:50 AM
                  1 response
                  6 views
                  0 likes
                  Last Post NinjaTrader_ShawnB  
                  Started by Skyfly1715, 01-20-2020, 03:36 PM
                  4 responses
                  33 views
                  1 like
                  Last Post eDanny
                  by eDanny
                   
                  Started by Cyanez, Yesterday, 05:05 PM
                  1 response
                  10 views
                  0 likes
                  Last Post NinjaTrader_PaulH  
                  Working...
                  X