I have create strategy which save last bar data to file (only one row OHCL data), but it working slow and unstable. I move code from this strategy to indicator and indicator works better. Than I find sample stream writer indicator which write ohcl data to file. But I need only one row in file only last bar data, I don't need all history from chart. So how should I fix stream writer indicator for saving only last bar data?
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
saving last bar data using stram writer
Collapse
X
-
saving last bar data using stram writer
Dear friends.
I have create strategy which save last bar data to file (only one row OHCL data), but it working slow and unstable. I move code from this strategy to indicator and indicator works better. Than I find sample stream writer indicator which write ohcl data to file. But I need only one row in file only last bar data, I don't need all history from chart. So how should I fix stream writer indicator for saving only last bar data?Tags: None
-
daglas, using System IO here would be liklely better performing for your task - http://www.ninjatrader.com/support/f...ad.php?t=48902
You can simply move the if (Historical) return; statement you see, so it would only save current realtime data going forward for example, currently it would store all historical data as well in the sample and then output the RT saved data to the output window.BertrandNinjaTrader Customer Service
-
Now I have such trouble. If my program which periodically read this file cause collision (read the file when nt7 try to save data to this file), indicator stops and I have error message in log windows. Something like indicator can't access to file ****. How can I write some exception in body of indicator, to retry reading file after collision or something also which help to write data even after errors.
Comment
-
daglas, you would need to look into locking the file to ensure no concurrent access is possible - for ideas you can check into this link - http://stackoverflow.com/questions/7...ed-environmentBertrandNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by trilliantrader, Yesterday, 03:01 PM
|
3 responses
29 views
0 likes
|
Last Post Today, 08:28 AM | ||
Started by cmtjoancolmenero, Yesterday, 03:58 PM
|
4 responses
26 views
0 likes
|
Last Post Today, 08:19 AM | ||
Started by Brevo, Today, 01:45 AM
|
1 response
14 views
0 likes
|
Last Post Today, 08:14 AM | ||
Started by rjbtrade1, 11-30-2023, 04:38 PM
|
2 responses
74 views
0 likes
|
Last Post
by DavidHP
Today, 08:12 AM
|
||
Started by suroot, 04-10-2017, 02:18 AM
|
5 responses
3,022 views
0 likes
|
Last Post Today, 08:11 AM |
Comment