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.1150Not 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));}
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?
Look at the post closer.
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 |
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
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?