Most of the time this strategy works fine, but once in a while the orders will get rejected and the strategy will terminate itself saying that one of my orders is on the wrong side of the market. Here is the data for one of these errors. The should have entered at market at 83.54, stop/target +/- 10 ticks. It got filled at 83.48 and the stop should have been at 83.38, target at 83.58, trail 12 ticks
Error:
"Sell stop or sell Stop limit orders can't be placed above the market. affected order: Sell 1 Stop @ 83.53"
Output Window:
########## New Trade (08Aug11 12:21:13) ##########
--- Started BuyMarketReverse
CL 09-11.122113 - BuyMarketReverse 1 @ 83.54 ---
>>> OrdeUpdate: Order='1109fd872ae34055880bbe6aefeeef3b/Sim101' Name='BuyMarketReverse
CL 09-11.122113' State=PendingSubmit Instrument='CL 09-11' Action=Buy Limit price=0 Stop price=0 Quantity=1 Type=Market Tif=Gtc OverFill=False Oco='' Filled=0 Fill price=0 Token='1109fd872ae34055880bbe6aefeeef3b' Gtd='1/1/0001 12:00:00 AM' <<<
>>> OrdeUpdate: Order='1109fd872ae34055880bbe6aefeeef3b/Sim101' Name='BuyMarketReverse
CL 09-11.122113' State=Accepted Instrument='CL 09-11' Action=Buy Limit price=0 Stop price=0 Quantity=1 Type=Market Tif=Gtc OverFill=False Oco='' Filled=0 Fill price=0 Token='1109fd872ae34055880bbe6aefeeef3b' Gtd='1/1/0001 12:00:00 AM' <<<
>>> OrdeUpdate: Order='1109fd872ae34055880bbe6aefeeef3b/Sim101' Name='BuyMarketReverse
CL 09-11.122113' State=Working Instrument='CL 09-11' Action=Buy Limit price=0 Stop price=0 Quantity=1 Type=Market Tif=Gtc OverFill=False Oco='' Filled=0 Fill price=0 Token='1109fd872ae34055880bbe6aefeeef3b' Gtd='1/1/0001 12:00:00 AM' <<<
>>> OrdeUpdate: Order='1109fd872ae34055880bbe6aefeeef3b/Sim101' Name='BuyMarketReverse
CL 09-11.122113' State=Filled Instrument='CL 09-11' Action=Buy Limit price=0 Stop price=0 Quantity=1 Type=Market Tif=Gtc OverFill=False Oco='' Filled=1 Fill price=83.48 Token='1109fd872ae34055880bbe6aefeeef3b' Gtd='1/1/0001 12:00:00 AM' <<<
Order Filled at: 83.48
>>> OrdeExecution: Execution='c6e90dae4c404858b8b527c224c4d254' Instrument='CL 09-11' Account='Sim101' Name='BuyMarketReverse
CL 09-11.122113' Exchange=Default Price=83.48 Quantity=1 Market position=Long Commission=0 Order='1109fd872ae34055880bbe6aefeeef3b' Time='8/8/2011 12:21:13 PM' <<<
>>> PositionUpdate <<<
### Standard Position Opened @ 83.4800
**NT** Strategy 'A0_TradeManager/f35c6b9b33db4301979131b11304ad4e' submitted an order that generated the following error 'OrderRejected'. Strategy has sent cancel requests, attempted to close the position and terminated itself.
8/8/2011 12:21:13 PM CancelAllOrders: BarsInProgress=0
>>> OrdeUpdate: Order='06617919bf8740fd980194ccb86ebe58/Sim101' Name='Profit target' State=PendingSubmit Instrument='CL 09-11' Action=Sell Limit price=83.58 Stop price=0 Quantity=1 Type=Limit Tif=Gtc OverFill=False Oco='c6e90dae4c404858b8b527c224c4d254-827' Filled=0 Fill price=0 Token='06617919bf8740fd980194ccb86ebe58' Gtd='1/1/0001 12:00:00 AM' <<<
@@@ Long Trail to 83.36 < 83.48
8/8/2011 12:21:13 PM Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='' Mode=Price Value=83.36 Currency=0 Simulated=False
8/8/2011 12:21:14 PM Entered internal SetStopTarget() method: Type=Target FromEntrySignal='' Mode=Ticks Value=10 Currency=0 Simulated=False
8/8/2011 12:21:14 PM Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='' Mode=Ticks Value=10 Currency=0 Simulated=False
>>> OrdeUpdate: Order='06617919bf8740fd980194ccb86ebe58/Sim101' Name='Profit target' State=Accepted Instrument='CL 09-11' Action=Sell Limit price=83.58 Stop price=0 Quantity=1 Type=Limit Tif=Gtc OverFill=False Oco='c6e90dae4c404858b8b527c224c4d254-827' Filled=0 Fill price=0 Token='06617919bf8740fd980194ccb86ebe58' Gtd='1/1/0001 12:00:00 AM' <<<
>>> OrdeUpdate: Order='06617919bf8740fd980194ccb86ebe58/Sim101' Name='Profit target' State=Working Instrument='CL 09-11' Action=Sell Limit price=83.58 Stop price=0 Quantity=1 Type=Limit Tif=Gtc OverFill=False Oco='c6e90dae4c404858b8b527c224c4d254-827' Filled=0 Fill price=0 Token='06617919bf8740fd980194ccb86ebe58' Gtd='1/1/0001 12:00:00 AM' <<<
>>> OrdeUpdate: Order='06617919bf8740fd980194ccb86ebe58/Sim101' Name='Profit target' State=PendingCancel Instrument='CL 09-11' Action=Sell Limit price=83.58 Stop price=0 Quantity=1 Type=Limit Tif=Gtc OverFill=False Oco='c6e90dae4c404858b8b527c224c4d254-827' Filled=0 Fill price=0 Token='06617919bf8740fd980194ccb86ebe58' Gtd='1/1/0001 12:00:00 AM' <<<
>>> OrdeUpdate: Order='06617919bf8740fd980194ccb86ebe58/Sim101' Name='Profit target' State=Cancelled Instrument='CL 09-11' Action=Sell Limit price=83.58 Stop price=0 Quantity=1 Type=Limit Tif=Gtc OverFill=False Oco='c6e90dae4c404858b8b527c224c4d254-827' Filled=0 Fill price=0 Token='06617919bf8740fd980194ccb86ebe58' Gtd='1/1/0001 12:00:00 AM' <<<
8/8/2011 12:21:14 PM Entered internal PlaceOrder() method at 8/8/2011 12:21:14 PM: BarsInProgress=0 Action=Sell OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='Close' FromEntrySignal=''
>>> OrdeUpdate: Order='bad669435d544624b562dfcc442b7392/Sim101' Name='Close' State=PendingSubmit Instrument='CL 09-11' Action=Sell Limit price=0 Stop price=0 Quantity=1 Type=Market Tif=Gtc OverFill=False Oco='' Filled=0 Fill price=0 Token='bad669435d544624b562dfcc442b7392' Gtd='1/1/0001 12:00:00 AM' <<<
>>> OrdeUpdate: Order='bad669435d544624b562dfcc442b7392/Sim101' Name='Close' State=Accepted Instrument='CL 09-11' Action=Sell Limit price=0 Stop price=0 Quantity=1 Type=Market Tif=Gtc OverFill=False Oco='' Filled=0 Fill price=0 Token='bad669435d544624b562dfcc442b7392' Gtd='1/1/0001 12:00:00 AM' <<<
>>> OrdeUpdate: Order='bad669435d544624b562dfcc442b7392/Sim101' Name='Close' State=Working Instrument='CL 09-11' Action=Sell Limit price=0 Stop price=0 Quantity=1 Type=Market Tif=Gtc OverFill=False Oco='' Filled=0 Fill price=0 Token='bad669435d544624b562dfcc442b7392' Gtd='1/1/0001 12:00:00 AM' <<<
>>> OrdeUpdate: Order='bad669435d544624b562dfcc442b7392/Sim101' Name='Close' State=Filled Instrument='CL 09-11' Action=Sell Limit price=0 Stop price=0 Quantity=1 Type=Market Tif=Gtc OverFill=False Oco='' Filled=1 Fill price=83.44 Token='bad669435d544624b562dfcc442b7392' Gtd='1/1/0001 12:00:00 AM' <<<
>>> OrdeExecution: Execution='d19230a13f934a6a9b8cc07d981865dc' Instrument='CL 09-11' Account='Sim101' Name='Close' Exchange=Default Price=83.44 Quantity=1 Market position=Short Commission=0 Order='bad669435d544624b562dfcc442b7392' Time='8/8/2011 12:21:15 PM' <<<
>>> PositionUpdate <<<
### Non-ATM Position Closed
(ATM_MGR) -- CL Reset --
Non-ATM Position Closed
8/8/2011 12:21:15 PM Disable() called: strategy disabled
8/8/2011 12:21:15 PM CancelAllOrders: BarsInProgress=0
**NT** Disabling NinjaScript strategy 'A0_TradeManager/f35c6b9b33db4301979131b11304ad4e'

Comment