Array out of range at OnTradeDetector()
-
Recentrly encountered a problem when my FXDreema experts had crushed with "array out of range" error:
"2019.03.04 12:35:24.643 MyExpertMT5 (GOLD-3.19,M5) array out of range in '10848-53731.mq5' (20460,26)"When I checked the code it appeared to be Dreema's function: bool OnTradeDetector().
To be percise its 245 line:
if (EGV_PositionsList0[i].type != EGV_PositionsList[i].type)Has anyone had such a problem or knows how to cope with it?
-
Dear Sapiens,
I have a similar problem:
https://fxdreema.com/forum/topic/6858/big-problem-array-out-of-range-3297-29
I can not find a solution.
-
@dieter I'm also facing this issue

The tester raised the error on 688,29 line
2019.06.25 09:04:41.871 2015.01.26 00:00:01 Project1 US30,H4: array out of range in 'Project1.mq4' (688,29)
-
Same here. Error "array out of range" referring to the following lines:
UpdateEventValues(EGV_OrderList[OrdersTotal()-1],"new","");
or
if (EGV_PositionsList0[i].type != EGV_PositionsList[i].type)
or
if ((EGV_OrderList0[i].sl != EGV_OrderList[i].sl) && (EGV_OrderList0[i].tp != EGV_OrderList[i].tp)) {Same EA, different times. Unfortunately, this error can not be reproduced in Strategy Tester. Occures only in realtime trading (demo & real). Happens faster if more EAs are running at the same time. Found no solution so far. This stopped me from using fxDreema & EAs a long time ago.
-
@anse33 Square brackets refer to individual array elements. For example, array[1] will return the second element for an array, because the indexing starts at 0.
Now, if there are no open orders, OrdersTotal() will be 0.
This:
[OrdersTotal()-1]
will return value of -1. Arrays don't have negative indexes - its out of array range.Try adding a trade count filter before the block in question.