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

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.
    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:


        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-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
              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 DJ888, 04-16-2024, 06:09 PM
                  4 responses
                  12 views
                  0 likes
                  Last Post DJ888
                  by DJ888
                   
                  Started by terofs, Today, 04:18 PM
                  0 responses
                  11 views
                  0 likes
                  Last Post terofs
                  by terofs
                   
                  Started by nandhumca, Today, 03:41 PM
                  0 responses
                  7 views
                  0 likes
                  Last Post nandhumca  
                  Started by The_Sec, Today, 03:37 PM
                  0 responses
                  3 views
                  0 likes
                  Last Post The_Sec
                  by The_Sec
                   
                  Started by GwFutures1988, Today, 02:48 PM
                  1 response
                  9 views
                  0 likes
                  Last Post NinjaTrader_Clayton  
                  Working...
                  X