Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Range command in multiple time frames

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

    Range command in multiple time frames

    The example from the help file is great in a single time frame, but what's the syntax for getting the range in a multiple time frame strategy?

    Help file says:
    // Prints the 20 period simple moving average of range
    double value = SMA(Range(), 20)[0];
    Print("The 20 period average of range is " + value.ToString());


    But what happens if you have 2 time frames and you want it to be in your primary? Where does the "0" go to tell it that you want the 20 period SMA for the range for the primary time period?

    Many thanks in advance,

    #2
    Another question

    I found an old strategy that I wrote with:

    ATR(Closes[0], 14)[0]

    Which was being used, to the best of my knowledge, to calculate the ATR for the past 14 days. I understand that it needs a IDataSeries inputData, but doesn't the ATR calculation need closes, highs and lows?

    If so, is what I have even calculating corretly?

    Thanks again,

    Comment


      #3
      8DTK8, please continue working with Closes[0] (which is actually a DataSeries that contains the closes of all instruments associated with a strategy) and Range like you have in the second post:
      Code:
      // for a 20 period sma of the range of the primary bars
      SMA(Range(Closes[0]), 20)[0];
      AustinNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      649 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      370 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      109 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      574 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      576 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X