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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      152 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      89 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      131 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      127 views
      1 like
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      107 views
      0 likes
      Last Post CarlTrading  
      Working...
      X