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 Hwop38, 05-04-2026, 07:02 PM
|
0 responses
161 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|
||
|
Started by CaptainJack, 04-24-2026, 11:07 PM
|
0 responses
309 views
0 likes
|
Last Post
by CaptainJack
04-24-2026, 11:07 PM
|
||
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
245 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
349 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
179 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|

Comment