Lesson 13: Mypip Function in MT4 – Convert from Point to PIP

Mypip Function in MT4 – Convert from Point to PIP

At Exness or certain brokers, the point value for currency pairs may differ from the common standards across the market. Therefore, when calculating in MT4, it’s necessary to convert from Point to PIP to ensure consistency. You can use the Mypip() function to retrieve the current Point value of the currency pair, then multiply it by a specific factor to convert it to PIP. For gold (XAUUSD), the factor is 100; for other forex pairs, the factor is 10.

Here’s a simple example:

double Mypip()
{
      double pipValue = 0;
      string SYM="";
      SYM=_Symbol;
      StringSetCharacter(SYM,6,0);
   
      if (SYM=="XAUUSD") pipValue=MarketInfo(_Symbol,MODE_POINT)*100; 
      else if (SYM=="BTCUSD") pipValue=MarketInfo(_Symbol,MODE_POINT)*1000; 
      else pipValue=MarketInfo(_Symbol,MODE_POINT)*10;
      
   return pipValue;
 } 

To display the Pip value of a symbol, use:

Print("Gia tri Pip của ", Symbol(), " la: ", Mypip());  

In this example, we use the Mypip() function to get the current Point value of the symbol and store it in the pipValue variable. Then we check whether the symbol is XAUUSD using the Symbol() function. If so, we multiply pipValue by 100 to convert it to PIP. If it’s BTCUSD, we use 1000. For all other symbols, we multiply

Leave a Reply

Your email address will not be published. Required fields are marked *