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

Heikin Ashi Access

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

    Heikin Ashi Access

    Hello,

    when adding Heikin Ashi with AddHeikenAshi("ES 03-19", BarsPeriodType.Tick, 377, MarketDataType.Last); as secondary dataseries then

    Opens[1][0] Highs[1][0] Lows[1][0] and Closes[1][0] should be the OHLC close visible on the HeikinAshi bar in the chart with 377 Ticks?

    Are there maybe differences in values possible or is there any special code for access with correct values (same as plotted) for Heikin Ashi?

    Thank you!
    Tony

    #2
    Hello tonynt,

    Thanks for your post.

    If you assign the indicator to the same data series, you should expect the same OHLC values between the secondary (Added Heiken Ashi) and primary data series (Chart Heiken Ashi.) Since Heiken Ashi bars are tick based, there may be a difference in the underlying ticks when comparing to another chart.

    The AddHeikenAshi method creates a data series with the same bars as would be seen when adding the BarsType to a chart. A difference between these bars and charts would be due to difference in underlying data (I.E amount of ticks loaded, where the Heiken Ashi bars start.)

    Please let us know if you have any additional questions.
    JimNinjaTrader Customer Service

    Comment


      #3
      Hello,

      thank you for your reply. I reduced the code and made a screenshot to see all easily what its About: High, Low and Close of the green bar are OK, Open shows 2572.75, same as High. But open should be 2571.75, same as low, no?

      This is what I meant with my question if there is something specific to catch all values (here the open) in HeikinAshi correctly.

      (I made it in this sample code using additional dataseries same as primary dataseries which is HeikinAshi Tick 377.)

      Thank you!
      Tony
      Attached Files
      Last edited by tonynt; 01-14-2019, 11:37 AM. Reason: Typing error

      Comment


        #4
        Hello tonynt,

        The indicator is printing Heiken Ashi Bars based on 377 Tick Bars while the chart only has a vanilla 377 Tick Bar. Since we are comparing HeikenAshi Bars vs. Tick Bars, we can expect there to be differences in the OHLC values. Applying the NinjaScript to a 377 Tick Heiken Ashi Bar would be an apples to apples comparison for the primary and secondary series.

        Please let me know if you have any questions.
        JimNinjaTrader Customer Service

        Comment


          #5
          Hello,

          thank you for your reply. I understand the reason even when I´m not a programmer and english is not my first language., But I have no idea from this what I have to do to get the ohlc of heikinashi.

          Thank you!
          Tony

          Comment


            #6
            Hello tonynt,

            The HeikenAshi BarsType is the first secondary series added to your script, so BarsInProgress 1. Since you are printing Closes[1][0] etc, you are printing the Heiken Ashi values at the time you are referencing that Price Series.

            Please let us know if we can be of further assistance.
            JimNinjaTrader Customer Service

            Comment


              #7
              Hello,

              yes, of course. I do for 7 years with NT adding dataseries.

              The question is still how one can have the same values for calculations in the code that are shown in the chart? Should one not use the dataseries heikin ashi and use the indicator instead? Or what else?

              Thank you!
              Tony

              Comment


                #8
                Hello tonynt,

                The Heiken Ashi values from AddHeikenAshi will match that of the Heiken Ashi BarsType. The data from the added data series in your example will only match a Heiken Ashi 377 Tick chart that starts on the same tick. It will not match a standard 377 Tick Bar as these bars are different. Please see my reply in post #4 for applying the NinjaScript to a 377 Tick Heiken Ashi chart for an apples to apples comparison between the primary data series and secondary data series.

                The Heiken Ashi BarsType will round the developing values to the nearest tick size, while the Heiken Ashi indicator does not do any rounding on developing values. They will create different data sets because of this. Heiken Ashi bars are useful to quickly build a chart while the indicator will be more accurate to the study.

                Please let us know if you have any additional questions.
                JimNinjaTrader Customer Service

                Comment


                  #9
                  Hello,

                  thank you for your reply. I run a chart with dataseries heikin ashi 377 ticks and a Chart with dataseries 377 ticks and added inidicator heikin ashi. Both charts plot exactly same, Sorry, but I dont understand what you mean with differences. (I understand that it will match with added dataseries when it starts same tick!) But I do not understand what differences you mean above with "vanilla". And when working with Primary dataseries heikin ashi should then be the values open[0] and close[0] same as plotted?

                  Thank you!
                  Tony

                  Comment


                    #10
                    Hello tonynt,

                    As a BarsType, the Heiken Ashi BarsType will round developing values to the current tick size which is then re-used in the calculation for Heiken Ashi. In the indicator, Plots are not rounded, so realtime bars will not develop differently. Historical bars will also show slight differences since the indicator's values are not rounded.

                    I created a video demonstration explaining these differences further.

                    Demo - https://drive.google.com/file/d/1-hx...w?usp=drivesdk

                    I look forward to being of further assistance.
                    JimNinjaTrader Customer Service

                    Comment


                      #11
                      Hello,
                      thank you. When using dataseries 377 tick and the Code is referring to Primary dataseries then it should be the same value as plotted.
                      in the meantime I modified the code and to show simply what its about in Primary dataseries. Its a 377 tickchart and you see that the dots are not plotted in the Chart with conditions.

                      Thank you!
                      Tony
                      Attached Files
                      Last edited by tonynt; 01-17-2019, 09:05 AM.

                      Comment


                        #12
                        Hello,

                        I have to state now that I made an error. The attached Chart above is not with heikin ashi dataseries, it is Basic tick Chart with added indicator. So with heikin ashi Primary dataseries it seems that the dots are plotted correctly.

                        Thank you for your support!
                        Tony

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Gerik, Today, 09:40 AM
                        2 responses
                        6 views
                        0 likes
                        Last Post Gerik
                        by Gerik
                         
                        Started by RookieTrader, Today, 09:37 AM
                        2 responses
                        10 views
                        0 likes
                        Last Post RookieTrader  
                        Started by alifarahani, Today, 09:40 AM
                        1 response
                        7 views
                        0 likes
                        Last Post NinjaTrader_Jesse  
                        Started by KennyK, 05-29-2017, 02:02 AM
                        3 responses
                        1,285 views
                        0 likes
                        Last Post NinjaTrader_Clayton  
                        Started by AttiM, 02-14-2024, 05:20 PM
                        11 responses
                        186 views
                        0 likes
                        Last Post NinjaTrader_ChelseaB  
                        Working...
                        X