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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    149 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    84 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    129 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    125 views
    1 like
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    102 views
    0 likes
    Last Post CarlTrading  
    Working...
    X