code 100.0 pips

 

Hello,

 

How can I get code for 100.0 pips?

 

Best,

Max 

 
You will have to write your question so that we know what you are asking
 
GumRai:
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 );
 
Max-Enrik: How can I get code for 100.0 pips?
  1. 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()

  2. #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
    
  3. 100.0 pips?
    double SL = OrderOpenPrice() - pips_to_change( 100 );
 
WHRoeder:
  1. There is Tick, PIP, and Point. They are all different in general.

Thanks for your reply @WHRoeder

I will try it soon.

Best,

Max 

 

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 

 
You have only three choices: Search for it, learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
 
WHRoeder:
You have only three choices: Search for it, learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.

Thanks for your replies.

I think will try for that.

Best,

Max 

 
WHRoeder:
  1. 100.0 pips?

( I read a bit more https://book.mql4.com/ - then I can used your above code. )

Really big thanks William - @WHRoeder.
That helped me a lot. It works for EURUSD - 0.00001 / USDJPY - 0.001 and so on as you mentioned.
---
So my broker Gold - 0000.01 and Oil - 00.01 / after I (minor) edited your code like below and then your code works for almost all my broker currencies, indexes and so on.

I read MQL4 book as I said. I want to learn how it works. So may you explain below code for me?

All the best to you.

return n * _Point * 10;
...
if( ( _Digits & 1 ) == 10 )   n *= 10.0;
...
if( ( _Digits & 1 ) == 10 ) p /= 10.0;
...
 
  1. As previously posted "In currencies a pip is defined as 0.0001 (or for JPY 0.01) ... In metals .. Pip has no meaning."
  2. if( ( _Digits & 1 ) == 10 
    Any integer (e.g. Digits) & 1 will always be either zero or one. Your if will never be true.
 
WHRoeder:
  1. Any integer (e.g. Digits) & 1 will always be either zero or one. Your if will never be true.
( I have not gotten to 'Operators' section yet. )
Yes, you right, because some pairs, cmd, cfd were not works true.
But I edited like below code, till now looks like works true. ( I tested in 3 different brokers )

So I wanna ask you below code is true or what?
( Honestly you helped me a lot, your answers throws light on my codes way ( even I am not beginner level ), big thanks man. )
if( ( _Digits & 0 ) == 1 ) n *= 10.0;
...
if( ( _Digits & 0 ) == 1 ) p /= 10.0;
...
double pips2dbl = OrderOpenPrice() - pips_to_change( 1000 );
...

 

Reason: