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

barsAgo = Swing(swingStrength).SwingLowBar gives wrong anser

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

    barsAgo = Swing(swingStrength).SwingLowBar gives wrong anser

    barsAgo = Swing(swingStrength).SwingLowBar(startBar, 1, realTimeLookBack);
    The above line gives the wrong value if CalculateonBarClose = false;
    It is correct if CalculateonBarClose = true.
    This is true in either an indicator or strategy for an identical chart
    The wrong value is off by many bars.
    Usually it refers to a swing more than 1 instance back
    often as much as 3 instances back.
    The correct answer is generally quite nearby on the chart, say 2 or 3.
    In order to fix the problem i wrote my own, which works,
    but I am wondering what
    I am not understanding about the NT version usage that is causing
    an incorrect return value when CalculateOnBarClose = false.

    swingstrength is 1, realtimelookback is 20

    Note the the error occurs whether the startBar is 0 or 1.
    (Have not tried other values)

    Thank you
    Roland

    #2
    Hello roland_nt,

    Thanks for your post.

    I've tried your sample code and not found the issue you are reporting when using COBC = false.
    So I might replicate your test set-up, what bar type, timeframe, instrument(s) are you using?
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Swing gives wrong answer CBOC = false

      My tests were using Ninja standard Renko, typical brick size value 11, instrument FB, BABA and other stocks
      Trading times between 9:30 and 11 AM Eastern

      Comment


        #4
        Hello Roland,

        Thanks for your reply.

        I tested with the FB, 11 renko, live data and again did not observe the issue you are reporting. I know that you have found a work around solution so perhaps this is a rhetorical question but is there any chance that the variables startbar and realtimelookback were changing or were not what you expected? I used fixed values for both in my testing.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Thanks for your effort.
          The variables are fixed in value at the start of the program.
          I also print them out - they are stable.
          I am not sure where to go from here.
          The indicator is huge to examine.
          I could send it if you like
          along with the days it fails on
          and with some debug instructions.
          It does not require elaborate setup.
          Although I made a workaround, it is a trivial implementation
          and I would like to feel comfortable with the standard Ninja version.

          Comment


            #6
            Hello,

            Thanks for your reply.

            Is it possible to break the indicator down to just the code section of interest? If not or either way, please send your indicator and information to PlatformSupport[at]Ninjatrader[dot]Com Atten: Paul and a link to this thread.

            Thank-you.
            Paul H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by RideMe, 04-07-2024, 04:54 PM
            5 responses
            28 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Started by f.saeidi, Today, 08:13 AM
            1 response
            4 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by DavidHP, Today, 07:56 AM
            1 response
            6 views
            0 likes
            Last Post NinjaTrader_Erick  
            Started by kujista, Today, 06:23 AM
            3 responses
            9 views
            0 likes
            Last Post kujista
            by kujista
             
            Started by Mindset, Yesterday, 02:04 AM
            2 responses
            18 views
            0 likes
            Last Post NinjaTrader_RyanS  
            Working...
            X