Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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
    BertrandNinjaTrader Customer Service

    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 alifarahani, Today, 09:40 AM
      6 responses
      38 views
      0 likes
      Last Post alifarahani  
      Started by Waxavi, Today, 02:10 AM
      1 response
      18 views
      0 likes
      Last Post NinjaTrader_LuisH  
      Started by Kaledus, Today, 01:29 PM
      5 responses
      15 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by Waxavi, Today, 02:00 AM
      1 response
      12 views
      0 likes
      Last Post NinjaTrader_LuisH  
      Started by gentlebenthebear, Today, 01:30 AM
      3 responses
      17 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X