CloseStrategy(string) actually closing positions and cancelling pending orders, I have checked the help guide and also tried it. Can you please advise what syntax I should use to only disable the strategy without closing open positions and without canceling any pending order. Thanks in advance.
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
Closing strategy without closing pending orders or open position
Collapse
X
-
Closing strategy without closing pending orders or open position
Hi,
CloseStrategy(string) actually closing positions and cancelling pending orders, I have checked the help guide and also tried it. Can you please advise what syntax I should use to only disable the strategy without closing open positions and without canceling any pending order. Thanks in advance.Tags: None
-
-
Hi CheseaB,
The problem I face now is, I have open position, pending orders on the account. When I enable the strategy, it cancels all the pending orders keeping the position open. Is there anyway I can enable the strategy without cancelling any pending order?Last edited by asmmbillah; 01-25-2021, 07:47 AM.
Comment
-
Hello asmmbillah,
This would only be possible if in the historical data the orders match with the previously submitted real-time orders and the Immediately Submit start behavior is used. A match means the order type, signal name, submission and fill time, and quantity must match. Otherwise the strategy would not match the order and automatically cancel it.
Chelsea B.NinjaTrader Customer Service
Comment
-
Thanks, I have tried immediate submit and immediate submit synch account position options according to your post link and contents there. Nothings works. In both the occassions, it cancels the pending orders when I re-enable the strategy. Please advise.
Comment
-
It places orders on BarsInProgress == 0; Do you want me to add AddDataSeries() for 1 tick and execute pending orders on BarsInProgress == 1?
Comment
-
Hello asmmbillah,
That would depend on the type of orders and if the position is the same at the same time and if the orders are being submitted at the same price and time.
If the orders do not match, they cannot be resumed.
If the time or price is different, the orders will be automatically cancelled.
You can use TraceOrders and Print() to print the order object in OnOrderUpdate() and verify the order prices and times are the same from the real-time, and then with the historical after being reloaded.Chelsea B.NinjaTrader Customer Service
Comment
-
Thanks for your reply. Pending entry orders are generated with click of custom button, but SL and PT pending orders are generated with entry order onexecutionupdate. In that case, it will not match as the start of the process is started with click of a button. What is your advised in this case so that I can re-enable and keep the pending orders?
Comment
-
Hello asmmbillah,
Orders that are generated from button clicks will not be submitted in historical data, will not be matched, and will automatically be cancelled.
Perhaps you would prefer to use an addon or indicator with the addon approach to send orders instead of an automated strategy?
You could try writing the order information to a text file, reading this from text file in historical data, and submitting the order historically at the same time and price.
Chelsea B.NinjaTrader Customer Service
Comment
-
Thanks. I think read write may be suitable. But question is, if the strategy is disabled, I want to write the pending orders. Should I write in state=state.terminated ? and how I can access pending order within orders to write them in file?
Comment
-
Thanks and will it be true even for live account where normally working and accepted orders resides within broker's server? are those also get cancelled similar which we discussed in post #11?
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by pmachiraju, 11-01-2023, 04:46 AM
|
8 responses
147 views
0 likes
|
Last Post
by rehmans
Today, 06:44 PM
|
||
Started by mattbsea, Today, 05:44 PM
|
0 responses
5 views
0 likes
|
Last Post
by mattbsea
Today, 05:44 PM
|
||
Started by RideMe, 04-07-2024, 04:54 PM
|
6 responses
33 views
0 likes
|
Last Post
by RideMe
Today, 05:31 PM
|
||
Started by tkaboris, Today, 05:13 PM
|
0 responses
5 views
0 likes
|
Last Post
by tkaboris
Today, 05:13 PM
|
||
Started by GussJ, 03-04-2020, 03:11 PM
|
16 responses
3,282 views
0 likes
|
Last Post
by Leafcutter
Today, 04:14 PM
|
Comment