Problem with mt 4 exits sqx 130 dev2

Hello,

additional info you can find here  [GRG-CMPWL-091]
I'll describe the problem briefly here...
strategies have exits mismatch on mt4 and sqx
1) Generated tons of strategies on 129 dev 2 (was the most stable version of sqx for me) 
had the following situation there:
entry and exit are the same and correct on mt4 and sqx (green) 

entry is ok but exit is not (light yellow) 
entry is not ok, exit is not ok but strategies take the same pips
nor entry nor exit are ok.  
You can find all strategies on email. 
2) I've deleted all these strategies from 129 dev 2 and returned to the  "old" portfolio and retested them with 130 dev 2. Also, I've updated indicators.
From 31 trades last week I have a great entry accuracy on "old" portfolio. 31 of 31!
29/31 exits were accurate. However 2 of trades closed earlier then they should (rows in yellow). One gbjpy strategy closed in 30 m and one nzdchf strategy in 15h.  (excel file and sqx are attached)
I would like to ask you to investigate these strategies further as you can see other strategies work fine. It will be great if we can find what is the problem here.  
Thank you in advance!
Attachments
Strategy 0183732 - Optimization 014940.sqx
(64.53 KiB)
Strategy 0334939 - Optimization 030608.sqx
(54.26 KiB)
3011-512.xlsx
(21.98 KiB)
  • Votes +3
  • Project StrategyQuant X
  • Type Bug
  • Status Fixed
  • Priority Normal

History

VO
#1

GRoundofInferno

07.12.2020 14:13

Task created

h
#2

hankeys

07.12.2020 16:34

Attachment EJ_30_203012980_S_HH_CF_SQX_EQ___BTvsREAL.png added

Attachment EJ_30_203032101_S_BB_CF_SQ4_EQ___BTvsREAL.png added

EJ_30_203012980_S_HH_CF_SQX_EQ___BTvsREAL.png
(37.65 KiB)
EJ_30_203032101_S_BB_CF_SQ4_EQ___BTvsREAL.png
(40.71 KiB)
i am trading SQX strats for longer than a year and making this comparaion curves - your backtest will never match precisely to the results on demo or real account


in backtest we will never simulate everything what could happen on our trading platforms - 1 pip difference could lead to a trade or not trade, 1pip difference could be profit on backtest and loss on real account and vice versa


so some comparation will look very good, some of them will be more distorted


so i think its only a coincidence of what we are doing - our backtest is only some sort of simulation

VO
#3

GRoundofInferno

07.12.2020 16:44
Hello hankey! 

Thank you for your comment.

I agree with you in some way. We always need to have some reserve in pips and slippage. 

However, here is the problem that strategies were closed regardless of stop-loss or take-profit level. Probably other exit algorithm triggered there. 

Please have a look at my excel file. How accurate were other strategies. I am not talking about taking exactly the same amount of pips. SQX has slippage settings which I use quite conservatively. 

But here I think something wrong with exit logic.

Or if it used other exit logic rather then stop loss/ take profit is it better to use only those block for exits as they are quite accurate according to my previous week?

TB
#4

Tomas Brynda

08.12.2020 11:27

Status changed from New to Refused

Hi,

from the xlsx file I am unable to tell you why the differences occured. 

In the gbpjpy case, there was probably a difference in PT calculation, because the opening prices don't match and so the ATR won't match too.


If you will find more examples, please attach the exact data exported from your trading platform and we can try to investigate it. But it will be problematic. 

As Hankeys said, there are always some discrepancies between backtest and real trading. A lot of things can happen in real time.


Best regards,

Tomas

VO
#5

GRoundofInferno

09.12.2020 12:39
Thanks for your reply, Tomas!

For me, it is not clear why any difference should be if we use tick precise on SQX and on mt4 during real trading? 

Also, it is not a backtest-it is a forward test on a particular the same dukascopy ticks. 

On nzdchf trade the entry is similar on both trades but exits are different. Why?

Also, it is the question why difference entrance points in gbpjpy pair. 

And if we have discrepancies why other 29 trades ok here?




TB
#6

Tomas Brynda

09.12.2020 15:54
I'm a little confused now as I don't know what data you actually used when comparing both results.


But you can try one thing that will reveal where the problem lies:

  1. Export last few months tick data from your MetaTrader - Use our strategy located in custom_indicators\MetaTrader4\Experts\SQ_TickDataExportEA.mq4 and backtest it in your terminal on the same symbol you want to analyze. Choose a time range and use Every tick precision.
  2. Create a new symbol and import the data exported from MT into SQ - you can locate the output csv file containing the data in MT's data folder.
  3. Run a tick backtest in SQ using the new symbol - then you will see if SQ results match with what you got in MT. The results should match with your MT results

Don't forget to set the right spread and min distance in SQ's data settings

VO
#7

GRoundofInferno

12.12.2020 20:35

Attachment 7-1112.xlsx added

Attachment list of errors .xlsx added

Attachment image-0.png added

Attachment image-1.png added

Attachment Strategy 0137338 - Optimization 07947.sqx added

Attachment Strategy 0441550.sqx added

Attachment Strategy 04556989 - Optimization 026596.sqx added

Attachment Strategy 01401.sqx added

Strategy 0441550.sqx
(60.24 KiB)
Strategy 0137338 - Optimization 07947.sqx
(42.58 KiB)
image-0.png
(7.03 KiB)
Strategy 04556989 - Optimization 026596.sqx
(92.77 KiB)
Strategy 01401.sqx
(76.32 KiB)
image-1.png
(32.62 KiB)
list of errors .xlsx
(15.20 KiB)
7-1112.xlsx
(28.53 KiB)
Dear Tomas,

I am using Dukascopy Data for SQX and trading.

I am comparing entries and exits every week on Saturday and evaluating how accurate they were.

I take trades from mt 4 and trades from SQX and merge them in QA, after that I exporting trade lists and combining them in xls file so I can see dates, entries, exits and length of the trades.

As you can see from my previous excel file (3011-512.xls) it has almost perfect matches.

I've added other strategies for AUDCAD,AUDNZD,CADJPY for the current week (7.12-12.12) and left strategies from previous week for other pairs. 

As you can see in the latest xls files (7-11.12 attached) there are a lot of inaccuracies in exits. Was last week to volatile so I have so mismatches?


Also, I found some errors in journal (list of errors attached) 

Don't like these things 

11.12.2020 22:59 '1723776143': order #3816596 sell 0.04 AUDNZD closing at 0.00000 failed [Invalid parameters]
11.12.2020 22:59 '1723776143': order #3820811 buy 0.09 NZDCHF closing at 0.00000 failed [Invalid parameters]

and 


2020.12.07 21:43:38.044 '1723776143': modification of pending order #3806323 sell stop 0.03 EURGBP at 0.90653 sl: 0.92223 tp: 0.90233 -> price: 0.90654 sl: 0.00000 tp: 0.00000 failed [Common error]
07.12.2020 21:43 '1723776143': modification of pending order #3806323 sell stop 0.03 EURGBP at 0.90653 sl: 0.92223 tp: 0.90233 -> price: 0.90654 sl: 0.00000 tp: 0.00000 failed [Common error]
07.12.2020 21:43 '1723776143': modification of pending order #3806323 sell stop 0.03 EURGBP at 0.90653 sl: 0.92223 tp: 0.90233 -> price: 0.90654 sl: 0.00000 tp: 0.00000 failed [Common error]
2020.12.07 21:43:41.097 '1723776143': modification of pending order #3806323 sell stop 0.03 EURGBP at 0.90653 sl: 0.92223 tp: 0.90233 -> price: 0.90654 sl: 0.00000 tp: 0.00000 failed [Common error]
07.12.2020 21:43 '1723776143': modification of pending order #3806323 sell stop 0.03 EURGBP at 0.90653 sl: 0.92223 tp: 0.90233 -> price: 0.90654 sl: 0.00000 tp: 0.00000 failed [Common error]
07.12.2020 21:43 '1723776143': modification of pending order #3806323 sell stop 0.03 EURGBP at 0.90653 sl: 0.92223 tp: 0.90233 -> price: 0.90654 sl: 0.00000 tp: 0.00000 failed [Common error]

Yes, error with invalid parameters related to Friday close at 23 00 but what is Common Error 



Also I did backtest as you said. I've exported data from MT4 (which is not reliable as Meaquotes combines and merges data with Dukascopy data but for research purposes it is ok) and SQX and MT4 shows almost the same results, however, there are small number unmatched trades on both platforms.  It leads that it is ok to have some unmatches but I have them quite a lot in 7-1112 xls file. So there are two finding here.

1) I am cursed and unlucky that I have all these "normal" unmatched trades happened at the same time from dozens of strategies I have. What is theoretically and statistically possible OR

2) Something is wrong


Moreover

When you asked me to backtest strategies on tick on MT4 I found that some strategies have errors when backtested on ticks.

e.g

2020.12.12 21:52:37.120 2019.04.09 04:00:00  Strategy 0.1401 EURJPY,M30: OrderSend error 131

2020.12.12 21:52:34.306 2020.11.06 21:00:00  Strategy 0.137338 - Optimization 0.7.947 EURUSD,M30: OrderSend error 131

2020.12.12 21:51:27.010 2020.11.05 12:00:00  Strategy 0.4556989 - Optimization 0.26.596 NZDCHF,M30: OrderSend error 131

2020.12.12 22:18:08.570 2019.01.07 05:00:00  Strategy 0.441550 USDCHF,M30: OrderModify error 130

(strategies attached )

But they are ok when I backtest them with control point model on MT4 

________________________

I am not confident in other exits then stop loss/ take profit.

I've generated a lot of strategies but I can not separate which blocks are used for exit in 10000 of strategies/

Probably it will be great to have some sort of filter or thing which can help you sort your existing strategies by entry or exit blocks. 


I had so precise past week and so unmatched this week.

Don't know what to do actually. 

As usual, I hope you can help.

Thanks 

TB
#8

Tomas Brynda

14.12.2020 07:07

Status changed from Refused to In progress

VO
#9

GRoundofInferno

19.12.2020 13:54

Attachment 14-1912.xlsx added

14-1912.xlsx
(23.48 KiB)
my weekly update for you. still a lot of differences in exits 

added close types for you to help

btw data format is different when export it to csv from QA and SQX 

o
#10

Enric

24.12.2020 20:23
Voted for this task.
VO
#11

GRoundofInferno

10.01.2021 18:05

Attachment 0401-8012021.xlsx added

0401-8012021.xlsx
(21.43 KiB)
Hi Tomas,

it was long 3 weeks and here is my new update regarding exits.

With help of the clonex exit snippets and improver feature I have changed all exits to stop-loss/take-profit/friday at 10 pm only.

And I have much more reliable exits then I have before. Moreover, the accuracy is quite good. So my theory is correct that we need rely only on the simplest way of exits. 

This shows that probably no problem from my side and we need to find what was wrong with those strategies and their exits. 

thank you in advance 

TB
#12

Tomas Brynda

11.01.2021 09:27
Hi Valery,

thank you for the statistics. I am comparing the results between SQ and trading platforms quite often and I can't find anything wrong with the exits.

I am performing the tests on the exact same data and it is not a live trading. But the exits should work well.


You said earlier that when you performed a tick backtest using data exported from your MT4, that it almost matched. 

I will try to make more backtests using your strategies. But it looks like there is some difference in data between SQ and your terminal.


During live trading, there are more factors involved - slippage, varying spread, internet connection etc. 

A price difference of just 1 tick may cause the exit not to trigger, I think that is the cause of the differences.

VO
#13

GRoundofInferno

16.01.2021 10:39

Attachment 11-150121.xlsx added

11-150121.xlsx
(17.71 KiB)
Hi Tomas, here is a quick update of my previous week. 

As you can see here my theory is working and exits with stop-loss and take profit works fine.

But I found another issue with Friday exits. EA can't close open position without my presence on trading computer ( I agree it sounds weird).

I've made screenshots and tried to describe the problem here https://roadmap.strategyquant.com/tasks/sq4_7599

excel stat for last week here as well

g
#14

geektrader

19.01.2021 09:57
Voted for this task.
g
#15

geektrader

19.01.2021 10:02
I am also still seeing many differences in trades when backtesting between SQ and MT4 and of course while using the same data. Please try to address this, as without that being correct, the whole strategy generating is pointless.
VO
#16

GRoundofInferno

23.01.2021 11:47

Attachment 11-2201.xlsx added

11-2201.xlsx
(25.50 KiB)
11.01-22.01 trades with stop loss and take profit exits. 

I can see that it is normal behaviour but will not try another type of exits as there is no trust in them. Finally, I have quite close results 

h
#17

hankeys

24.01.2021 10:34
send here some SQX files and i can make the comparation for you
VO
#18

GRoundofInferno

30.03.2021 14:39
Hi Tomas,

I have sent a new update of my trading result to the support email. As you can see there it's matching well.

However my previous trades stated here didn't have such accuracy. 

Please have a look. 

TH
#19

Tomas Hruby

30.03.2021 17:38

Attachment exitstoTomas.xlsm added

exitstoTomas.xlsm
(43.61 KiB)
Hello Tomas,
here you can find that strategies match well. 
Still could not get why my previous portfolio had trouble with exits.
It is great that it is accurate right now, but I need to know what was wrong so I know how to move further with portfolio update.

Thank you for you valuable work!

Valeriy

TB
#20

Tomas Brynda

04.04.2022 10:59

Status changed from In progress to Fixed

I think we can close this task as it is very difficult to tell what was the initial reason of the backtest mismatches.

A few improvements of both MQL code and SQX code were done since that time and it may be the reason why the results are matching now.


Thank you for your feedback. If you experience any problems with backtests in the future, let me know and I'll check that.


Best regards,

Tomas


Votes: +3

Drop files to upload

or

choose files

Max size: 5MB

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

...
Wait please