This is the frequently encountered limitation of Print()
It is limited to 4 decimal places, so use DoubleToString() to get round this - see https://docs.mql4.com/common/Print
Good Luck
-BB-

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,
I have an EA where one of the requirements for making a trade is a 3-bar trend in a MA. For example, the code to check for a sell is:
MACurrent=iMA(NULL,0,MATrendPeriod,0,MODE_EMA,PRICE_CLOSE,0);
MAPrevious=iMA(NULL,0,MATrendPeriod,0,MODE_EMA,PRICE_CLOSE,1);
MAPrevious2=iMA(NULL,0,MATrendPeriod,0,MODE_EMA,PRICE_CLOSE,2);
if (MACurrent<MAPrevious && MAPrevious<MAPrevious2) // MA in a downtrend
{
return(2); // Short signal
}
When I output the values for analysis, there are occasions where I get a short signal, but the values look like this:
MACurrent = 1.4086
MAPrevious = 1.4087
MAPrevous2 = 1.4087
Since MAPrevious is not less than MAPrevious2, I should not have gotten a short signal. What's up? When comparing MA values in code, does it go out to more than 4 decimal places, but only display 4 when I output the values?
Thanks for your help.