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, 03-31-2026, 09:41 PM
    1 response
    43 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    20 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    30 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    47 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    38 views
    0 likes
    Last Post CarlTrading  
    Working...
    X