Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

PrintWithTimeStamp

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

    PrintWithTimeStamp

    Is it not possible to print to the output window within and indicator?

    #2
    Hi there, it is most definitely possible to print to the output window within an indicator.
    Code:
    Print("print what you want here");
    AustinNinjaTrader Customer Service

    Comment


      #3
      FWIW, I do this a lot. For example (useful when multiple charts)

      Code:
      header = "[" + (Bars.Period.Value).ToString() + " " + Bars.Period.Id.ToString() + "] " + Time[0].ToString("MM/dd HH:mm:ss") + " ";
       Print(header + "whatever message.");

      Comment


        #4
        Hi I used this example for debugging my indicator. I found that it only works forward, not backward to historical data.

        For example, if I put
        Code:
                protected override void OnBarUpdate()
                {
        Print(Time[0].ToString()+"Close[0]:"+Close[0].ToString());
        }
        in strategy, I will get close price of each bar. But in indicator, I will get the same line for every historical bar like this
        Code:
        6/21/2012 09:43:50Close[0]:1348
        6/21/2012 09:43:50Close[0]:1348
        6/21/2012 09:43:50Close[0]:1348
        6/21/2012 09:43:50Close[0]:1348
        6/21/2012 09:43:50Close[0]:1348
        6/21/2012 09:43:50Close[0]:1348
        6/21/2012 09:43:50Close[0]:1348
        6/21/2012 09:43:50Close[0]:1348
        6/21/2012 09:43:50Close[0]:1348
        6/21/2012 09:43:50Close[0]:1348
        6/21/2012 09:44:57Close[0]:1348
        and only per bar value on forward data
        Code:
        6/21/2012 09:45:25Close[0]:1347.75
        6/21/2012 09:45:44Close[0]:1348
        6/21/2012 09:45:50Close[0]:1347.5
        6/21/2012 09:45:54Close[0]:1347.5
        6/21/2012 09:46:21Close[0]:1347.5
        6/21/2012 09:46:44Close[0]:1347.75
        6/21/2012 09:47:15Close[0]:1347.75
        so my question is: how should I change the indicator so that it works the same like in strategy?

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        579 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        334 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 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
        551 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X