Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Need help print past bar time

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

    Need help print past bar time

    Here is the code:
    int barsAgo = CurrentBar-BarOfLastSignal; Print ("barsAgo="+barsAgo);
    if (output == 1 || output == 2 || output == 9) Print (" Close="+Close+" GreenDot="+GreenDot+" BarOfLastSignal="+BarOfLastSignal+" TimeOfLastSignal="+Time[barsAgo].ToString());

    Not only does it NOT print the Time, it doesn't print anything in that statement; in addition, it terminates the processing. If I remove the Time component, it all works fine, as follows:

    if (output == 1 || output == 2 || output == 9) Print (" Close="+Close+" GreenDot="+GreenDot+" BarOfLastSignal="+BarOfLastSignal);

    How do I print Time for a bar in the past?

    #2
    Did you see an error in the log tab?

    You probably ran into accessing a TimeSeries object that was not defined at the start of your chart - http://www.ninjatrader-support2.com/...ead.php?t=3170

    Comment


      #3
      Bertrand, that link was the clue

      Originally posted by NinjaTrader_Bertrand View Post
      Did you see an error in the log tab?

      You probably ran into accessing a TimeSeries object that was not defined at the start of your chart - http://www.ninjatrader-support2.com/...ead.php?t=3170
      Bertrand, that link was the clue... I had enough bars, but the first time through, the BarOfLastSignal was negative... I inserted a conditional and it works now.

      Thanks much!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      161 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      311 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      245 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      350 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      179 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X