Wrong calculation of min allowed Stop Price if UseSQTickSize = false



I used the same exact instruments data to:

  1. Backtest in SQX
  2. Export Tick Data to MT4  applying the config file with the broker configuration (using QDM 121)
  3. Backtest in MT4

There is no mismatch between minDistanceMT and minDistanceSQ reported in the MT4 logs (and in fact the mql file contains the same Distance as the broker's)


Notwithanding this,  if UseSQTickSize is not set and MainChartTickSizeSQ is not set = to the Broker tick size, there is a complete mismatch between the MT4 and SQX backtesting.


The reason is that, despite the fact that no mismatch between minDistanceMT and minDistanceSQ, the Minimum Stop Price is wrongly calculated as if the tick size were 1 and not 0.01 (which is the broker one) and the order is not placed.


I believe that, as a default, the EA should take the tick size (as all the other data) from the market.
if one uses the exact same configuration for MT4 and SQX, he should not set any special flag to have the same results!
The flag should only be used if one consciously uses different tick sizes for testing in SQX and EA, to adjust all sensible parameters to the Broker Settings (e.g. Market Distance, Fixed SL, PT, Trailing STops, ...)


See logs below


===================================




With UseSQTickSize = true AND MainChartTickSizeSQ = 0.01 (same as backtest in SQX and export to MT4)


0 17:46:55.834 2021.01.06 09:00:00  H1 - NASDAQ WF Matrix - Strategy 3.56.169 UsaTec,H1: - SQ LOG 2021.01.06 09:00 Computing Money Management for order - Fixed amount
0 17:46:55.834 2021.01.06 09:00:00  H1 - NASDAQ WF Matrix - Strategy 3.56.169 UsaTec,H1: - SQ LOG 2021.01.06 09:00 Computing Money Management - Smallest_Lot: 0.20000000, Largest_Lot: 200.00000000, Computed LotSize: 1.00000000
0 17:46:55.834 2021.01.06 09:00:00  H1 - NASDAQ WF Matrix - Strategy 3.56.169 UsaTec,H1: - SQ LOG 2021.01.06 09:00 Money to risk: 200.00000000, Max Trade drawdown: 183.52000000, Point value: 1.00000000
0 17:46:55.834 2021.01.06 09:00:00  H1 - NASDAQ WF Matrix - Strategy 3.56.169 UsaTec,H1: - SQ LOG 2021.01.06 09:00 Opening order type BUY STOP with price 12593.60000000. Current market prices: 12527.60000000 / 12526.60000000
2 17:46:55.834 2021.01.06 09:00:00  H1 - NASDAQ WF Matrix - Strategy 3.56.169 UsaTec,H1: open #1 buy stop 1.00 UsaTec at 12593.6 ok
0 17:46:55.843 2021.01.06 09:00:00  H1 - NASDAQ WF Matrix - Strategy 3.56.169 UsaTec,H1: - SQ LOG 2021.01.06 09:00 Modifying order with ticket: 1, SL: 12410.10000000 and PT: 12742.90000000
2 17:46:55.843 2021.01.06 09:00:00  H1 - NASDAQ WF Matrix - Strategy 3.56.169 UsaTec,H1: modify #1 buy stop 1.00 UsaTec at 12593.6 sl: 12410.1 tp: 12742.9 ok
0 17:46:55.843 2021.01.06 09:00:00  H1 - NASDAQ WF Matrix - Strategy 3.56.169 UsaTec,H1: - SQ LOG 2021.01.06 09:00 Order modified successfuly
2 17:46:55.853 2021.01.06 09:52:04  Tester: order #1, buy 1.00 UsaTec is opened at 12593.6
2 17:46:55.957 2021.01.06 15:38:59  Tester: take profit #1 at 12742.9 (12745.5 / 12746.5)


With UseSQTickSize = false



0 17:52:10.861 2021.01.06 09:00:00  H1 - NASDAQ WF Matrix - Strategy 3.56.169 UsaTec,H1: - SQ LOG 2021.01.06 09:00 Computing Money Management for order - Fixed amount
0 17:52:10.861 2021.01.06 09:00:00  H1 - NASDAQ WF Matrix - Strategy 3.56.169 UsaTec,H1: - SQ LOG 2021.01.06 09:00 Computing Money Management - Smallest_Lot: 0.20000000, Largest_Lot: 200.00000000, Computed LotSize: 1.00000000
0 17:52:10.861 2021.01.06 09:00:00  H1 - NASDAQ WF Matrix - Strategy 3.56.169 UsaTec,H1: - SQ LOG 2021.01.06 09:00 Money to risk: 200.00000000, Max Trade drawdown: 183.52000000, Point value: 1.00000000
0 17:52:10.861 2021.01.06 09:00:00  H1 - NASDAQ WF Matrix - Strategy 3.56.169 UsaTec,H1: - SQ LOG 2021.01.06 09:00 Opening order type BUY STOP with price 12593.60000000. Current market prices: 12527.60000000 / 12526.60000000
0 17:52:10.861 2021.01.06 09:00:00  H1 - NASDAQ WF Matrix - Strategy 3.56.169 UsaTec,H1: - SQ LOG 2021.01.06 09:00 Based on its logic, the strategy tried to place stop/limit order at incorrect price. Market price: 12527.60000000, min. price allowed: 12602.60000000, stop/limit order price: 12593.60000000 (this is NOT an error)





Attachments
NASDAQ.zip
(415.27 KiB)
  • Votes +2
  • Project StrategyQuant X
  • Type Bug
  • Status Fixed
  • Priority Normal

History

MS
#1

mscapin95

07.12.2022 19:19

Task created

n
#2

notch

07.12.2022 20:34
Voted for this task.
E
#3

Emmanuel

12.12.2022 15:01
Voted for this task.
g
#4

Lee Guan Chuan

06.02.2023 04:38

Status changed from New to Waiting for information

Attachment image-0.png added

image-0.png
(138.65 KiB)
Hi mscapin95,


I have tested it on my side, and it works correctly. Can I ask for more information for further analysis?

Please take a look at the attached image. Please provide this. The left side is the information in the SQX itself, and the right is the information you get in MT4 (Strategy Tester -> Symbol Properties).


Thank you.

MS
#5

mscapin95

27.02.2023 16:25
Sorry, I have changed my broker and related settings in the meanwhile. I am no more able to re-test this
g
#6

Lee Guan Chuan

28.02.2023 02:34

Status changed from Waiting for information to Fixed

Hello mscapin95,


Since I have tested it, and it works correctly. I will mark this as fixed at the moment. Please let me know when the issue happens again.


Thank you.


Votes: +2

Drop files to upload

or

choose files

Max size: 5MB

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

...
Wait please