However, I'm still facing one problem I'm seeing to alleviate - please see the enclosed screen grab as an example.
So what you see on the chart is the 60-min feed. The blue outlined candle is the one that concludes the price pattern setup. The yellow outlined candles are the ones during which the strategy is allowed to entry. Now, the actual trigger was the low of the blue outlined candle, and it's clear that the first yellow one dropped below that mark.
However, due to the nature of how historic data is run by Ninja the first 60-min candle at 18:00:00 is COMPLETED before the strategy runs through the second tick series (i.e. series 1). This seems to shift the entry into the second hourly candle (19:00:00) as the entry per the historical data happens after 18:00:00:
4/22/2013 6:02:05 PM Entered internal PlaceOrder() method at 4/22/2013 6:02:05 PM: BarsInProgress=1 Action=SellShort OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='Short Position' FromEntrySignal=''
As you can see it entered at 18:02:05. Now in live tape it would have probably opened the first yellow candle at 18:00:00 and then taken an entry DURING the 18:00 candle. My problem is that the hourly candles DRIVE the tick based entry logic. Basically the hourly price pattern logic analyses the prior candles based on rules and then triggers a 'longTrigger' or 'shortTrigger' flag globally. That one is then picked up the next time the strategy runs through the tick based series (1) - all that's left then is for the tick series to wait for a push above/below the respective price triggers and to take an entry.
Again, all that works fine in live tape but during historical testing I'm seeing a shift on both the entry and exit side by one candle. The core of the problem appears to be that in live trading it would call the 18:00:00 hourly candle for the first time (FirstTickOfBar) and then call the 17:00:01 candle on the tick side, right? In historic trading it apparently (maybe I'm doing something wrong here) calls the 18:00:00 candle on series 0 only once after calling 17:59:59 on series 1. IF I'm not mistaken this is causing those shifted entries in historical simulation.
Confusing matters is that it sometimes takes it correctly. See here:
As you can see the entry is taken on the first candle as it should have. I looked at the tick data on the first chart and based on what I'm seeing it should have done the same. There clearly was a drop through the trigger price. Perhaps this is happening because I'm using single ticks and not seconds. Either way it's confusing ;-)
Is there any way to fix this? Is this a commonly known problem or did I perhaps screw things up somewhere? ANY input would be much very much appreciated
Comment