Open bar delay bug when running strategy in MT5

Open bar delay doesn't work in MT5 platform.
For example, if I input the value 120 to delay the daily open bar time by 120 minutes, orders still get executed at 00:00, instead of 02:00




I took a look inside the mql5 code, and found why this is happening, inside checkBarOpen() function (line 804 in the mql5 code for the attached strategy below), currentBarTime variable is assigned to the previous bar open time, instead of current bar open time, because index value 0 is used for mrate array, instead you should have used index value of 1, mrate array is a dynamic array with length of two FYI.
Arrays in mql5 are not indexed as timeseries by default, rightmost value in an array always gets the latest value.


After changing the index value from 0 to 1, everything works perfectly.


Hope that helps and get fixed in the next build.
Thanks

Attachments
Test.sqx
(19.09 KiB)
  • Votes +2
  • Project StrategyQuant X
  • Type Bug
  • Status New
  • Priority Normal

History

SR
#1

SixtoRod

12.08.2021 12:18

Task created

o
#2

Enric

14.08.2021 12:14
Voted for this task.
E
#3

Emmanuel

27.09.2021 16:42
Voted for this task.

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