You will have to write your question so that we know what you are asking
I need to plus 100pips to "openDay"
string lvl_plus100pip = DoubleToStr( dayOpenPrice * 0.01 );
Above code for EURUSD but when I use that code for USDJPY it does not work until when I change it like below.
DoubleToStr( dayOpenPrice * 1.0 );
There is Tick, PIP, and Point. They are all different in general. A tick is the smallest change of price. A Point is the least significant digit quoted. In currencies a pip is defined as 0.0001 (or for JPY 0.01)
On a 4 digit broker a point (0.0001) = pip (0.0001). [JPY 0.01 == 0.01] On a 5 digit broker a point (0.00001) = 1/10 pip (0.00010/10). Just because you quote an extra digit doesn't change the value of a pip. (0.0001 == 0.00010) EA's must adjust pips to points (for mq4.) In currencies a tick is a point. Price can change by least significant digit (1.23456 -> 1.23457)
In metals a Tick is still the smallest change but is larger than a point. If price can change from 123.25 to 123.50, you have a TickSize of 0.25 and a point of 0.01. Pip has no meaning.
This is why you don't use TickValue by itself. Only as a ratio with TickSize. See DeltaValuePerLot()
#define CHANGE double ///< Difference of two prices. #define POINT int ///< `CHANGE / _Point`. #define PIP double ///< `POINT / PipsPerPOINT`. CHANGE points_to_change(POINT n){ return n * _Point; } POINT change_to_points(CHANGE c){ return POINT(c / _Point + 0.5); } CHANGE pips_to_change(PIP n){ return points_to_change(pips_to_points(n));} PIP change_to_pips(CHANGE c){ return points_to_pips(change_to_points(c));} POINT pips_to_points(PIP n){ if( (_Digits&1) == 1) n *= 10.0; return POINT(n); } PIP points_to_pips(POINT n){PIP p = n; if( (_Digits&1) == 1) p /= 10.0; return p; } // Digits DE30 EURNOK USDJPY EURUSD USDMXN USDZAR // Digits 1 5 3 5 4 5 // point 0.1 0.00001 0.001 0.00001 0.00001 0.00001 // ticksize 0.5 " " " " " // Pip/lot(USD) 1.19 8.23 10.00 0.60 0.73 // Spread 214.8 1.9 2.3 351.4 181.7 // Spread/lot(USD) 256.31 15.64 23.00 211.97 133.33
- 100.0 pips?
double SL = OrderOpenPrice() - pips_to_change( 100 );
Hello,
Thanks for your time @WHRoeder.
Really I spend a time for I understand that what you wrote above. For getting 100 pips code for every currencies pair, but I think I cannot write codes for what I want. Also I think that is not for beginner level as I know.
Also if there is possible easy / quick way for I can get 100pips code. If have a time write it how can I do that, please.
Anyway thanks.
Max
- 100.0 pips?
( I read a bit more https://book.mql4.com/ - then I can used your above code. )
All the best to you.
return n * _Point * 10; ... if( ( _Digits & 1 ) == 10 ) n *= 10.0; ... if( ( _Digits & 1 ) == 10 ) p /= 10.0; ...
- As previously posted "In currencies a pip is defined as 0.0001 (or for JPY 0.01) ... In metals .. Pip has no meaning."
if( ( _Digits & 1 ) == 10
Any integer (e.g. Digits) & 1 will always be either zero or one. Your if will never be true.
- Any integer (e.g. Digits) & 1 will always be either zero or one. Your if will never be true.
if( ( _Digits & 0 ) == 1 ) n *= 10.0; ... if( ( _Digits & 0 ) == 1 ) p /= 10.0; ... double pips2dbl = OrderOpenPrice() - pips_to_change( 1000 ); ...

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
How can I get code for 100.0 pips?
Best,
Max