Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
PrintWithTimeStamp
Collapse
X
-
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
-
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
in strategy, I will get close price of each bar. But in indicator, I will get the same line for every historical bar like thisCode:protected override void OnBarUpdate() { Print(Time[0].ToString()+"Close[0]:"+Close[0].ToString()); }
and only per bar value on forward dataCode: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
so my question is: how should I change the indicator so that it works the same like in strategy?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
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by SalmaTrader, 07-07-2026, 10:26 PM
|
0 responses
29 views
0 likes
|
Last Post
by SalmaTrader
07-07-2026, 10:26 PM
|
||
|
Started by CarlTrading, 07-05-2026, 01:16 PM
|
0 responses
17 views
0 likes
|
Last Post
by CarlTrading
07-05-2026, 01:16 PM
|
||
|
Started by CaptainJack, 06-17-2026, 10:32 AM
|
0 responses
9 views
0 likes
|
Last Post
by CaptainJack
06-17-2026, 10:32 AM
|
||
|
Started by kinfxhk, 06-17-2026, 04:15 AM
|
0 responses
16 views
0 likes
|
Last Post
by kinfxhk
06-17-2026, 04:15 AM
|
||
|
Started by kinfxhk, 06-17-2026, 04:06 AM
|
0 responses
19 views
0 likes
|
Last Post
by kinfxhk
06-17-2026, 04:06 AM
|

Comment