Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by frankthearm, Today, 09:08 AM
    10 responses
    35 views
    0 likes
    Last Post frankthearm  
    Started by GwFutures1988, Today, 02:48 PM
    0 responses
    2 views
    0 likes
    Last Post GwFutures1988  
    Started by mmenigma, Today, 02:22 PM
    1 response
    3 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by NRITV, Today, 01:15 PM
    2 responses
    9 views
    0 likes
    Last Post NRITV
    by NRITV
     
    Started by maybeimnotrader, Yesterday, 05:46 PM
    5 responses
    28 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Working...
    X