Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Resetting the Swing High/Low Indicator on New Session

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

    #16
    I just changed to CalculateOnBarClose = true and it now lists the latest SwingHigh SwingLow values as the current values.

    Why would this drastically affect the indicator?

    Comment


      #17
      We've been saying many times in this thread that this is what you will expect when using Swing. If you understand its caveats, then you may be able to get a useful value. If not, you may want to consider looking only at indicators with a historical lookback.
      Ryan M.NinjaTrader Customer Service

      Comment


        #18
        Originally posted by NinjaTrader_RyanM View Post
        We've been saying many times in this thread that this is what you will expect when using Swing. If you understand its caveats, then you may be able to get a useful value. If not, you may want to consider looking only at indicators with a historical lookback.
        Sorry Ryan but you havent answered my question.

        How would the value be stuck on the first swing from 5 hours ago and then instantly jump to the last one (correct one) when the only difference is CalculateOnBarClose = false is changed to true. According to the chart there were 8 other swing high/lows in between the two. It simple makes no sense.

        As a paying customer I expect to be able to understand the mechanics of the system. Nothing you have said in this thread would explain the behaviour I have just described. Could you ellobrate what you mean please?

        Thanks

        Comment


          #19
          MJUK10,

          Please open up the source code for the Swing indicator in Tools>Edit NinjaScript>Indicators. From there you will be able to see exactly what the Swing indicator does. The Swing indicator just happens to be one of those indicators which changes its historical values. What you see on the 9:00AM bars when the time is 10:00AM in terms of the swings being plotted on the chart are almost guaranteed to not be what you would have seen when the time was 9:00AM. The indicator recalculates itself and changes its values as new data is received. This is just the inherent nature of the Swing indicator. You can see this happening on lines 109, 122, 150, and 163 in the code.

          Unfortunately there is no other way we can explain this. The indicator checks new data, that new data determines new values for the indicator, those new values could drastically change the historical and present outlook of the Swings you see on the chart. Just because you see so-and-so swing high/low at 10:00AM, does not mean you will see the same at 10:01AM.

          CalculateOnBarClose = false drastically impacts swings as you are constantly grabbing new and different values which can potentially alter the whole Swing indicator profile from tick to tick.
          Josh P.NinjaTrader Customer Service

          Comment


            #20
            Originally posted by NinjaTrader_Josh View Post
            MJUK10,

            Please open up the source code for the Swing indicator in Tools>Edit NinjaScript>Indicators. From there you will be able to see exactly what the Swing indicator does. The Swing indicator just happens to be one of those indicators which changes its historical values. What you see on the 9:00AM bars when the time is 10:00AM in terms of the swings being plotted on the chart are almost guaranteed to not be what you would have seen when the time was 9:00AM. The indicator recalculates itself and changes its values as new data is received. This is just the inherent nature of the Swing indicator. You can see this happening on lines 109, 122, 150, and 163 in the code.

            Unfortunately there is no other way we can explain this. The indicator checks new data, that new data determines new values for the indicator, those new values could drastically change the historical and present outlook of the Swings you see on the chart. Just because you see so-and-so swing high/low at 10:00AM, does not mean you will see the same at 10:01AM.

            CalculateOnBarClose = false drastically impacts swings as you are constantly grabbing new and different values which can potentially alter the whole Swing indicator profile from tick to tick.
            I'm not talking about a couple of bars difference, I'm talking about jumping from the start of the session to the end of the session on a 1-minute interday bar chart.

            Comment


              #21
              MJUK10,

              That is the nature of the indicator. It can look drastically different from 1 minute to the next or from beginning of session to end of session and as such any use of it in trying to make scripts that rely on it needs to take this inherent behavior of it into account.

              It is because of this constant updating of historical indicator values that makes the indicator look so "pretty". Everything I've said might make a lot more sense if you download a Market Replay file, throw the indicator onto a chart, run it on 500x and just watch how the indicator behaves and compare values of it at different points in time along the replay. Check it out at the first hour of the replay, than again 30 mins later, than an hour later, etc. It is this nature that makes it incredibly hard to try and program something for real-time use with it. You would need to come up with your own idea of what you may find as a useful trading edge based on this behavior if you want to use this indicator. Unfortunately that is not something we will be able to provide.
              Josh P.NinjaTrader Customer Service

              Comment


                #22
                Originally posted by NinjaTrader_Josh View Post
                MJUK10,

                That is the nature of the indicator. It can look drastically different from 1 minute to the next or from beginning of session to end of session and as such any use of it in trying to make scripts that rely on it needs to take this inherent behavior of it into account.

                It is because of this constant updating of historical indicator values that makes the indicator look so "pretty". Everything I've said might make a lot more sense if you download a Market Replay file, throw the indicator onto a chart, run it on 500x and just watch how the indicator behaves and compare values of it at different points in time along the replay. Check it out at the first hour of the replay, than again 30 mins later, than an hour later, etc. It is this nature that makes it incredibly hard to try and program something for real-time use with it. You would need to come up with your own idea of what you may find as a useful trading edge based on this behavior if you want to use this indicator. Unfortunately that is not something we will be able to provide.
                Josh

                I must not be explaining myself clearly enough. I understand the indicator would give different values than when back tested and different to what is shown on the chart. What happened yesturday though is different.

                The chart was showing about 10 swing high and lows throughout the course of the day. I started to print the swing high/low values at about 1 hour before the close in the output window. At this time the swing high/low values stored in the program were the same values as the first swing high/low lines shown on the chart, which were over 5 hours old and the priced had crossed several times. This conitnued for about half an hour until they changed to the second swing high/low lines (still 4 hours old). I then changed to CalculateOnBarClose = true and they instantly jumped to the last swing high/low values as shown on the chart and it was working as it was designed to do.

                I did want to trade live though with CalculateOnBarClose = false, which obviously I can't if the indicator does not work property when COBC = false. I just don't understand why running the code on each tick would cause the swing/high/low to bi-pass 10 swing points and return to the first one of the session ignoring all the subsequent swing lows and highs and then changing COBC = true corrects it.

                Comment


                  #23
                  MJUK10,

                  How are you determining something is being "bypassed"? What is being printed out are just the swing values as calculated at the exact point in time of printing. Those values can't be compare to Swing values versus what you are seeing on the chart a few hours later. The only point in time those printed values are applicable is when you compare the current bar's printout versus the current bar's chart look. What I suggest is try adding some DrawDiamond()s into your code so you can watch them accrue and change values as time comes and goes. That would be the only way where you can "see" old Swing values which would be relevant for you to compare against.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #24
                    Originally posted by NinjaTrader_Josh View Post
                    MJUK10,

                    How are you determining something is being "bypassed"? What is being printed out are just the swing values as calculated at the exact point in time of printing. Those values can't be compare to Swing values versus what you are seeing on the chart a few hours later. The only point in time those printed values are applicable is when you compare the current bar's printout versus the current bar's chart look. What I suggest is try adding some DrawDiamond()s into your code so you can watch them accrue and change values as time comes and goes. That would be the only way where you can "see" old Swing values which would be relevant for you to compare against.
                    What I mean is looking at a complete session (say 6 hours) on a 1 minute chart, there are numoruous swing high and lows throughout the day identified by the normal indicator lines. the current swing high/low values at the end of the session (as printed in the output window) was displaying the swing high low figures from the first high/low point on the chart even though price was no longer any where near them and was infact much below the swing low value.

                    I ran it live using COBC = true yesturday and it worked exactly as it is supposed to all day and corroponded with the chart exactly as well.

                    So I'm just running my strategy with COBC = true which is not exactly what i wanted but it doesn't matter too much and i'm not going to make any more problems for myself.

                    I think the indicator might be buggy though, so you might want to get your programers to take a look at its behaviour on COBC = true/false on interday charts.

                    Comment

                    Latest Posts

                    Collapse

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