help please

To add comments, please log in or register
Sercan Demir
131
Sercan Demir  
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).my ea doesnt do any action while it s working in 0.500 or 1.000.what is wrong with that fmod function.


whroeder1
17945
whroeder1  

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).

  1. 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

  2. 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; }
  3. Problems with MathMod/fmod
              Checking for Price multiples of 20 points to Pyramid trade - Best EA - MQL4 and MetaTrader 4 - MQL4 programming forum

  4. 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

  5. Doubles are rarely equal.
              The == operand. - MQL4 and MetaTrader 4 - MQL4 programming forum

  6. 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

  7. 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.
Sercan Demir
131
Sercan Demir  

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.

To add comments, please log in or register