Bryan
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
When strategy loses connection
Collapse
X
-
When strategy loses connection
When a strategy has an open position it's managing, and it loses the broker connection and disables itself, is there a way to enable the strategy and pick up managing that same trade again from where it left off?
BryanTags: None
-
Hello Bryan,
Thank you for writing in.
No, once the strategy has disabled itself due to hitting its max reconnect attempts, you would manually have to handle the strategy/position.
If you are having connection issues you might consider looking into a new internet provider or a VPS.
Please let us know if you need further assistance.Alan P.NinjaTrader Customer Service
-
Thanks Alan. Is there any workaround for this? Saving the strategy variables to a file on every tick and restoring from the file when it comes back online? Something? Anyone?
Comment
-
Originally posted by NinjaTrader_AlanP View PostHello Bryan,
Thank you for writing in.
No, once the strategy has disabled itself due to hitting its max reconnect attempts, you would manually have to handle the strategy/position.
If you are having connection issues you might consider looking into a new internet provider or a VPS.
Please let us know if you need further assistance.
ref: http://ninjatrader.com/support/helpG...rtbehavior.htm
http://ninjatrader.com/support/helpG..._positions.htm
Comment
-
Yes, good point. And that goes with this flag:
IsAdoptAccountPositionAware
Definition
Determines if the strategy is programmed in a manner capable of handling real-world account positions. Once set to true, your strategy's "Start behavior" options will include an additional parameter named "Adopt account position" which can bet set at run-time. Only set to true if you have specifically programmed your strategy to be able to adopt account positions.
Comment
-
Hello cassb,
Koganam provides a good suggestion for how to set up your strategy to begin re-managing an open position upon restart, thank you Koganam, however I have just submitted a bug report as its not behaving as expected.
Your question about writing and reading from a text file could work, however would require you use the unmanaged approach, which a more advanced programming topic. You could read more about that here,
https://ninjatrader.com/support/help...d_approach.htm
If you were interested in that approach, I have provided links to reading/writing from a text file.
Indicator: Using StreamWriter to write to a text file
Then you could have your strategy read from the file, a reference example,
Indicator: Using StreamReader to read from a text file
Please let us know if you need further assistance.Alan P.NinjaTrader Customer Service
Comment
-
Thanks Alan. I think I'll try koganam's suggestion, but you are saying it doesn't work in the current version? I do use the managed approach with orders, so I would rather not have to use text files and change the code to use the unmanaged approach.
Comment
-
Fantastic, thank you! Is there an issue number or something I can reference in the next Release Notes that would tell me it's working?
Bryan
Comment
-
Hi Alan. Is this issue resolved yet? I would like to use it asap.
Thanks!
Bryan
Comment
-
Hello Bryan,
Go to Control Center>Tools>Options and under Strategy Categories, if you you set On Connection Loss>Handling> to Keep Running or Stop Strategy, then upon connection loss your strategy should behave as expected.
Start Behavior will only affect the strategies when they are first started.
I apologize for not following up on this sooner, I had forgot to include this ticket with the issue number and therefor couldn't follow up when it was explained to me.
Please let us know if you need further assistance.Alan P.NinjaTrader Customer Service
Comment
-
OK thank you. But we had that option set to "Keep Running", but the problem was that it lost the connection and never reconnected. When we disconnected and reconnected to the provider, the strategy disabled and then was not able to manage the position. Is there a way around that to manually reconnect to the broker without disabling the strategy?
Thanks!
Bryan
Comment
-
I have the same issue. Its not a frequent occurrence but would be nice to have this as a backup plan. I set the connection timeout to 180s and reconnection attempts to 5. The major obstacle is if you have to restart NT8 due to a crash and re-enable the strategy once restarted. I set start behavior on the strategy to sync with account and submit immediately. This way, you would have all original orders closed prior to enabling again and a fresh set of orders out in sync with the original order submission. Only drawback is you might enter the same position as a less favourable price (or better if your lucky).
Comment
-
Exactly. I'm not sure why the strategy automatically disables when you disconnect from the broker, but it would be nice to have a switch to allow it to remain running while you reconnect so that it would stay in sync with the open positions at the broker.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Jayjo, Yesterday, 09:20 AM
|
1 response
19 views
0 likes
|
Last Post
|
||
Started by rtwave, 09-14-2023, 11:51 PM
|
7 responses
37 views
0 likes
|
Last Post
|
||
Started by suraj, 09-21-2023, 08:11 AM
|
5 responses
39 views
0 likes
|
Last Post
|
||
Started by ntbone, 09-23-2023, 11:29 PM
|
5 responses
32 views
0 likes
|
Last Post
|
||
Started by derivtrader, 09-22-2023, 12:54 PM
|
3 responses
27 views
0 likes
|
Last Post
![]()
by Zigfried
Today, 08:09 AM
|
Comment