Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

When are indicators updated?

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

    When are indicators updated?

    In a multi-instrument strategy working with real time tick data,

    Initialize()
    CalculateOnBarClose = false

    OnBarUpdate()
    {
    if (FirstTickOfBar)
    {
    if(BarsInProgress == 0)
    RSI(BarsArray[0], 14, 1)[0]; //Is this indicator in updated state?
    }
    }

    Is it guaranteed that the indicator is in an updated state when the strategy reads the current value [0]?

    If not, how can it be assured that it is?

    It is not clear when indicators are updated in relation to the FirstTickOfBar becoming true and the strategy execution.

    #2
    Hello Camdo,

    Yes, plots will be updated. The exact alignment of multiple bar objects depends on which two series you're using and if accessing on historical or real time data. It helps to print the time stamps of all series so you can check this.

    if (BarsInProgress == 0 && FirstTickOfBar)
    Print("Primary Series Time Stamp: " + Time[0] + " Secondary Time Stamp: " + Times[1][0]);
    Ryan M.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    59 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    143 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    161 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    97 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    276 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X