title: Calculate PipSize for Symbols in MT4
body: <p>My Question is <strong>How can I calculate Pip Size in MT4 (without checking symbol name)?</strong></p>
  
  <hr>
  
  <p><strong>My first Answer is based on <em>checking symbol name</em></strong>:</p>
  
  <p>Use the <code>Digits</code> 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)</p>
  
  <pre><code>double pipSize = 0.0001;
  //+------------------------------------------------------------------+
  //| Expert initialization function                                   |
  //+------------------------------------------------------------------+
  int OnInit()
    {
  //---
     if(StringFind("-,XAUUSD,Gold,GOLD,Gold.m,GOLD.m,-",","+Symbol()+",")&gt;0){
      pipSize = 0.1; // updated
     }else if(StringFind("-,XAGUSD,Silver,SILVER,Silver.m,SILVER.m,-",","+Symbol()+",")&gt;0){
      pipSize = 1/500;
     }
  //---
     return(INIT_SUCCEEDED);
    }
  </code></pre>