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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    87 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    132 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    65 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    118 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    67 views
    0 likes
    Last Post PaulMohn  
    Working...
    X