Question about data and backtesting
9 replies
clonex / Ivan Hudec
9 years ago #112483
Hi,
maybe newbie question:
Im developing intraday strategy which would be use 1 H TF
In first attempts I was using hourly data imported from MT4 direct from IRONFX with method “Selected Timeframe Only”. The results were great and Strategies enters by stop. In another tests i have used tick data from dukascopy and results were completely different. In manual there is a section where is written
“Selected Timeframe only together with Trade On Bar Open it is the fastest testing mode. It uses only the main timeframe to simulate the prices.
Mark Fric
9 years ago #125894
Hello,
yes, stop and limit orders are usually filled inside the bar, and depending on your strategy it might be very inaccurate to test it with Selected timeframe precision.
The differences could really be very big.
I recommend you to use at least 1 minute, or tick simulation precision, and for the final tests use real tick data from Dukascopy.
Mark
StrategyQuant architect
SammyDoe
9 years ago #126928
Hi Mark,
could you please explain the difference between “Selected Timeframe only” and “Trade on Bar open”?
With “Selected Timeframe only” set for strategy generation on H1 data there are only trades entered AND closed at the full bar.
This means obviously, that also TP and SL are only executed at full bars,
I would have expected exactly that for “Trade on Bar open”.
So, again… What is difference between the two modes?
Thanks.
Matusiak Adrian
9 years ago #126930
Hello Sammy,
I think that “Selected Timeframe only” tests on open/close/high/low of bar, and “Trade on Bar open” test only at open of bar price.
But, it is only my opinion – please wait for Mark reply. Surley he will know it better.
Mark Fric
9 years ago #127013
yes, the difference is in Stop Loss, Profit Target handling.
Selected timeframe precision means that it uses the whole candle to determine if SL or PT was hit. If for example SL is triggered inside the candle it will be activated at the SL price level.
With Trade on bar open it checks if SL/PT is triggered only on bar open, so your trade will exit at price on bar open, not on exact SL level.
Trade on bar open is a very special mode and it should be used only if you knbow what you want.
You should use Selected timeframe precision for standard backtesting.
Mark
StrategyQuant architect
SammyDoe
9 years ago #127059
Mark, okay.
I got it basically..
But then it raises the question, why each and every trade is closed on the full hours for H1 generating, even if there was a SL or TP inside the bar.
All of this with Selected timeframe precision chosen.
This is refering to the trades list of the generated strategies.
Could this to be considered a bug in v3.7?
Matusiak Adrian
9 years ago #127067
So… do we have to use “selected timeframe only” with “Enter at market” only?
How co make then to strategy open orders only at new bar? Do we have to tick only “Open” at building blocks?
Mark Fric
9 years ago #127280
Sammy – this is strange, could you attach a strategy (.str) here? I’ll look at it, I don’t think there is a bug in SQ.
Adrian – no, you can use Selected timeframe with any order type, but f you want to open orders at the open of a new bar then you have to use Enter at market. Stop/Limit orders can open trades also inside the bar.
Mark
StrategyQuant architect
SammyDoe
9 years ago #127655
Ok Marc… a little late but here are the files.
The one called “Strategy1.2_selectedTimeframeOnly_precision.str” shows all trades closed always at full hours (which is not expected),
whereas file “Strategy1.2_1min_precision.str” shows trades closing with a minutes granularity (which is expected).
Could you please check this inconsistency?
Edit: Btw. now it seems to me that just the closing time reported is wrong for ‘selectedTimeframeOnly’,
since besides this difference all trades are the same in both files.
But then again the question comes up, why the trades are here exactly the same for both precision modes?
Where’s the difference here?
Mark Fric
9 years ago #127909
The one called “Strategy1.2_selectedTimeframeOnly_precision.str” shows all trades closed always at full hours (which is not expected),
but this is expected behavior. With “Selected timeframe” precision, backtester doesn’t look inside the bars, so it wouldn’t know when exactly the SL/TP was triggered.
It can only check if SL/TP was hit in this bar or not, but not when exactly, that’s why it uses full bar times.
Mark
StrategyQuant architect
Viewing 9 replies - 1 through 9 (of 9 total)