• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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 juanram, Today, 03:50 AM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by emuns, Today, 08:28 AM
            0 responses
            3 views
            0 likes
            Last Post emuns
            by emuns
             
            Started by backtester831, Today, 08:14 AM
            1 response
            5 views
            0 likes
            Last Post NinjaTrader_RyanS  
            Started by HiddenPhilosopher, Today, 03:53 AM
            4 responses
            14 views
            0 likes
            Last Post HiddenPhilosopher  
            Started by KhaosTrader, Yesterday, 11:04 PM
            6 responses
            19 views
            0 likes
            Last Post KhaosTrader  
            Working...
            X