# How to find whether price is ranging between the values 000 to 050(5 digit broker)?

7401

I would like to get, whether the price is below 1.1200 and above 1.1150 (4 digit)

price is below 1.12000 and above 1.11500 (5 digit)

how to get it to know?

eg:

At 10:00 AM i would like to see the market, when market price is ranging between 1.1150 to 1.1200 my condition is true. how to know by mql code?

if market is above 1.13 i want to check whether the price is ranging between 1.1350 to 1.1400

so my condition is we must check(validate) the price with last 2(4 digit) or 3(5 digits) digits?

16098

sheriffonline: I would like to get, whether the price is below 1.1200 and above 1.1150 (4 digit)
Not tested
```double price = Bid;                                       // 1.11xxx
double next100 =  round_up( price, pips_to_change(100) ); // 1.1200
double prev50  =  next100 - pips_to_change(50);           // 1.1150
if(prev50 <= price) // current price is above 1.1150
```
Not tested
```double   round_down(    double v, double to){   return to * MathFloor(v / to); }
/// Round a double to a multiple of an amount.
double   round_up(      double v, double to){   return to * MathCeil( v / to); }
/// Round a double to a multiple of an amount.
double   round_nearest( double v, double to){   return to * MathRound(v / to); }

int      pips_to_points(double n){           if( (_Digits&1) == 1)   n *= 10.0;
return int(n);                    }
double   points_to_change(int n){            return n * _Point;                }
double   pips_to_change(double n){  return points_to_change(pips_to_points(n));}
```
7401

WHRoeder:

```double price = Bid;                                       // 1.11xxx
double next100 =  round_up( price, pips_to_change(100) ); // 1.1200
double prev50  =  next100 - pips_to_change(50);           // 1.1150
if(prev50 <= price) // current price is above 1.1150```

I am unable to understand the logic.

pips-to_change is array to declare as variables?

can you explain brother?

16098

Look at the post closer.
7401

WHRoeder:
Look at the post closer.

yes. i got it. it works. but it checks the value between 1.1150 to 1.1200 only.

i need of to validate last 2 digits.

eg:

ranging between 1.0050 to 1.1100
1.1150 to 1.1200,1.1250 to 1.1300 likewise

16098

 sheriffonline: . but it checks the value between 1.1150 to 1.1200 only. False; where do you see any hard coded values?```double price = Bid;                                       // 1.11xxx 1.10xxx 1.12xxx double next100 =  round_up( price, pips_to_change(100) ); // 1.1200  1.1100  1.0300 double prev50  =  next100 - pips_to_change(50);           // 1.1150  1.1050  1.0250 if(prev50 <= price) // current price is                above 1.1150  1.1050  1.0250```