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 NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      62 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      134 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      75 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      45 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      50 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X