Is this calculation of the pip value and the margin of the future correct?

 

I want to calculate the pip value. And I also want to calculate the margin of the future before opening a position.

But I am not 100% sure if I am doing it correctly.

Can someone confirm if this calculation is correct?
Thank you so much !!

   //+------------------------------------------------------------------+
   double PipValue(double pVolume, double pPrice=1, double pLotValue=100000)
   {    
      return NormalizeDouble(pLotValue*pVolume*_Point,2)/pPrice;
   }
   //+------------------------------------------------------------------+
   double Margin
               (
                  ENUM_ORDER_TYPE       pAction,  
                  string                pSymbol,  
                  double                pVolume,    
                  double                pPrice                                    
               )
   {   
      
      double currentMargin = AccountInfoDouble(ACCOUNT_MARGIN);   
      
      
      double operationMargin = 0;
      bool result = OrderCalcMargin(pAction, pSymbol, pVolume, pPrice, operationMargin); 
      
     
      if (!result) return 0;
      
      return currentMargin + operationMargin;
   }
   //+------------------------------------------------------------------+
   double MarginBuy(double pVolume)
   {   
      
      double ask = SymbolInfoDouble(Symbol(),SYMBOL_ASK);      
      
      return Margin(ORDER_TYPE_BUY, Symbol(), pVolume, ask);
   }
   //+------------------------------------------------------------------+

void OnStart()
{
   double volume = 1;
   double pipValue = PipValue(volume,100000);   
   double marginBuy = MarginBuy(volume);
   
   Comment(
            "\nPip Value       =", pipValue, //(EURUSD)--> 1$??? (_Point=0.00001)
            "\nMarginBuy       =", marginBuy
           );
   
   
}
//+------------------------------------------------------------------+



 
Try to find your answer here

https://www.mql5.com/en/forum/368609#comment_22188089

 
Dominik Egert:
Try to find your answer here


Thank you so much Dominik!!