• 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

Find the high and low of fifteen minute bar in a 1 minute chart

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

    Find the high and low of fifteen minute bar in a 1 minute chart

    Hey NinjaTrader team,

    I am trying to build a strategy that finds the high and low from a fifteen minute period and then takes a trade if the current 1 minute bar closes above that high. How would I use a 1 minute dataseries but get the high and low from the fifteen minute bar?

    #2
    Hello Jonathan.Lee,

    If you specifically wanted to know the High/Low of the last 15 minute bar you can add a secondary series and then access the High and Low of the last bar:
    https://ninjatrader.com/support/help...ghtsub=adddata

    If you wanted to know the High/Low of the last 15 1 minute bars you could use the Highest and LowestBar methods:

    https://ninjatrader.com/support/help...sub=highestbar
    https://ninjatrader.com/support/help...tsub=lowestbar

    instead of using the BarsSinceNewTradingDay in the sample you could use 15 or the last 15 bars.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Awesome that worked. I have one more question:

      After finding the high and low of the last fifteen minute bar I would like to limit my limit order to a time frame of 12 minute after the close of the last fifteen minute bar. How could I do that?

      Comment


        #4
        Hello Jonathan.Lee,

        That would likely be easiest by adding a secondary series of 15 minutes to control resetting a variable. Because there is not a specific 15 minute bar with a 1 minute series you could add another series to reset a variable.

        Your minute series can use a integer to count 12 minute bars and start doing the action once you reach that point. The 15 minute series could be used to reset it.

        https://ninjatrader.com/support/help...ghtsub=adddata
        https://ninjatrader.com/support/help...lightsub=multi


        A very simplistic example would be like the following:

        Code:
        private int counter;
        protected override void OnBarUpdate()
        {
           if(BarsInProgress == 0)  //assuming this is on the 15 minute primary
           {
            counter = 0;
           }
        
           if(BarsInProgress == 1)  //assuming this is on the 1 minute secondary
           {
               if(counter >= 12)
               {
        
               }
               counter++;
            }
        }
        This increments the counter for each 1 minute bar and then resets it for each 15 minute bar.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          I have this bit of code trying to get the high and low of the last fifteen minute bar, but it seems to give me info from the current bar. How do I get the high and low from the last bar that closed and not the current bar that is open?


          if (BarsInProgress == 1)
          {
          fifteenMinuteHigh = MAX(High, 1)[0];
          Print("Fifteen Minute High is " + fifteenMinuteHigh + " " + Time[0].ToString());
          fifteenMinuteLow = MIN(Low, 1)[0];
          Print("Fifteen Minute Low is " + fifteenMinuteLow + " " + Time[0].ToString());


          }

          Comment


            #6
            Hello Jonathan.Lee,

            If we are still going by the order from my last post and this is the 1 minute series you can use Highs[0][0] and Lows[0][0] to get the High and Low price of the last 15 minute bar.

            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by bosajin, Yesterday, 05:37 PM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by brunoviveiros, 08-04-2020, 09:36 AM
            3 responses
            36 views
            0 likes
            Last Post ATMtrader0001  
            Started by DieSlower, Yesterday, 09:46 PM
            1 response
            17 views
            0 likes
            Last Post NinjaTrader_PaulH  
            Started by orenytz, Today, 06:10 AM
            0 responses
            3 views
            0 likes
            Last Post orenytz
            by orenytz
             
            Started by ATMtrader0001, Today, 05:05 AM
            0 responses
            4 views
            0 likes
            Last Post ATMtrader0001  
            Working...
            X