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 PeakTry, Today, 10:49 AM
      0 responses
      2 views
      0 likes
      Last Post PeakTry
      by PeakTry
       
      Started by llanqui, Today, 10:32 AM
      0 responses
      4 views
      0 likes
      Last Post llanqui
      by llanqui
       
      Started by StockTrader88, 03-06-2021, 08:58 AM
      45 responses
      3,992 views
      3 likes
      Last Post johntraderuser2  
      Started by TAJTrades, Today, 09:46 AM
      0 responses
      8 views
      0 likes
      Last Post TAJTrades  
      Started by rhyminkevin, Yesterday, 04:58 PM
      5 responses
      62 views
      0 likes
      Last Post dp8282
      by dp8282
       
      Working...
      X