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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      582 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      338 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
      554 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