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 bortz, 11-06-2023, 08:04 AM
            47 responses
            1,606 views
            0 likes
            Last Post aligator  
            Started by jaybedreamin, Today, 05:56 PM
            0 responses
            9 views
            0 likes
            Last Post jaybedreamin  
            Started by DJ888, 04-16-2024, 06:09 PM
            6 responses
            19 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by Jon17, Today, 04:33 PM
            0 responses
            6 views
            0 likes
            Last Post Jon17
            by Jon17
             
            Started by Javierw.ok, Today, 04:12 PM
            0 responses
            15 views
            0 likes
            Last Post Javierw.ok  
            Working...
            X