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 inanazsocial, Today, 01:15 AM
          0 responses
          1 view
          0 likes
          Last Post inanazsocial  
          Started by trilliantrader, 04-18-2024, 08:16 AM
          5 responses
          22 views
          0 likes
          Last Post trilliantrader  
          Started by Davidtowleii, Today, 12:15 AM
          0 responses
          3 views
          0 likes
          Last Post Davidtowleii  
          Started by guillembm, Yesterday, 11:25 AM
          2 responses
          9 views
          0 likes
          Last Post guillembm  
          Started by junkone, 04-21-2024, 07:17 AM
          9 responses
          70 views
          0 likes
          Last Post jeronymite  
          Working...
          X