The article you need to read is
https://www.mql5.com/en/articles/1393
Sadly, the indicator features you are trying to use won't work in an EA.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello everyone:
I'm new to MQL programming. I have code that's working perfectly fine as an indicator but when I convert it, I'm running into an odd issue. I'm not getting my arrays to set to any values in the latter.
I define a Type Double Array and am using the High() function to define some custom fractals. I store the values in the array. This same code in an indicator prints correct values but in the EA it returns values of 0.
if(nCountedBars<=2)
i=Bars-nCountedBars-3;
if(nCountedBars>2)
{
nCountedBars--;
i=Bars-nCountedBars-1;
}
//----Up and Down Fractals
while(i>=2)
{
//----Fractals up
bFound=false;
dCurrent=High[i];
if(dCurrent>High[i+1] && dCurrent>High[i-1] && dCurrent>High[i-2])
{
bFound=true;
ExtUpFractalsBuffer[i]=dCurrent;
Print("here 4 ", dCurrent, " ", ExtUpFractalsBuffer[i]);
}
In the indicator this retrieves values where dCurrent is equal to ExtUpFractalsBuffer[i]. In the EA, no such luck. I get 0s. Did I forget to do something?