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