Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Session Break Line Issue

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

    Session Break Line Issue

    Hello

    My automated strategy checks whether a certain condition is valid 10 bars ago. This works well as long as 10 bars ago is within the same session, but it doesn't work anymore if 10 bars ago is still on the prior session, ie to the left of the session break line.

    What can I do to correct this?

    Thanks

    #2
    laocoon, do you have perhaps a snippet how you check for this 10 bars ago signals? As via the usual bar index notation myValueSeries[x bars back] I would expect it to count across session breaks, as those would not reset your current bar index used in any way.

    Comment


      #3
      Thanks for your reply Bertrand.
      I'm checking the Slope of the 200 period Simple Moving Average 10 bars ago with the following snippet:

      Slope(SMA(200), 20, 10) >0

      Thanks

      Comment


        #4
        laocoon, how do you determine the snippet you shared would be producing the issue of not seeing the desired entry then at point x?

        The bars ago used in the Slope call would be evaluated across session breaks as well - just the same continuous CurrentBars index used.

        Comment


          #5
          Thanks for your reply Bertrand.
          I know that the snippet is producing the error because when I remove it, the entry signal appears (and the SMA condition is clearly true).

          What's really strange is that I found out in the meantime that the signal is working on all markets with the Default 24/7 Session Template, but not on the FDAX (with the Eurex Equity Index Futures template).

          Comment


            #6
            I would then suggest making an indicator for the slope actually so you can visually inspect what exact state it would have as you expect to see your signal.

            Comment


              #7
              I have an indicator for the Slope and it clearly shows that the condition is true.
              I guess I'm in a bit of a dead-end here (especially because it works in all markets except the FDAX).

              Comment


                #8
                There would then unfortunately no way around to debug and better understand exactly they the condition would not trigger as you would intuitively expect in this case, is the Slope perhaps very close to 0 and therefore visually you think it's true while in fact with enough precision it would not be?

                Comment


                  #9
                  Bertrand,

                  I isolated the issue and it turns out that the Session Break Line isn't the culprit here.
                  The real problem is the slope of the Moving Average: as long as I'm working with the slope of a MA of the CURRENT bar, the following code snippet works perfectly:

                  if (Slope(SMA(10), 10, 0) >5)
                  {
                  do something
                  }

                  But as soon as I want to incroporate an MA Slope of a prior bar, let's say 5 bars ago, the results become random. This snippet

                  if (Slope(SMA(10), 10, 5) >5)
                  {
                  do something
                  }

                  should work all the time, but unfortunately that's not the case. Is there another way to address the MA Slope of a prior bar ?

                  Thanks

                  Comment


                    #10
                    Well, that's a different slope you work with then, as it would only span 5 bars and not 10 as in your first call. I would record your first slope into a double DataSeries and then you would be able to access this slope value [x] bars ago by working off the stored series history.

                    Comment


                      #11
                      Thanks for your reply Bertrand. I used a different example in my last post just to better illustrate my point.
                      In my code, I'm only using one single MA and I'm looking to compare its current value with its value 10 bars ago. Do I still need to record the slope into a double DataSeries or can't I just work with it like in my most recent example?

                      Thanks

                      Comment


                        #12
                        Yes on the dataseries as you want to access the slope value of x bars ago, otherwise you would compare a slope over 10 bars with a slope over 5 bars which would introduce the variation you had seen.

                        Comment


                          #13
                          Bertrand,

                          Sorry for raising the issue again, but I'm slightly confused now.
                          Forget everything I wrote earlier in the thread.
                          The only thing I want to do is to access the slope value of a Moving Average 10 bars ago and check whether that value is bigger than let's say, 10.

                          Why do I need a data series for that?

                          Thanks again and sorry for the confusion.

                          Comment


                            #14
                            No worries, you would need a series as the Slope would not offer a series return but just a double value - thus you cannot go Slope(xxx)[10], so accessing the slope 10 bars ago.

                            This would be for example in contrast to the Linear Regression Slope, which would have a series access - http://www.ninjatrader.com/support/h...lightsub=slope

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                            0 responses
                            607 views
                            0 likes
                            Last Post Geovanny Suaza  
                            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                            0 responses
                            353 views
                            1 like
                            Last Post Geovanny Suaza  
                            Started by Mindset, 02-09-2026, 11:44 AM
                            0 responses
                            105 views
                            0 likes
                            Last Post Mindset
                            by Mindset
                             
                            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                            0 responses
                            560 views
                            1 like
                            Last Post Geovanny Suaza  
                            Started by RFrosty, 01-28-2026, 06:49 PM
                            0 responses
                            561 views
                            1 like
                            Last Post RFrosty
                            by RFrosty
                             
                            Working...
                            X