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 cre8able, Today, 01:01 PM
          1 response
          4 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by manitshah915, Today, 12:59 PM
          1 response
          3 views
          0 likes
          Last Post NinjaTrader_Erick  
          Started by ursavent, Today, 12:54 PM
          1 response
          4 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by Mizzouman1, Today, 07:35 AM
          3 responses
          17 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by RubenCazorla, Today, 09:07 AM
          2 responses
          13 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X