How to program that a stop or takeprofit is not close to a round number?
int distance=15; int multiplier=1; double pip_decimal=Point; if(Digits==3) { pip_decimal=Point*10; } if(Digits==5) { multiplier=100; pip_decimal=Point*10; } double round_number=MathRound(Bid*multiplier)/multiplier; if(MathAbs(round_number-Bid)>distance*pip_decimal) { //Do something } Print(DoubleToString(round_number,Digits));
I don't know if this is the best way to do it, but it should work
Hello guys, just as the subject. I have an EA and is not doing well in round numers (for example 1.1400 in EURUSD or 136.00 in EURJPY, etc). How can I define that when it´s close to a round number (for example 15 pips of that number) doesn't take the trade?.
Thanks in advance.