Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

multi time frame

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

    multi time frame

    Hello. I'm running a strat on a single instrument where I'm working with daily and minute bars. I have reviewed the educational resource page related to multi-timeframe, but stil have a few things to clarify.

    My primary series is 5min data, and my second series is daily.

    1) Suppose I'm calculating OnBarClose. Am I correct that if I reference Closes[1][0], it will always be the Close from the previous day (because the current day bar hasn't finished calculating yet)?

    2) Suppose now I'm calculating OnPriceChange. Will Closes[1][0] now equal Closes[0][0] or does it still refer to the prior day close?


    3) Is there a way to have the daily bar recalculate only when the primary bar recalculates? It seems to me it will be computationally inefficient to calculate on each price change or each tick when I really only want to return a value on an indicator on the daily series corresponding to the latest value on the primary.

    4) In particular, if I'm running an RSI on the daily bar, if I set calculation to OnPriceChange, will that RSI incorporate the current (intraday) price for the last point in the series, or will it only calculate based on the previous days' closing prices?

    Sorry, lots of questions there but I hope they make sense.

    #2
    Hello stewarco,

    Thanks for your post.

    1) Yes, you are correct.

    2) Yes, you are correct however this would only apply when State == State.Realtime.

    3) It is not so much the Daily bar updating as it is what you are doing with it. If you segment your coding by using if (BarsInProgress != 0) return; then your ninjascript code would not be run until the primary bar updates. You can still access the daily bar data by specifying the barsArray for the daily bar. For example: if (RSI(BarsArray[1], 14).Avg > 0) or alternatively if (RSI(Closes[1], 14).Avg > 0)

    4) When state == state.realtime, with OnPriceChange, the RSI on the daily bar would update using the current value of the daily bar.

    Comment


      #3
      thanks

      thanks this makes sense.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      45 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      21 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      31 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      50 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      42 views
      0 likes
      Last Post CarlTrading  
      Working...
      X