if ( compare_doubles ( profit_in_pts, ( threshold * point ), digits ) >= 0 )
- Since PrIP (0.00037) ≱ TxP (0.003) but the if(bool) is true, your compare_doubles must be lying to you.
- There is no need for such functions if you understand the links in:
The == operand. - MQL4 programming forum 2013A ≥ B could be true or false at equality because of round off errors.
If the equality is not important (false when equal or true when not) just use A > B (don't worry about it.)
If the equality is important (must be true at A == B) use "definitely greater or equal": A - B > -Ε. (Note the minus.)
If the equality is important (must be false at A == B) use "definitely greater": A - (B) > Ε.
Where Epsilon (Ε) depends on what is being compared. For prices, use _Point/2.
Thanks William for your quick reply, you're my hero.
1. PrIP is about 8 x smaller than TxP in my screenshot.
Probably you right about the If (bool).
2. I need to study this, not sure if equality is important, will check it out a.s.a.p.
Thanks again for the great tip and "definitely greater or equal" functionality as well.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi, anyone out there who can help me with this?
I'm struggling with two nested IF statements for OP_BUY and OP_SELL situation as well.
The second IF statement always calls the user-defined function modify() even if the condition is not full filled.
e.g. profit_in_points (PrIP) is still smaller than "threshold x point" (TxP) , see screenshot.
Hope I've added the code correctly.
Appreciate your help,
Added part of the code here, just to be sure.