Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Indicator Delay in Strategy

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

    Indicator Delay in Strategy

    Hi all,

    I'm new to NinjaTrader and trying to implement a strategy that's based on the Swing indicator. But I notice the indicator doesn't behave as I expect.

    Suppose the Strength parameter of Swing is set to 5, then a support is confirmed when the 5th bar is finished if other criteria fulfill. I.e., a support is formed with a minimum delay of 5 bars. But I observed in the strategy, it needs 2 x Strength bars (including the support bar itself, and in this case 10 bars) to confirm.

    Anyone ever noticed similar issues?
    Last edited by shliang; 10-06-2007, 05:42 AM.

    #2
    BTW, if I move the historical chart from left to right incrementally, the support is drawn when the 5th bar closes (not including the support bar). -- This is what I expect since no matter how the price evolves, the support won't change afterwards.
    Last edited by shliang; 10-06-2007, 05:41 AM.

    Comment


      #3
      Are you saying that:

      Swing(5).SwingHighBar(0, 1, CurrentBar)

      would return a value of 10 once the last swing high is confirmed?
      RayNinjaTrader Customer Service

      Comment


        #4
        Exactly, Ray!

        I haven't even noticed this. Seems I'm really very new, heh

        Swing(x).SwingHighBar(0,1,CurrentBar) & Swing(x).SwingLowBar(0,1,CurrentBar) should always return x at the bar when support / resistance is confirmed.

        Originally posted by NinjaTrader_Ray View Post
        Are you saying that:

        Swing(5).SwingHighBar(0, 1, CurrentBar)

        would return a value of 10 once the last swing high is confirmed?
        Last edited by shliang; 10-06-2007, 10:21 AM.

        Comment


          #5
          The problem is solved.

          I tried the same program on my laptop and got different results. Here is the cuase:
          I downloaded and installed the AutoTrendLine indicator from this forum. The source code @Swing.cs bundled with it is buggy!!


          Please do not overwrite the original @Swing.cs at import.

          Ray, thank you for the help.
          Last edited by shliang; 10-06-2007, 11:10 AM.

          Comment


            #6
            shliang thanks for pointing this out.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              The new Swing.SwingHighBar/SwingLowBar returns Strength+1 when high/low is confirmed.

              I've expected it to be Strength.

              Comment


                #8
                Strength? Swing(5).SwingHighBar/SwingLowBar should return how many bars ago the new high/low value was found.

                Which new version are you referring to?
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by Josh View Post
                  Strength? Swing(5).SwingHighBar/SwingLowBar should return how many bars ago the new high/low value was found.

                  Which new version are you referring to?
                  NinjaTrader Version 6.0.1000.5

                  For Swing(5), high/low is confirmed when the 5th bar closes. At that exact moment, the high/low bar is 5 bars ago.

                  E.g., we have the following Open/Close series,

                  6/5, 5/4, 4/3, 3/2, 2/1, 1/0, 1/2, 2/3, 3/4, 4/5, 5/6, ...

                  1/0 is confirmed to be the Low Bar when the last 5/6 bar closes. 1/0 is 5 bars ago

                  Comment


                    #10
                    Okay I see what you are referring to, but I believe it is behaving as expected. When the 5th bar closes you are no longer on the 5th bar anymore. You are now on the 6th bar thus the print will say 6 bars ago instead of 5 bars ago.
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      Originally posted by Josh View Post
                      Okay I see what you are referring to, but I believe it is behaving as expected. When the 5th bar closes you are no longer on the 5th bar anymore. You are now on the 6th bar thus the print will say 6 bars ago instead of 5 bars ago.
                      I checked Close[0], it refers to the 6th bar. At the time the 5th closes, the close price of the 6th bar should not be invisible!

                      Comment


                        #12
                        I'm sorry I am not quite following you. The close of the 6th bar is not invisible. If this is running in real-time the Close[0] of the 6th bar will return the latest price of the current bar if you have CalculateOnBarClose set to false.

                        If you have CalculateOnBarClose set to true you are effectively not running any logic on the current bar until it has closed. This puts you 1 bar behind which is probably why you are seeing the 6th bar as "invisible".
                        Josh P.NinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by aussugardefender, Today, 01:07 AM
                        0 responses
                        3 views
                        0 likes
                        Last Post aussugardefender  
                        Started by pvincent, 06-23-2022, 12:53 PM
                        14 responses
                        238 views
                        0 likes
                        Last Post Nyman
                        by Nyman
                         
                        Started by TraderG23, 12-08-2023, 07:56 AM
                        9 responses
                        384 views
                        1 like
                        Last Post Gavini
                        by Gavini
                         
                        Started by oviejo, Today, 12:28 AM
                        0 responses
                        4 views
                        0 likes
                        Last Post oviejo
                        by oviejo
                         
                        Started by pechtri, 06-22-2023, 02:31 AM
                        10 responses
                        125 views
                        0 likes
                        Last Post Leeroy_Jenkins  
                        Working...
                        X