SQX 126 - MQ4 code does not handle deleting multiple stop/limit orders correctly

Hi Team,



Using SQX 126 to generate strategy on EUR/USD H1 timeframe, pseudo code contains:

int BarsValid = 3;

Order valid for BarsValid bars;
Duplicate trades: allowed;
Replacing pending orders: allowed;

So there are multiple pending orders placed, and each one is deleted after 3 bars if not executed.  Equity curve in SQX looks good, lots of trades placed.

Over to MetaTrader, using same Dukascopy data and Tick Data Suite, the results are completely different, not many trades executed.

Reason I believe:

MQ4 code deletes the pending order after 1 bar (or is deleting the wrong order), see attached screenshot of orders from backtest.

I have attached the strategy and MQ4 file and the SQX config.  They behave completely differently.  There is either a bug in the SQX backtester or the generated MQ4 file source.



Could you please try retest and backtest and see what is going on there?  

Any questions, please let me know.

Thanks,

Mike

PS I see the same issue on all strategies that contain Duplicate trades: allowed;  so I'm fairly sure MQ4 code is not handling this correctly when expiring pending orders...




Attachments
Build.cfx
(25.02 KiB)
Strategy 0121864.mq4
(205.31 KiB)
Deleting wrong order.png
(40.87 KiB)
Strategy 0121864.sqx
(146.70 KiB)
  • Votes +4
  • Project StrategyQuant X
  • Type Bug
  • Status Fixed
  • Priority Normal

History

m
#1

mikeyc

29.12.2019 13:01

Task created

m
#2

mikeyc

29.12.2019 13:01
Voted for this task.
KL
#3

kainc301

03.01.2020 17:05
Voted for this task.
m
#4

mikeyc

16.01.2020 19:18
Any update on this issue?  The strategies in SQX 126 that use multiple pending order look great, it would be really good if the MQ4 code is fixed so that it expires the correct order so that it matches SQX backtest.


To me this is a very important bug to fix.

b
#5

bentra

16.01.2020 20:22
Voted for this task.
h
#6

hankeys

17.01.2020 07:03
Voted for this task.
MF
#7

Mark Fric

23.04.2020 15:07
what you think is an expiration is only a modification of order SL/PT. If you change the EA parameter ModifyInsteadOfReplacing = true, then it wil not do it.


This setting has no effect on the backtest results. If the results in MT are different there will be a different problem, I have to ivestigate it.

TB
#8

Tomas Brynda

19.05.2020 09:45

Status changed from New to Fixed

I tried to backtest the strategy and the results in MT4 match with the results in SQ.

I tried both an MQL code from latest version and the source code attached, the results were equal.

When looking closer into the orders, the EA seems to be trading as expected.


The different results can be caused by different settings in EA and SQX or by settings ModifyInsteadOfReplacing = true in the EA. We have fixed this feature recently.


If you still have problems, please attach a screenshot of your EA's settings in MT4.


Best regards,

Tomas


Votes: +4

Drop files to upload

or

choose files

Max size: 5MB

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

...
Wait please