For Forex Swap Formula: 

Swap = (Pip Value * Swap Rate * Number of Nights) / 10 

 

Note: The pip value differs per lot size.


For stocks, the swap rate is given in dollars (USD) per lot traded - so you would just multiply the below to get the amount charged each day.  

 

Lots * swap rate 

 

For some of the indices, you can check in the platform if the charge is ‘percent’ or ‘dollars’, and a different calculation would be needed for the two different types. The Percent is just an annual percentage rate. 

 

The formula depends on the swap type. The calculation for ‘dollar’ is provided above and then the percentage swaps calculation will be: 

 

 Lots * contract size * current price *  (swap rate / 36000)  

 

To further explain where the 36000 came from, it is because the percentage swap rate needs to be divided by 100 to get it from a whole number percentage into a fraction for the calculation - so 2.5% is reflected as 0.025 when calculating. Then it is further divided by 360 for 360 trading days in a calendar year (not precise, but this is how MT4 works) - so dividing it by 360 * 100 = 36000 does both of these steps in one go.