Since the overload is IDataSeries, should I just put the DataSeries I want to print out to the file?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
StreamWriter
Collapse
X
-
StreamWriter
Another question on the StreamWriter. I have your StreamWriter Sample. If I want to use it inside a strategy, can I just call it as an indicator?
Since the overload is IDataSeries, should I just put the DataSeries I want to print out to the file?Tags: None
-
I meant, in your sample you print out Open, High, Low, Close.
If I want to StreamWrite the Cumulative PNL of my strategy, can I just change your sample accordingly (changing the fields I want to print out) and then just insert StreamWriter into my strategy, as if it were an indicator?
The syntax would be StreamWriter()?
Comment
-
I'm using StreamWriter now to print out to a file the PnL of a Strategy. Since I cannot reference the PnL from an Indicator, I'm adding the StreamWriter to the strategy itself.
I followed your sample and added System.IO and in Variables System.IO.StreamWriter sw, then after the strategy code, the try catch block.
It compiles but in the Log I get "Error on calling OnBarUpdate method: object reference not set to an instance of an object".
What can be wrong? The strategy also doesn't run (all zeroes).
Comment
-
You will need to use try-catch blocks throughout your code to try and find where the error is being generated from. Please also see this tip if you are using IOrders. http://www.ninjatrader-support2.com/...ead.php?t=4226Josh P.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
561 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
325 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
547 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
547 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment