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 NullPointStrategies, Today, 05:17 AM
    0 responses
    44 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    124 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    65 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    42 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X