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

Getting Daily ATR on intraday strategy

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

    Getting Daily ATR on intraday strategy

    I've been stumped on this for a few hours. Ive reviewed the multi time frame
    instructions and have the following inserted in my code, but the atr value keeps thowing out '0'.

    private double atr;

    State.SetDefaults
    Calculate.OnBarClose;

    State.Configure
    AddDataSeries(BarsPeriodType.Day,1);

    OnBarUpdate()
    {
    if(BarsInProgress == 0)
    {
    if(CurrentBars[1] >14)
    atr = ATR(BarsArray[1],14)[0];
    }
    }

    Its a 15 min strategy and I've tried putting BarRequiredToTrade to 5000 but still get the '0' for the atr variable.

    #2
    Hello pmn100.

    Thank you for your post.

    Right click in your chart > select Data Series > set your DaysToLoad to larger than the 14 period plus the BarsRequiredToPlot (usually 20).

    Please let me know if you have any questions.

    Comment


      #3
      Sorry forgot to say I'm in Strategy Analyser, trying to backtest and using NinjaScript Output to print that atr variable I've set, but it just keeps giving me '0'.

      Comment


        #4
        Hello pmn100,

        Thank you for your response.

        Who are you connected to for data? Can you open a Daily chart of the instrument and add the ATR and see values?

        I look forward to your response.

        Comment


          #5
          Originally posted by NinjaTrader_PatrickH View Post
          Hello pmn100,

          Thank you for your response.

          Who are you connected to for data? Can you open a Daily chart of the instrument and add the ATR and see values?

          I look forward to your response.
          OMG I'm not connected. I'm so use to running a 15min strat offline I forgot I need access to daily data. Sorry about that and thanks for the prompt.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Kaledus, Today, 01:29 PM
          0 responses
          3 views
          0 likes
          Last Post Kaledus
          by Kaledus
           
          Started by PaulMohn, Today, 12:36 PM
          1 response
          16 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by yertle, Yesterday, 08:38 AM
          8 responses
          36 views
          0 likes
          Last Post ryjoga
          by ryjoga
           
          Started by rdtdale, Today, 01:02 PM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_LuisH  
          Started by alifarahani, Today, 09:40 AM
          3 responses
          18 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X