Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Calculating High / Low / Average from prior days?

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

    Calculating High / Low / Average from prior days?


    Hi there,

    It's not clear to me how I can calculate prior days or weeks highs, lows, and averages? While I know I can look into the Bars array, if I'm working on a 5 minute chart, it seems like I'm calculating and looking back a lot of bars. Plus, I would need to leave out the after-marketing activity. Any suggestions?

    Thanks.






    #2
    Hello timmbbo,

    Thanks for your post.

    This would be done most easily by adding a daily/weekly data series to the script. You can use an SMA on these series to determine an average of the Close series for X number of bars and you could also use any of the Price Series objects that are available.

    If you specifically need an RTH bar which excludes ETH trades, you could create a 1440 minute series and create the series with an RTH Trading Hours template. I.E. "CME US Index Futures RTH"

    The following AddDataSeries overloads can be used to specify a Trading Hours template with the data series you are adding.

    AddDataSeries(string instrumentName, BarsPeriod barsPeriod, string tradingHoursName)
    AddDataSeries(string instrumentName, BarsPeriod barsPeriod, string tradingHoursName, bool? isResetOnNewTradingDay)
    AddDataSeries(string instrumentName, BarsPeriod barsPeriod, int barsToLoad, string tradingHoursName, bool? isResetOnNewTradingDay)


    Multi Time Frame and Instruments - https://ninjatrader.com/support/help...nstruments.htm

    AddDataSeries - https://ninjatrader.com/support/help...dataseries.htm

    Price Series objects - https://ninjatrader.com/support/help...riceseries.htm

    We look forward to assisting.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    52 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    29 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    194 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    355 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    274 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X