If there is a gap by close to open, SQX execute the order between the close and the open!

Dear Mark Fric,



there is a big problem when there is a gap by the close to the open of a new day. For example we trade the DAX30, and in the attached picture you see a big gap between close and open of the following day. If there is a buy stop on the last candle of the previous day with a stop price between the close and the open, it is executed at this stop price, but this is not correct! In theory the order should be executed at the open price, not at the stop price.


The problem is that the backtest overestimate the trade: SQX believes that the order is executed at a better price than reality. I loss many euros understanding this problem with the real trading, sigh..


It's important to fix this issue: many backtest are overestimated, because of this issue.
Thank you,
Giuseppe Piloni

Attachments
gap2.png
(81.78 KiB)
  • Votes +5
  • Project StrategyQuant X
  • Type Bug
  • Status Fixed
  • Priority Normal

History

b
#1

beppil

12.04.2020 08:52

Task created

m
#2

Mariano

12.04.2020 12:49
Voted for this task.
h
#3

hankeys

12.04.2020 16:43
Voted for this task.
h
#4

hankeys

12.04.2020 16:45
reported by me many times ago...because its a crucial behavior of real accounts - and we need backtest as much reliable as its real performance


on demo accs there are gaps filling, but not on real accounts


i think it should be resolved but dont check this out

JK
#5

Insanity82007

13.04.2020 12:47
Voted for this task.
JK
#6

Insanity82007

13.04.2020 12:56

This is part of a wider issue with trade execution for SQX strategies.


You need to use the Time Range From and Time Range To settings in Trading Options to mitigate this issue.


IMPORTANT: Make sure to set Bars Valid Max to 1 under Order Types (part of Building Blocks) for Enter At Stop and Limit orders, or orders will open outside the time range you set for SQX backtests and in live trading!

h
#7

hankeys

13.04.2020 13:20
behavior of backtester (SQX) cant be problem of some setting time ragnes and bars valid


i dont want to have strategies only with some time range and bars valid to 1 - because bars valid set to 1 means one thing - every candle you will be sending to platform another 1 or 2 orders - so your platform will be everytime under pressure


there cant be trades filled to the gaps - this is the esence of the reliable backtest

h
#8

hankeys

13.04.2020 13:36
and second thing to beppil - its nonsense to trade stock indices without preventing weekly gaps - this is the way to loss your money very soon - your SLs will be skipped and your pending orders will be filled on different prices
h
#9

hankeys

13.04.2020 13:47

Attachment gap.jpg added

i came across some of my indices strategies and found out, that SQX is still filling to the GAP - so the basic reported problem many months ago is not still fixed


trade is fillend in the gap, where the price wasnt


it should be filled on the open price of the candle - not in the empty space - this is behavior of demo account, not reliable backtester

h
#10

hankeys

13.04.2020 13:47
fix to B127 needed
b
#11

beppil

14.04.2020 02:31
Voted for this task.
MF
#12

Mark Fric

16.04.2020 12:59

Status changed from New to Fixed

Attachment realistic_gaps_handling.png added

it was like thjis to be 100% compatible with MT4 backtester, but I added an optional trading option only for MT4 to handle this
m
#13

Mariano

16.04.2020 13:13
And MT5 ?
MF
#14

Mark Fric

16.04.2020 13:39
this is a specific problem of MT4 backtester. 


In MT5 it fills orders at real price.

h
#15

hankeys

17.04.2020 09:43
OK, but this is a problem of SQX backtester, not MT ones


if i try this strategy with MT5 engine, SQX still fills to the gap

MF
#16

Mark Fric

17.04.2020 10:21
SQ uses multiple backtesting engines - for MT4, MT5, TS, MC.


This was fixed for MT4 engine. Are you saying that it behaves like this also for MT5 engine?


I haven't tested it for MT5, but I looked at the code and if I'm not mistaken it uses real tick price in MT5 engine, so this shouldn't happen.


If it does do you have a strategy and data whene I can quickly see it?

h
#17

hankeys

17.04.2020 12:56

Attachment DE_15_801500125_S_LD_SQ3.sqx added

its reported for this strategy and ticket 1364 where is the gap...


if i take this strategy and retest it for the MT5(hedged) the gap filling is still there (ticket 1365)

h
#18

hankeys

22.04.2020 16:05
fixe only for entry - not for the exit on SL - if SL is hit in the gap, the filled price is in the gap - this is not good
MF
#19

Mark Fric

23.04.2020 08:14

Status changed from Fixed to Fixed, to be tested

you are right, I added it also for SL
Dw
#20

Diwi

26.04.2020 09:47
Voted for this task.
h
#21

hankeys

26.04.2020 10:52
please try SQX backtest also for MT5 engine - there is still gap filling 


data https://mega.nz/file/9wARyKCB#2qgPTHeq5NwfjH4y0cmqq43z-2m-d5GOP6RMj6kK10k

MF
#22

Mark Fric

01.07.2020 08:05

Status changed from Fixed, to be tested to In progress

TB
#23

Tomas Brynda

02.07.2020 09:39

Status changed from In progress to Fixed


Votes: +5

Drop files to upload

or

choose files

Max size: 5MB

Not allowed: exe, msi, application, reg, php, js, htaccess, htpasswd, gitignore

...
Wait please