I would like to ask, how to block invalid fills occuring on higher timeframes when
testing multi-timeframe strategy.
Example:
Have a simple multi-timeframe strategy + we are using managed mode for order handling.
We use 2 simple dataseries:
- 15 minutes (primary timeframe = BarsArray[0])
- 1 range (added dataseries for precise filling of orders = BarsArray[1]
To get precise entry fill - we use this method with specified dataseries with index 1 = that's the 1-range dataseries.
EnterLongLimit(1, false, DefaultQuantity, entryPrice, "");
But in contrast - as we were precisely filled in entry order - we were not precisely filled on exit orders = we got INVALID FILL on 15-min timeframe. (when bar closed, backtesting engine detected, that profit price was hit that 15-min bar). And this is the problem.
This occurs when the entry order and exit order prices are both within one 15 min bar. When 15-min bar closes - #onBarUpdate() method is called - an backtesting engine detects, that for example PT was hit. But in reality, the 15 min bar could never hit profit after entry.
Quick example:
EURUSD: 31.1.2011
Trade entry: SHORT 1.3665 + profit and stoplosss are both 20 ticks
Backtest reports invalid profit - due to M15 bar, that is so big, that it includes both entry and profit prices.
So my question is, how to fix this in managed mode?
- Is there any way, how to send profit and stoploss orders into the precise dataseries ?
- ( currently, SetProfitTarget(...) and SetStoploss(...) do not have any parameter into which dataseries should be the order sent)
- Or can I somehow ignore bigger dataseries, so it is now used in evaluating order fills?


Comment