• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bars.GetDayBar on Multi Time Frame

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

    Bars.GetDayBar on Multi Time Frame

    E.g. I have added several intraday data series to my script using Add("ticker", PeriodType.Minute, 1). I want a reliable and efficient method to find yesterdays close for all of them, e.g. like Bars.GetDayBar.Close or something. Any ideas?

    For consistency, I would like to avoid adding a Daily series for each of my instruments: The close will be different on the daily to the intraday data.

    I'm getting inconsistent results using things like the following, as the instruments can have different timings etc:

    if (BarsInProgress == 0 && Bars.FirstBarOfSession && FirstTickOfBar)
    {
    timeOfInterest = new DateTime(Time[0].Year, Time[0].Month, Time[0].Day);
    }

    openBar = GetBar(timeOfInterest);
    Closes[x][openBar] //Gives inconsistent result!

    #2
    Hello Antimatter,

    There is PriorDayOHLC() for this.

    http://www.ninjatrader.com/support/h...r_day_ohlc.htm

    You can pass in the BarsArray for the specific series you want for this.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      That's great thanks.

      Now I'm struggling to find a realiable way to get the TodaysOpen for each instrument in my list...?! Same problem as before.

      Comment


        #4
        You can use CurrentDayOHL()
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          GetDayBar()

          A strategy works on a five minute chart with this line causing it not to fire:

          && CurrentDayOHL().CurrentOpen[0] < Bars.GetDayBar(2).Low

          Adding this to initialize helped...

          Add("ES 06-12", PeriodType.Day, 20);

          But the strategy still does not plot the execution on the graph. Any ideas why that might be?

          Also I could not find a monthly and weekly OHLC that plots on the current session. Any ideas about that?

          Regards and thx
          Last edited by elliot5; 04-23-2012, 02:06 AM. Reason: extra information

          Comment


            #6
            Hi everington_f,

            For weekly and monthly series these must be added to the script to initialize. There are not built in methods that calculate these from intraday data like the CurrentDay, PriorDay, GetDayBar do for daily bars.

            To find out why your script is not entering as you expect, debug it by checking values used in entry conditions. Help for debugging your NinjaScript is available here:
            http://www.ninjatrader.com/support/f...ead.php?t=3418
            Ryan M.NinjaTrader Customer Service

            Comment


              #7
              OK Thanks. I was kind of hoping that someone out there had an indicator the the previous month and week OHLC. Thanks for your input.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by aslane, Today, 02:31 PM
              1 response
              8 views
              0 likes
              Last Post NinjaTrader_Kate  
              Started by stoner, 10-16-2019, 01:38 PM
              5 responses
              51 views
              0 likes
              Last Post sledge
              by sledge
               
              Started by music_p13, Today, 12:04 PM
              1 response
              24 views
              0 likes
              Last Post NinjaTrader_Kate  
              Started by zaro33, Today, 10:55 AM
              1 response
              7 views
              0 likes
              Last Post NinjaTrader_Heath  
              Started by itrader46, Today, 10:16 AM
              5 responses
              11 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Working...
              X