I am still struggling with what seems to be some backtesting problems. I have narrowed down one such issue as much as I can to make it as simple as I can and need some help.
Run strategy with backtest period of 1/1/08 - 1/10/08
Result is 3 trades taken.
If I run the same strategy and add additional days, such as 12/1/07 - 1/10/08, now only 2 trades are taken from 1/1/08 to 1/10/08. One trade is missing, on 1/9/08.
I have TraceOrders enabled. There is no mention of why the missing trade was not taken.
The missing trade in this example is this one (showing output log):
1/9/2008 1:59:00 PM Entered internal PlaceOrder() method at 1/9/2008 1:59:00 PM: Action=Buy OrderType=Limit Quantity=1 LimitPrice=1400.25 StopPrice=0 SignalName='long 1 es' FromEntrySignal=''
1/9/2008 1:59:00 PM Entered internal SetStopTarget() method: Type=Stop FromEntrySignal='long 1 es' Mode=Price Value=1394.45766889127 Currency=0 Simulated=False
1/9/2008 1:59:00 PM Entered internal SetStopTarget() method: Type=Target FromEntrySignal='long 1 es' Mode=Price Value=1406.04233110873 Currency=0 Simulated=False
1/9/2008 2:06:00 PM Cancelled pending exit order, since associated position is closed: Order='NT-00001/Back101' Name='Stop loss' State=Working Instrument='ES ##-##' Action=Sell Limit price=0 Stop price=1394.5 Quantity=1 Strategy='live_ES_smacross_long1' Type=Stop Tif=Gtc Oco='NT-00000' Filled=0 Fill price=0 Token='df49e7e2c58348128024035f84fa2672' Gtd='12/1/2099 12:00:00 AM'
1/9/2008 2:06:00 PM Cancelled OCO paired order: BarsInProgress=0: Order='NT-00001/Back101' Name='Stop loss' State=Cancelled Instrument='ES ##-##' Action=Sell Limit price=0 Stop price=1394.5 Quantity=1 Strategy='live_ES_smacross_long1' Type=Stop Tif=Gtc Oco='NT-00000' Filled=0 Fill price=0 Token='df49e7e2c58348128024035f84fa2672' Gtd='12/1/2099 12:00:00 AM'
1/9/2008 2:06:00 PM Cancelled expired order: BarsInProgress=1: Order='NT-00001/Back101' Name='Stop loss' State=Cancelled Instrument='ES ##-##' Action=Sell Limit price=0 Stop price=1394.5 Quantity=1 Strategy='live_ES_smacross_long1' Type=Stop Tif=Gtc Oco='NT-00000' Filled=0 Fill price=0 Token='df49e7e2c58348128024035f84fa2672' Gtd='12/1/2099 12:00:00 AM'
The more days I add, the more missing trades that occur.
I've attached a video illustrating the missing 1/9/08 trade, since it is the simplest example.
I should also mention that if days are added AFTER the period, instead of before, the issue doesn't exist. For instance, if I run the period of 1/1/08 to 11/26/08, the total number of trades are 99.
However, if I run 1/1/07 (one year prior) to 11/26/08 (same end date), the total number of trades are 93 --- so six trades go missing over various time frames.
This increases more if I add an extra year, and so on.
Video:
http://www.mgbi.net/ninja/missingtrade.wmv - Video 1m 39s, 8.72MB
Thank you -- and Happy Thanksgiving!
Comment