Devastater:
double sellpoints()
{if (fmod(Bid,0.500)==0 && Bid>a)
{return (1);}else return (0);}
i have this function.but the problem is that i cant set it to fmod(Bid,0.200).
- When you post code please use the SRC button! Please edit your post.
General rules and best pratices of the Forum. - General - MQL5 programming forum - Don't use int (or worse double) when you mean bool. Simplify your code. Why this always returns false? -
MQL4 and MetaTrader 4 - MQL4 programming forum
bool sellpoints(){ return fmod(Bid,0.500)==0 && Bid>a; }
- Problems with MathMod/fmod
Checking for Price multiples of 20 points to Pyramid trade - Best EA - MQL4 and MetaTrader 4 - MQL4 programming forum -
Floating point has infinite number of decimals, it's your not understanding
floating point and that some numbers can't be represented exactly. (like 1/10.)
Double-precision floating-point format - Wikipedia, the free encyclopedia - Doubles are rarely equal.
The == operand. - MQL4 and MetaTrader 4 - MQL4 programming forum - Decide how close price has to be. Exactly, try:
bool sellpoints(){ return MathAbs(Bid - MathRound(Bid,0.500) ) < _Point && Bid>a); }
MT4:NormalizeDouble - General - MQL5 programming forum
How to Normalize - Expert Advisors and Automated Trading - MQL5 programming forum - Hard coding constants (0.500) means your code breaks on other symbols. If you mean 50 pips on JPY pair, code it that way (Link № 6.) If you mean 5 ticks, code it that way.
I m new here,also in programming and trading.i have some ideas and trying to make my own ea.its hard to solve problems with books.thank you 4 your help.

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
{return (1);}else return (0);}
i have this function.but the problem is that i cant set it to fmod(Bid,0.200).my ea doesnt do any action while it s working in 0.500 or 1.000.what is wrong with that fmod function.