Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

SMA of an Indicator at Certain Times

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

    SMA of an Indicator at Certain Times

    Dear Support,

    In NT7, can the value of an indicator (5-min chart) at a certain time during the past n days be programmed?

    Example: I want to calculate the average value of the RSI(14) at 10:00 AM over the past 10 days on a 5-minute chart.

    SMA = Sum (RSI(14) [Date0,Time 10:00] + RSI(14) [Date1, Time 10:00]

    +RSI(14) [Date2, Time 10:00) +......+ RSI(14) [Date 9, Time 10:00]) / 10

    What would be the simple statement in NT7 to calculate the above SMA?

    Thanks.

    #2
    Hello aligator,

    Thank you for writing in.

    You can use the GetBar() method call to obtain the bar index that matches the time stamp based on the DateTime parameter passed in. With this information, you can calculate the barsAgo value of the bar you wish to get your indicator values at: http://ninjatrader.com/support/helpG...t7/?getbar.htm

    Example:
    Code:
    // obtain the barsAgo value of the 10 AM bar for May 11th, 2016
    int barsAgo = CurrentBar - Bars.GetBar(new DateTime(2016, 5, 11, 10, 0, 0));
    Using this method call, you will be able to obtain the barsAgo values for the dates and times desired and use this value to get the indicator value for that specific bar.

    Please, let us know if we may be of further assistance.
    Zachary G.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    571 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    331 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    549 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    550 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X