//+------------------------------------------------------------------+
//| Pips to Point Conversion Factor.mq4 |
//+------------------------------------------------------------------+
#property library
#property strict
//+------------------------------------------------------------------+
//| My function |
//+------------------------------------------------------------------+
//Explanation: This is a conversion factor. It used to detect whether broker is 4 or 5 digits. As MT4 calculates everything using point basis, coder can use this function to convert pips to point for machine reading.
//Eg: If you want to set stop loss of 50 pips for 5 digit broker, refer to this function by convert it to 500 points for machine to read.
int PipsToPointFactor()
{
int point;
if(Digits==5 || Digits==3) //Check whether it's a 5 digit broker (3 digits for Yen)
point=10; //1 pip to 10 point if 5 digit
else if(Digits==4 || Digits==2)
point=1; //1 pip to 1 point if 4 digit
return(point);
}
/*
Eg:
If 5 digit broker:
stoploss*PipsToPointFactor
=50pips*10
=500points
*/
//+------------------------------------------------------------------+
Comments