Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exit on different bar series

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

    Exit on different bar series

    Hi,

    I'm trying to get my strategy to exit on a different bar series but even though it seems to enter on multiple bar series, it will not exit on multiple bar series. Am I missing something?

    I have these in Initialize()
    Add(PeriodType.Minute, 10);
    Add(PeriodType.Minute, 5);
    Add(PeriodType.Minute, 1);

    But even though I have this for exit conditions....

    if (
    (Highs[0][0] < Highs[0][1] && Highs[0][1]-Highs[0][0] > (4*TickSize))
    || (Highs[1][0] < Highs[1][1] && Highs[1][1]-Highs[1][0] > (4*TickSize))
    || (Highs[2][0] < Highs[2][1] && Highs[2][1]-Highs[2][0] > (6*TickSize))
    )

    {
    ExitLong(3, 2, "ExitLockedLong", "LockedLong");
    ExitLong(3, 1, "ExitLong", "Long");
    }

    //NOTE "LockedLong" is the name of the first of my 2 entries and "Long" is the other

    In this case, what I'm trying to get to occur is if 10 or 5 minute bar highs gap lower by more than 4 or 6 ticks, respectively, get out earlier. However, it's only getting out on the open of the next 20 min bar (my primary bar series)

    #2
    albazzaztariq, in which series / BarsInProgress context do you check for the condition and issue the relevant order?

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      albazzaztariq, in which series / BarsInProgress context do you check for the condition and issue the relevant order?
      I have it issue the order in the 3rd index, the 1 min bar index. That's why I threw it 4 parameters on ExitLong(), and as you can see, my first parameter is "3", referring to the 3rd index, the 1 minute index as per what I said I put in Initialize()

      Thanks,

      Tariq

      Comment


        #4
        Originally posted by albazzaztariq View Post
        I have it issue the order in the 3rd index, the 1 min bar index. That's why I threw it 4 parameters on ExitLong(), and as you can see, my first parameter is "3", referring to the 3rd index, the 1 minute index as per what I said I put in Initialize()

        Thanks,

        Tariq
        Am I supposed to have put BarsInProgress in here as well? Is that what I'm missing? I believe I tried that last night to no avail

        Comment


          #5
          Hello albazzaztariq,

          I believe Bertrand was asking during which bars in progress are you checking this condition?

          For example, to check a condition on the 4rd added data series you would have an if statement that allows processing on BarsInProgress 3. (BarsInProgress is 0 based).

          Code:
          [B]if (BarsInProgress == 3)
          {[/B]
          if (
          (Highs[0][0] < Highs[0][1] && Highs[0][1]-Highs[0][0] > (4*TickSize))
          || (Highs[1][0] < Highs[1][1] && Highs[1][1]-Highs[1][0] > (4*TickSize))
          || (Highs[2][0] < Highs[2][1] && Highs[2][1]-Highs[2][0] > (6*TickSize))
          )
          
          {
          ExitLong(3, 2, "ExitLockedLong", "LockedLong");
          ExitLong(3, 1, "ExitLong", "Long");
          }
          [B]}[/B]
          Do you have any logic like this, or are you checking this on every data series as it processes?

          I ask because if the is allowed to evaluate on any data series, the first data series to process will be the data series that triggers the exit.

          Below is a link to the help guide on BarsInProgress.
          http://www.ninjatrader.com/support/h...inprogress.htm
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            That's all I needed. Thanks

            Comment


              #7
              I've been getting some weird profit increases so I'm just curious that by using the Bollinger band property here, I'm saying if the lows of the current bar in the 3rd index are lower than the bollinger band on the 3rd index series chart


              if (BarsInProgress==2) {
              if (
              (BarsSinceExit(0,"",0) == -1 || BarsSinceExit(0,"",0) > 0)
              &&
              (Lows[2][0]<Bollinger(2,20).Lower[0])
              )
              {
              ExitLong(2, 2, "ExitLockedLong", "LockedLong");
              ExitLong(2, 1, "ExitLong", "Long");
              }
              }

              Comment


                #8
                Originally posted by albazzaztariq View Post
                I've been getting some weird profit increases so I'm just curious that by using the Bollinger band property here, I'm saying if the lows of the current bar in the 3rd index are lower than the bollinger band on the 3rd index series chart


                if (BarsInProgress==2) {
                if (
                (BarsSinceExit(0,"",0) == -1 || BarsSinceExit(0,"",0) > 0)
                &&
                (Lows[2][0]<Bollinger(2,20).Lower[0])
                )
                {
                ExitLong(2, 2, "ExitLockedLong", "LockedLong");
                ExitLong(2, 1, "ExitLong", "Long");
                }
                }
                Basically I'm asking if Lows[2][0] < Bollinger(2,20).Lower[0] without a 2nd dimension reference on Bollinger will actually reference the 3rd bar/time series

                Comment


                  #9
                  Hi albazzaztariq,

                  Yes, the Bollinger bands will be using Input by default. When BarsInProgress is 2, Input will be the same as Inputs[2], this means that the Bollinger bands will be using the 3rd added data series with the BarsInProgress index of 2.
                  Chelsea B.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  656 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  371 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  109 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  574 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  579 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X