
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
If I understand you correctly, I assume you want it to be true for less or equal 3 pips, so a check for lower than 3.5 pips will yield the right result with some leeway for misrepresentation of the figures.
Markus
if (.... && (ma1-ma2)< 3.5*Point) {
}
Markus
If I understand you correctly, I assume you want it to be true for less or equal 3 pips, so a check for lower than 3.5 pips will yield the right result with some leeway for misrepresentation of the figures.
Markus
You can use the following:
StrToDouble(DoubleToStr(ma1-ma2, 4))<0.0003
where (ma1-ma2) result will be rounded to 4 dec. points.
i.e. 0.00035 will be 0.0004
and 0.00034 will be 0.0003
The problem could be that if the string is converted back to double for comparism it may still have no precise representation in the double format and the problem may start all over.
Markus
gonna check other situations to see if it really works
strange thing it also removed one good signal where ma20 was 3 pips away from ma34
I adjusted the value so that that signal wouldn't be removed and I ended up with 0.00037 pips...
final solution (I think!) is the code Shimodax provided and that returns only the correct signals:
int maval= 0,
ma20inpips= MathRound(ma20/Point),
ma100inpips= MathRound(ma100/Point),
if (ma20>=ma34 && (ma20inpips-ma100inpips<4))
maval= 1;
else
if (ma20<=ma34 && (ma100inpips-ma20inpips<4))
maval=-1;
else
maval= 0;
Thanks a lot everyone!!!! :-)