Here is my SetStopLoss code:
SetStopLoss( stop_loss_max*100, true );
Print("Stop loss max: " + stop_loss_max*100);
Here is my output from TraceOrders (and my prints):
8/12/2013 5:15:47 PM Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='' Mode=Ticks Value=0 Currency=500 Simulated=True
Stop loss max: 500
**NT** Enabling NinjaScript strategy 'ThreefoldChannel/0176477218dc44cc91924a5c2ce95e07' : On starting a real-time strategy - StrategySync=SubmitImmediately SyncAccountPosition=False EntryHandling=AllEntries EntriesPerDirection=1 StopTargetHandling=ByStrategyPosition ErrorHandling=StopStrategyCancelOrdersClosePositio ns ExitOnClose=False Set order quantity by=DefaultQuantity ConnectionLossHandling=KeepRunning DisconnectDelaySeconds=10 CancelEntryOrdersOnDisable=True CancelExitOrdersOnDisable=True CalculateOnBarClose=True MaxRestarts=4 in 5 minutes
Period type: Minute
12/11/2012 3:30:00 PM Entered internal PlaceOrder() method at 12/11/2012 3:30:00 PM: BarsInProgress=0 Action=SellShort OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='S1' FromEntrySignal=''
EnterShort
12/11/2012 4:00:00 PM Cancelled order due to end of session handling: BarsInProgress=0: Order='NT-00001/Sim60' Name='Stop loss' State=Working Instrument='ES 09-13' Action=BuyToCover Limit price=0 Stop price=1419.5 Quantity=1 Strategy='ThreefoldChannel' Type=Stop Tif=Day Oco='NT-00000-1763' Filled=0 Fill price=0 Token='9e8bba6dc96b49dabe42330501ba7cbe' Gtd='12/1/2099 12:00:00 AM'
12/12/2012 10:30:00 AM Entered internal PlaceOrder() method at 12/12/2012 10:30:00 AM: BarsInProgress=0 Action=Buy OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='L1' FromEntrySignal=''
EnterLong
Ignore EnterShort: 12/12/2012 4:00:00 PM
12/12/2012 4:00:00 PM Cancelled order due to end of session handling: BarsInProgress=0: Order='NT-00004/Sim60' Name='Stop loss' State=Working Instrument='ES 09-13' Action=Sell Limit price=0 Stop price=1404.25 Quantity=1 Strategy='ThreefoldChannel' Type=Stop Tif=Day Oco='NT-00002-1763' Filled=0 Fill price=0 Token='6b4c296bfce54e03965bc289848bedef' Gtd='12/1/2099 12:00:00 AM'
Ignore EnterLong: 12/17/2012 4:00:00 PM
12/21/2012 11:30:00 AM Entered internal PlaceOrder() method at 12/21/2012 11:30:00 AM: BarsInProgress=0 Action=SellShort OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='S1' FromEntrySignal=''
EnterShort
12/21/2012 3:30:00 PM Entered internal PlaceOrder() method at 12/21/2012 3:30:00 PM: BarsInProgress=0 Action=Buy OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='L1' FromEntrySignal=''
EnterLong
12/21/2012 3:30:00 PM Cancelled pending exit order, since associated position is closed: Order='NT-00007/Sim60' Name='Stop loss' State=Working Instrument='ES 09-13' Action=BuyToCover Limit price=0 Stop price=1420.75 Quantity=1 Strategy='ThreefoldChannel' Type=Stop Tif=Day Oco='NT-00004-1763' Filled=0 Fill price=0 Token='e5ff17e92de3471e9fee2eba767058e3' Gtd='12/1/2099 12:00:00 AM'
12/21/2012 4:00:00 PM Cancelled order due to end of session handling: BarsInProgress=0: Order='NT-00010/Sim60' Name='Stop loss' State=Working Instrument='ES 09-13' Action=Sell Limit price=0 Stop price=1404 Quantity=1 Strategy='ThreefoldChannel' Type=Stop Tif=Day Oco='NT-00006-1763' Filled=0 Fill price=0 Token='e3fdd55bb1a446dea41b61433d7bc399' Gtd='12/1/2099 12:00:00 AM'
12/24/2012 10:30:00 AM Entered internal PlaceOrder() method at 12/24/2012 10:30:00 AM: BarsInProgress=0 Action=SellShort OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='S1' FromEntrySignal=''
EnterShort
12/24/2012 1:30:00 PM Cancelled order due to end of session handling: BarsInProgress=0: Order='NT-00013/Sim60' Name='Stop loss' State=Working Instrument='ES 09-13' Action=BuyToCover Limit price=0 Stop price=1421 Quantity=1 Strategy='ThreefoldChannel' Type=Stop Tif=Day Oco='NT-00008-1763' Filled=0 Fill price=0 Token='50003af07b3041b8996c5cde2799836d' Gtd='12/1/2099 12:00:00 AM'
Ignore EnterLong: 12/31/2012 4:00:00 PM
1/3/2013 10:30:00 AM Entered internal PlaceOrder() method at 1/3/2013 10:30:00 AM: BarsInProgress=0 Action=BuyToCover OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='ES1' FromEntrySignal='S1'
ExitShort
****
The trade on 12/24/12 is short from 1411. The trade on 1/3/13 exits the short at 1445.2 for a loss of over $1700. My SetStopLoss is for $500, but does not get triggered.
Comment