Formula for calculating monthly profit used by MQL5

 
Does anyone know what formula MQL5 uses to calculate the monthly profit of our trading account before it's displayed in our account portfolio? It seems like the calculation is also affected by deposit and withdrawal activities.