Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Translating a v6.0 strategy to 7
Collapse
X
-
I now seem to be having an issue with exit orders cancelling themselves without reason. the strategy holds up to 3 positions with 3 different profit targets, when I run a single strategy it seems to be working ok, however when I run it on multiple contracts at once some times exit orders will cancel themselves before being executed and I am often left with an open position of 3 contracts but a profit target for only 1 contract. It almost seems as if trades in other contracts are triggering these cancellations (In the log it shows up as order cancelled).
Has anyone else come across this before, or is it simply a bug in my strategy?
There are no time stops or anything similar
Comment
-
-
Betrand,the order ID's all look unique, however when I get a long position in 1 strategy, then a long position (same name in OCO column) in another strategy, the exit for the first one is cancelled. Almost as if it can only handle 1 exit across however many strategies Im running......
Comment
-
-
Please see this example here - http://www.ninjatrader.com/support/f...ead.php?t=3627
You would add it in the Initialize() of your strategies and then the additional debug info is shown in your output window.
Comment
-
Thanks for that. was able to implement it. Fills of an exit OCO in 1 contract (CL 10-10) are definately resulting in an exit OCO of the same name being cancelled in another contract (FDAX 09-10) and visa versa. Im not sure how to interpret the output window though, below is the output as the orders cancelled each other out.
I cant see where the FDAX orders were cancelled though.
Changing unmanaged order at 9/8/2010 5:43:55 AM: Order='fdb8abd5288542b197e053290806be33/Sim101' Name='Long Limit1' State=Working Instrument='CL 10-10' Action=Buy Limit price=73.49 Stop price=0 Quantity=1 Strategy='MMStrategy' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='fdb8abd5288542b197e053290806be33' Gtd='12/1/2099 12:00:00 AM'
Changing unmanaged order at 9/8/2010 5:43:55 AM: Order='827096782abe4c8fa36680ff3b861e19/Sim101' Name='Short Limit1' State=Working Instrument='CL 10-10' Action=SellShort Limit price=73.59 Stop price=0 Quantity=1 Strategy='MMStrategy' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='827096782abe4c8fa36680ff3b861e19' Gtd='12/1/2099 12:00:00 AM'
Changing unmanaged order at 9/8/2010 5:43:55 AM: Order='69f97330d1df46969ac4b72751db4921/Sim101' Name='Long Limit2' State=Working Instrument='CL 10-10' Action=Buy Limit price=73.47 Stop price=0 Quantity=1 Strategy='MMStrategy' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='69f97330d1df46969ac4b72751db4921' Gtd='12/1/2099 12:00:00 AM'
Changing unmanaged order at 9/8/2010 5:43:55 AM: Order='26429310aee84ced89e09e26d867bb61/Sim101' Name='Short Limit2' State=Working Instrument='CL 10-10' Action=SellShort Limit price=73.61 Stop price=0 Quantity=1 Strategy='MMStrategy' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='26429310aee84ced89e09e26d867bb61' Gtd='12/1/2099 12:00:00 AM'
Changing unmanaged order at 9/8/2010 5:43:55 AM: Order='890ad138ed9046e6b0384840d908edf5/Sim101' Name='Long Limit3' State=Working Instrument='CL 10-10' Action=Buy Limit price=73.45 Stop price=0 Quantity=1 Strategy='MMStrategy' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='890ad138ed9046e6b0384840d908edf5' Gtd='12/1/2099 12:00:00 AM'
Changing unmanaged order at 9/8/2010 5:43:55 AM: Order='7912302fe33e4d1ebc49804744974e3c/Sim101' Name='Short Limit3' State=Working Instrument='CL 10-10' Action=SellShort Limit price=73.63 Stop price=0 Quantity=1 Strategy='MMStrategy' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='7912302fe33e4d1ebc49804744974e3c' Gtd='12/1/2099 12:00:00 AM'
Sell Order Filled73.59
Cancelled custom managed order at 9/8/2010 5:44:49 AM: Order='fdb8abd5288542b197e053290806be33/Sim101' Name='Long Limit1' State=Working Instrument='CL 10-10' Action=Buy Limit price=73.49 Stop price=0 Quantity=1 Strategy='MMStrategy' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='fdb8abd5288542b197e053290806be33' Gtd='12/1/2099 12:00:00 AM'
Cancelled custom managed order at 9/8/2010 5:44:49 AM: Order='69f97330d1df46969ac4b72751db4921/Sim101' Name='Long Limit2' State=Working Instrument='CL 10-10' Action=Buy Limit price=73.47 Stop price=0 Quantity=1 Strategy='MMStrategy' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='69f97330d1df46969ac4b72751db4921' Gtd='12/1/2099 12:00:00 AM'
Cancelled custom managed order at 9/8/2010 5:44:49 AM: Order='890ad138ed9046e6b0384840d908edf5/Sim101' Name='Long Limit3' State=Working Instrument='CL 10-10' Action=Buy Limit price=73.45 Stop price=0 Quantity=1 Strategy='MMStrategy' Type=Limit Tif=Gtc Oco='' Filled=0 Fill price=0 Token='890ad138ed9046e6b0384840d908edf5' Gtd='12/1/2099 12:00:00 AM'
9/8/2010 5:44:49 AM Entered internal SubmitOrder() method at 9/8/2010 5:44:49 AM: Action=BuyToCover OrderType=Limit Quantity=1 LimitPrice=73.54 StopPrice=0 OcoId='ShortExit1' Name='Short Profit1'
9/8/2010 5:44:49 AM Entered internal SubmitOrder() method at 9/8/2010 5:44:49 AM: Action=BuyToCover OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=73.69 OcoId='ShortExit1' Name='Short StopLoss1'
Sell Order Filled73.6
9/8/2010 5:46:34 AM Entered internal SubmitOrder() method at 9/8/2010 5:46:34 AM: Action=BuyToCover OrderType=Limit Quantity=1 LimitPrice=73.55 StopPrice=0 OcoId='ShortExit2' Name='Short Profit2'
9/8/2010 5:46:34 AM Entered internal SubmitOrder() method at 9/8/2010 5:46:34 AM: Action=BuyToCover OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=73.70 OcoId='ShortExit2' Name='Short StopLoss2'
Sell Order Filled73.61
9/8/2010 5:46:39 AM Entered internal SubmitOrder() method at 9/8/2010 5:46:39 AM: Action=BuyToCover OrderType=Limit Quantity=1 LimitPrice=73.56 StopPrice=0 OcoId='ShortExit3' Name='Short Profit3'
9/8/2010 5:46:39 AM Entered internal SubmitOrder() method at 9/8/2010 5:46:39 AM: Action=BuyToCover OrderType=Stop Quantity=1 LimitPrice=0 StopPrice=73.71 OcoId='ShortExit3' Name='Short StopLoss3'
Exit Order ExecutedCurrent Avg Price =Short
Exit Order ExecutedCurrent Avg Price =Short
Exit Order ExecutedCurrent Avg Price =Short
Comment
-
-
I would do something like this below -
Code:entryOrder = SubmitOrder(0, OrderAction.Buy, OrderType.Stop, 10000, 0, Close[0] + 200 * TickSize, "Scalp" + Instrument.MasterInstrument.Name, "BuyStop"); entryOrder2 = SubmitOrder(0, OrderAction.SellShort, OrderType.Stop, 10000, 0, Close[0] - 200 * TickSize, "Scalp" + Instrument.MasterInstrument.Name, "SellStop");
Comment
-
bertrand, adding the '+ Instrument.MasterInstrument.Name' seems to have fixed the problem at first glance. Perhaps it was getting confused somewhere with both contracts using the same name for multiple contracts?
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
647 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
369 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
108 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
572 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
573 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment