Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time[x] wrong

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

    Time[x] wrong

    OK, this test case is built off the Test1-3 from the earlier thread Closes[1].
    It still takes as input a variable BIP which tells it to calculate signals on BIP=1 or BIP=0. You can see from the chart that the indicator is set to BIP = 1 to use the internal bar series (5*25V).

    In this one, I am saving points of change, and then looking for Div/Conv to draw.
    If you look in the code, you see that the XPoint values are saved by
    oetsiLL.Set(eTSI[i], b0-i, Time[b0-i]); // WRONG
    histLL.Set(HIST[xh],b0-xh,Time[b0-xh]); // CORRECT
    minorHH.Set(Highs[x][xm],bx-xm,Time[bx-xm]); // CORRECT

    i, xh, xm are all barsago. b0 = CurrentBars[0] and bx=CurrentBars[x=1].

    The attached snapshot shows the printout as well as the Data Box. minor & hist are both correct, even though they are on different bar series. etsi is wrong. Oddly, the bar = b0-i is CORRECT, but the Time[b0-i] is that of the very first bar on the chart CurrentBars[0]==0.

    Since, in a multi-bar series, one must use Time to draw the DC line correctly, I need Time[] to assign the values correctly.

    Is there a flavor of Time that specifies Bar series? If not, there needs to be one.
    Attached Files

    #2
    LostTrader, in a MultiSeries context you can use Times[x][x] to access the timestamps of the added bars objects -



    Would that help fix the erroneous timestamp return you ran into?

    Comment


      #3
      Nope, it does not....
      oetsiHH.Set(eTSI[i], b0-i, Times[0][b0-i]);
      same failure. The recorded bar is correct but the Time is that of the very first bar on the chart. The other two recorded Times are correct, as they were before.

      Perhaps I should have said, in addition to existing, it also needs to work?
      I find it odd that it is (one of) the BIP=0 ones that is failing, Not all, just some.
      Attached Files

      Comment


        #4
        I would agree lostTrader, that seems odd - best would be to strip down the indicator and print out all related parts of this one call giving you issues to be able to iron out where this stems from.

        Comment


          #5
          It "stems" from a problem in Ninjatrader's Time function.
          Don't you guys even care?

          Comment


            #6
            Lost Trader, it is very difficult to find exactly where an issue stems from in a 400+ line indicator. If you can provide us with a stripped down indicator that exhibits this behavior, we'll gladly take a look.
            AustinNinjaTrader Customer Service

            Comment


              #7
              Austin, it certainly is not the beta tester's responsibility to debug the code for development. Particularly since beta testing for you is a volunteer job.

              I gave you the test case. I told you exactly which line in the test case.

              The fact that y'all are unwilling to do the job does explain why NT7 is so buggy.

              Comment


                #8
                LostTrader, I agree with you that betatesters should not debug NT's code, but here we're dealing with your custom indicator code which is not stripped down to it's maximum - to provide a simple test as working basis, please test my script attached on your 25 Vol chart, it will add the 125 Vol one and print BIP, CurrentBars and Time of the respective bars object to your output window. Doing so, please let me know where you see the Time() method returning you an unexpected value, testing on my ES ZenFire chart I seem to get all prints as expected.

                Thanks
                Attached Files

                Comment


                  #9
                  Bertrand, I looked at your test case and even ran it. Of course, it better work correctly. If you look at Test4, you will notice that NONE of the Print("Time[0]"); stmts ever failed.

                  The problem only occurred when saving the previous Time[# > 0] in a DateTime variable and then only sometimes. I improved your test case below. It fails. When you know why, please let me know.

                  Thank you.

                  P.S. I think you meant "down to its minimum"
                  Attached Files

                  Comment


                    #10
                    Ok, thanks for the snippet - I printed the DateTime's you save to your DateTime variable t, they all print correct, next I printed the CurrentBars you access from the primary series for both series, they also seem correct.

                    After looking at your code I rather believe the issue is in your XPoint custom class from where the false time prints originate from, the first (t from your OnBarUpdate() ) is correct, the Time one from the helper class not, so I suggest to focus on this to debug your indicator.

                    Comment


                      #11
                      No, it isn't in the XPoint class. Been using it for years in v6.5 which prompted me to go back and check.

                      Sigh. I printed out the Times[x][bx-i] and it was wrong before the .Set -- then I realized that Time uses barsago and it should be written Times[x][i]. When Test4 was corrected, it works now. That also explains why it was inconsistent - new high/low updates always used current time - no mistakes there.

                      I hate it when I make stupid mistakes and that does seem to be one of my more common ones.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                      0 responses
                      590 views
                      0 likes
                      Last Post Geovanny Suaza  
                      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                      0 responses
                      342 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by Mindset, 02-09-2026, 11:44 AM
                      0 responses
                      103 views
                      0 likes
                      Last Post Mindset
                      by Mindset
                       
                      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                      0 responses
                      555 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by RFrosty, 01-28-2026, 06:49 PM
                      0 responses
                      552 views
                      1 like
                      Last Post RFrosty
                      by RFrosty
                       
                      Working...
                      X