Reply

Question about data and backtesting

9 replies

clonex / Ivan Hudec

Customer, bbp_participant, community, sq-ultimate, contributor, author, editor, 271 replies.

Visit profile

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.

This results in a very fast backtesting with very good accuracy. However, for Stop or Limit orders the testing accuracy might not be sufficient and you should try more precise mode.”
 
Ok, so in generally I understand why higher TF are dangerous for backtesting stop limit orders. But it is possible to have completely different results ?
 
What do you recommend in case of developing strategies on 1H TF? I mean what is fastest but mos reliable method in case of test precision? I good to use data from broker ( IRONFX) direct in 1H TF or is this wrong way?
 
Thank You,

0

Mark Fric

Administrator, sq-ultimate, 2 replies.

Visit profile

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

0

SammyDoe

Customer, bbp_participant, community, 6 replies.

Visit profile

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.

0

Matusiak Adrian

Customer, bbp_participant, community, 300 replies.

Visit profile

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.

btn_viewmy_160x33.png

0

Mark Fric

Administrator, sq-ultimate, 2 replies.

Visit profile

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

0

SammyDoe

Customer, bbp_participant, community, 6 replies.

Visit profile

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?

0

Matusiak Adrian

Customer, bbp_participant, community, 300 replies.

Visit profile

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?

btn_viewmy_160x33.png

0

Mark Fric

Administrator, sq-ultimate, 2 replies.

Visit profile

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

0

SammyDoe

Customer, bbp_participant, community, 6 replies.

Visit profile

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?

0

Mark Fric

Administrator, sq-ultimate, 2 replies.

Visit profile

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

0

Viewing 9 replies - 1 through 9 (of 9 total)