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

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 ZeroKuhl, Today, 04:31 PM
      0 responses
      14 views
      0 likes
      Last Post ZeroKuhl  
      Started by Vulgoth_t_Destroyer, 05-09-2022, 04:45 PM
      54 responses
      5,337 views
      0 likes
      Last Post Gaterz
      by Gaterz
       
      Started by ETFVoyageur, 05-07-2024, 07:05 PM
      11 responses
      76 views
      0 likes
      Last Post -=Edge=-  
      Started by _Zero_, 04-10-2020, 03:21 PM
      145 responses
      7,901 views
      6 likes
      Last Post johng2
      by johng2
       
      Started by TheTradingMantis, 01-19-2023, 02:05 AM
      43 responses
      923 views
      0 likes
      Last Post jmagaia
      by jmagaia
       
      Working...
      X