Absolute absurdity of "array out of range" bug or not?
-
If you ever come across this error you have my condolences.
I had.
And it drone me fucking nuts.Here's what I've done to fix it.
Step 1: Isolate the issue.
Need to find what causing it. Best thing to do is delete chunks of block and test if you get the error. You narrow it down and down until you find your problem.Now this is standard way of doing it, but with "array out of range" is different. Issue could be a block like Ones Per Bar or in my case it was modify variable block that has only job, set stop loss price level to a StopLoss variable.
Step 2. Migrate the problematic block to other than OnTick tab so it would work correctly.
Step 3. (if step 2 didn't work) try different angle on the EA of how it should do things.
As long as that block was in the EA it give me error. The worst part you have no fucking clue what it means or what it wrong, Its like searching a needle in a stack of hay just you dont even know you looking for a needle.
Anyway what fixed my problem was to move the block from OnTick to OnTrade. Which made no sense since block was always accompanied by If Trade to get value when you have actual trade going on.
My theory this is compilation bug. It is weird that I have other projects and the same setup where these blocks are on tick and they work fine.
If anyone has had issues with it PLEASE post how to fixed it bellow. OR if you can explain what causes the issue. Any info on the matter!
I've spend 6 hours on this and went as far as to completely recreate EA but ended up with the same.

-
If you open the MQ file in editor and try to compile it, it will then call out the specific block with the problem. (future easier way to find problems)
-
yes but its shit use if you're not mql4 language literate and you don't know what you're looking at.
-
@william29 Thank you for sharing this info.
-
UPDATE:
I think I've found what's the issue with this error.Its directly tied wrong tab when selecting variable:
(in loop) Trade/Order in Loop - you can use that on any Tab. (needs testing)
(on Chart) Event Data - only on Chart tab.
(on Trade) Event Data - only on Trade tab.So if you (on Tick) want to get data from lets say (on Trade) Event Data it will give this error.
All you have to do is move that block that you use to get variable to correct tab.
It's silly and I never given much of a though a why there are specified tabs well now we know.
It would be good if admin would add some explanation.
-
@william29 said in Absolute absurdity of "array out of range" bug or not?:
UPDATE:
I think I've found what's the issue with this error.Its directly tied wrong tab when selecting variable:
(in loop) Trade/Order in Loop - you can use that on any Tab. (needs testing)
(on Chart) Event Data - only on Chart tab.
(on Trade) Event Data - only on Trade tab.So if you (on Tick) want to get data from lets say (on Trade) Event Data it will give this error.
All you have to do is move that block that you use to get variable to correct tab.
It's silly and I never given much of a though a why there are specified tabs well now we know.
It would be good if admin would add some explanation.
https://fxdreema.com/documentation/builder/expert-advisors
bottom of page. I guess I thought that was fairly common knowledge