[MT4/MQL4] check equal or not conditions for double / double 值比較

bool checkDoubles(double a, double b, string check)
{
if(check==">"){
if (a - b > Point / 2)return(1);else return (0);
}else if(check=="<"){
if (b - a > Point / 2)return(1);else return (0);
}else if(check==">="){
if (a - b > -Point)return(1);else return (0);
}if(check=="<="){
if (b - a > -Point)return(1);else return (0);
}else if(check=="!="){
if (MathAbs(a - b) > Point / 2)return(1);else return (0);
}else {
Print("Sorry you've entered a wrong check value");
}
return (0);
}

Ref: https://www.mql5.com/en/forum/136997/page2#593570

留言

這個網誌中的熱門文章

[MT4/MQL4] Error Code / 程式錯誤代碼

Edit MQL4 on VSCode

[MT4/MQL4] Order Handle Guild / 訂單處理說明