My Question is How can I calculate Pip Size in MT4 (without checking symbol name)?
My first Answer is based on checking symbol name:
Use the Digits
variable for 5 or 4 digits symbols and set PipSize = 0.0001. if Symbols are JPY fractions, use another values and so on other symbols in Shares and Indices or Spot Metals (like Silver)
double pipSize = 0.0001;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
if(StringFind("-,XAUUSD,Gold,GOLD,Gold.m,GOLD.m,-",","+Symbol()+",")>0){
pipSize = 0.1; // updated
}else if(StringFind("-,XAGUSD,Silver,SILVER,Silver.m,SILVER.m,-",","+Symbol()+",")>0){
pipSize = 1/500;
}
//---
return(INIT_SUCCEEDED);
}