Since the overload is IDataSeries, should I just put the DataSeries I want to print out to the file?
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!
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
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 aussugardefender, Today, 01:07 AM
|
0 responses
3 views
0 likes
|
Last Post Today, 01:07 AM | ||
Started by pvincent, 06-23-2022, 12:53 PM
|
14 responses
238 views
0 likes
|
Last Post
by Nyman
Today, 12:47 AM
|
||
Started by TraderG23, 12-08-2023, 07:56 AM
|
9 responses
384 views
1 like
|
Last Post
by Gavini
Today, 12:29 AM
|
||
Started by oviejo, Today, 12:28 AM
|
0 responses
4 views
0 likes
|
Last Post
by oviejo
Today, 12:28 AM
|
||
Started by pechtri, 06-22-2023, 02:31 AM
|
10 responses
125 views
0 likes
|
Last Post Today, 12:03 AM |
Comment