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

AddDataSeries not generating the same value

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

    AddDataSeries not generating the same value

    Hi,

    I am trying to get ATR 14 day value in an indicator. However, when the indicator is loaded in a lower time frame chart, i.e. hour or minute. the ATR daily value is different from I get in a daily time frame chart.

    the way I'm getting the ATR 14 day value is

    Code:
    else if (State == State.Configure)
    			{
    				AddDataSeries(Data.BarsPeriodType.Day, 1);
    			}
    			else if (State == State.DataLoaded)
    			{
    				atrDaily = ATR(BarsArray[1], 14);
    			}
    Please see a screenshot and a example indicator attached. a picture is worth a thousand words

    I couldn't figure out what am I doing wrong.

    Thank you very much for your help.
    Attached Files

    #2
    Hello,

    Thank you for your note.

    I wrote an indicator which correctly displays the same value on a minute and daily chart.

    Do you see the same behavior with the attached indicator?

    I look forward to your reply.
    Attached Files
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Hi Alan,

      Thanks for the quick reply.

      I took the example you provided then realized that I didn't have enough bars loaded to correctly calculate the 14 day ATR.

      I think it would be super helpful if this is mentioned in the documentation, or maybe I just missed it.

      I tried out your indicator and still not getting the exact same value, please see the screenshot attached.

      The indicator I loaded in the chart on top, set one to on bar close and another one on price change.

      Is this the expected behaviour or am I missing something?

      Thanks
      Attached Files

      Comment


        #4
        Hello lkuo.me,

        If the indicator did not have enough bars you would see the error on the log tab. I will pass on your suggestion about needing an amount of bars > your ATR period.

        If you set both indicators to calculate OnPriceChange, the weekly as well as the 1 minute, the numbers should match.

        Please let us know if you need further assistance.
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          I tried it out and it works perfectly.

          Thank you for your help!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by aussugardefender, Today, 01:07 AM
          0 responses
          1 view
          0 likes
          Last Post aussugardefender  
          Started by pvincent, 06-23-2022, 12:53 PM
          14 responses
          238 views
          0 likes
          Last Post Nyman
          by Nyman
           
          Started by TraderG23, 12-08-2023, 07:56 AM
          9 responses
          383 views
          1 like
          Last Post Gavini
          by Gavini
           
          Started by oviejo, Today, 12:28 AM
          0 responses
          1 view
          0 likes
          Last Post oviejo
          by oviejo
           
          Started by pechtri, 06-22-2023, 02:31 AM
          10 responses
          125 views
          0 likes
          Last Post Leeroy_Jenkins  
          Working...
          X