Does the start behavior in my strategy affect this? I currently have Wait until flat.
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
Strategy with connection loss and NT Closed - Interactive Brokers
Collapse
X
-
Strategy with connection loss and NT Closed - Interactive Brokers
My trades are generally swing trades that may last several days. On occasion something happens where I have to close out Ninjatrader and the Interactive Broker connection TWS and reopen both. When I reopen NT & TWS the strategy is disabled and both my target and stop loss orders are missing. I'm still in the trade but without those two exit orders. Is there some setting I can set to avoid this?
Does the start behavior in my strategy affect this? I currently have Wait until flat.Tags: None
-
Hello bc24fl, thanks for writing in.
You would need to set your startup behavior to something other than Wait Until Flat. Using Adopt Account Position or Immediately submit will preserve the orders that the strategy took after re-enabling the strategy. Please read through every start up behavior here for documentation on each feature:
https://ninjatrader.com/support/help..._positions.htm
Please let me know if I can assist any further.Chris L.NinjaTrader Customer Service
-
Originally posted by NinjaTrader_ChrisL View PostHello bc24fl, thanks for writing in.
You would need to set your startup behavior to something other than Wait Until Flat. Using Adopt Account Position or Immediately submit will preserve the orders that the strategy took after re-enabling the strategy. Please read through every start up behavior here for documentation on each feature:
https://ninjatrader.com/support/help..._positions.htm
Please let me know if I can assist any further.
Comment
-
Originally posted by bc24fl View Post
Yes I was reading that and notice the Adopt Account Position which looks fairly new since the last time I saw that page. I'll give that a try. Thank you.
Error was not fully shown but the visible said
"...behavior parameter 'Adopt account position' requires that there are no working orders on this strategy's instrument(s) in xxxxxxxxx. Please cancel any working orders on the same account-instrument combo(s) first to be able to ..."
I don't need anything complicated really. I don't care about history or what was in the strategy position prior to losing connection. I want to be able to start up NT and TWS and have the strategy look at the account position (the position and two exit orders) and simply ADOPT THAT POSITION. So basically trust that what is on the live broker is the correct states and just sync with that. Is that possible?
Comment
-
Ok so just tried a few more options:
With "Immediately submit, synchronize account". Same thing as previous post. Shutdown TWS, and then shutdown NT. Opened NT and then TWS. Enabled the strategy and this time it put "synchronize" on the chart and exited my existing position but left both exit order (stop loss and profit target).
With "Immediately submit". Same thing as previous post. Shutdown TWS, and then shutdown NT. Opened NT and then TWS. Enabled the strategy and this time it left my position opened but canceled my two exit orders (stop loss and profit target).
I have read and reread this page https://ninjatrader.com/support/help..._positions.htm and I'm still drawing a blank.
In my case, the account position (or what the broker has live) will always be the bible. Meaning I don't care what happened on the previous bars or historical. I don't care what the strategy thinks it needs to be. I want to enable the strategy and it automatically sync and copy what is in the Account Position to its Strategy Position. I know that the Account Position is in the perfect state so I just need to copy that to the Strategy Position when the strategy starts up again.
Comment
-
Hello bc24fl, thanks for your reply.
A previously generated order is considered to match an active strategy order when the order action, order type, quantity, limit price, and stop price are exactly identical. I tested both Immediately Submit and Adopt Account Position and the orders the strategy previous and they are working on my end. See this demo video:
If you test the attached strategy on your Interactive Brokers paper trading account you should get the same thing.
If you do, then we would need to see why your strategy is not picking the orders back up after the restart. We would need a reduced example of the strategy.
I look forward to hearing of your results.
Attached FilesChris L.NinjaTrader Customer Service
Comment
-
Hi Chris,
I'm not sure, I understand the video. At the time the strat is deactivated, position size is 2. After reactivation it changes to 3.
Is that expected behaviour? Shouldn't the strat recognize that it already had a position and only go long if that was not the case?
Thanks for clarifying.
NT-Roland
Comment
-
Hello NT-Roland, thanks for your reply.
That is just a side effect from the test script. It submits an order at the first real time bar. The example was meant to demonstrate that matching orders will be resubmitted when the strategy starts back up.
Best regards.Chris L.NinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_ChrisL View PostHello bc24fl
A previously generated order is considered to match an active strategy order when the order action, order type, quantity, limit price, and stop price are exactly identical.
Comment
-
Hello bc24fl, thanks for your reply.
The market order would not be the issue. If the account is long, for example, and a stop loss and profit target are set up, then the strategy needs to be re-enabled, we use Immediately Submit because we already know the state the strategy will be in after re-enabling and we want the existing orders to be re-submitted.
Please let me know if I can assist any further.Chris L.NinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_ChrisL View PostHello bc24fl, thanks for your reply.
A previously generated order is considered to match an active strategy order when the order action, order type, quantity, limit price, and stop price are exactly identical. I tested both Immediately Submit and Adopt Account Position and the orders the strategy previous and they are working on my end. See this demo video:
If you test the attached strategy on your Interactive Brokers paper trading account you should get the same thing.
If you do, then we would need to see why your strategy is not picking the orders back up after the restart. We would need a reduced example of the strategy.
I look forward to hearing of your results.
Comment
-
Hello bc24fl, thanks for your reply.
My demo script was only meant to demonstrate that the strategy generated resting orders are in fact resubmitted when the strategy is disabled and re-enabled. The strategy example is contrived, so it simply submits an order at the first real time bar which is why it submits an order after resubmission. In a real strategy, the entry condition would not happen again and again like this. I made a modification of the SampleMACrossover and added stops and targets to it to be more clear on the example. You will need to wait for an entry signal to test, but it makes the test more clear on how the strategy will pick back up on the orders it previously submitted.
https://clauber.tinytake.com/tt/NTAxMDM4MF8xNTc2MTgxMQ - demo video
Please let me know if you have any questions on this material.Attached FilesChris L.NinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_ChrisL View PostHello bc24fl, thanks for your reply.
My demo script was only meant to demonstrate that the strategy generated resting orders are in fact resubmitted when the strategy is disabled and re-enabled. The strategy example is contrived, so it simply submits an order at the first real time bar which is why it submits an order after resubmission. In a real strategy, the entry condition would not happen again and again like this. I made a modification of the SampleMACrossover and added stops and targets to it to be more clear on the example. You will need to wait for an entry signal to test, but it makes the test more clear on how the strategy will pick back up on the orders it previously submitted.
https://clauber.tinytake.com/tt/NTAxMDM4MF8xNTc2MTgxMQ - demo video
Please let me know if you have any questions on this material.Last edited by bc24fl; 01-15-2021, 11:30 AM.
Comment
-
Hello bc24fl, thanks for your reply.
This is because the Immediately Submit startup behavior is set. It's up to the user launching the strategy to know the account position will be in the correct state when enabling the strategy. Adopt Account Position would need to be used to take on the accounts position. Alternatively, if you use Immediately Submit, Synchronize account the strategy would first make the account flat because the strategy would start flat in the first example.
Please let me know if I can assist any further.Chris L.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Net Change
by Segwin
Started by Segwin, 05-07-2018, 02:15 PM
|
10 responses
1,769 views
0 likes
|
Last Post
by Leafcutter
Today, 03:01 AM
|
||
Change colour of Stop market and limit orders to red and green via indicator script
by Rapine Heihei
Started by Rapine Heihei, 04-23-2024, 07:51 PM
|
2 responses
30 views
0 likes
|
Last Post
by Max238
Today, 02:25 AM
|
||
Started by Shansen, 08-30-2019, 10:18 PM
|
24 responses
943 views
0 likes
|
Last Post
by spwizard
Today, 01:29 AM
|
||
Started by Max238, Today, 01:28 AM
|
0 responses
10 views
0 likes
|
Last Post
by Max238
Today, 01:28 AM
|
||
Started by rocketman7, Today, 01:00 AM
|
0 responses
7 views
0 likes
|
Last Post
by rocketman7
Today, 01:00 AM
|
Comment