Round numbers

[Deleted]
```       static double UpperRoundNumber, LowerRoundNumber;
for(int RoundUp = 1;RoundUp <5000;RoundUp++)
{
if(Digits ==5)
{
UpperRoundNumber=Bid+RoundUp*10*Point;
UpperRoundNumber=UpperRoundNumber*100000;
}
if(MathMod(UpperRoundNumber,50)==0 || MathMod(UpperRoundNumber,500)==0)
break;
Comment("UpperRoundNumber ",UpperRoundNumber);
}
```

Can somebody share with a code that looks for round numbers

at EA. One round number above bid and one round number below. Like 00 or 50.

I spent many many hours and no success.

Logically the code above should work and it does not.

Thank You.

1758

https://www.mql5.com/en/search

-BB-

[Deleted]

I'm not really clear on what you are trying to do, but does NormaliseDouble with the appropriate rounding digit not work?

Or

I guess you could multiply by the required factor, cast it to an int to drop off the remaining decimals and divide by the factor casting it back to a double. That will give you the lower round number so just add your step to get the upper round number.

It's maybe 'cos it's Friday, but I can't get my head around what your code is trying to do.

V

15

beats me..
1502

```int tmpvalue= Bid/Point;
tmpvalue=tmpvalue-(tmpvalue%50);
double LowerRound=tmpvalue*Point;
double UpperRound=(tmpvalue+50)*Point;```

not tested, but the idea should work on 4 digits broker

5

zzuegg:

not tested, but the idea should work on 4 digits broker

thanx works just fine