How do you calculate CFD?
You calculate a CFD result in two stages: gross profit or loss from the price move, then net profit or loss after costs.
Gross profit or loss comes from five inputs:
Direction, whether the trade is long or short, which sets whether a rising or falling price produces a gain.
Open price, where the position was entered.
Close price, where the position was exited.
Contract size, the number of units per lot.
Number of lots, the size of the position.
The formula is gross profit or loss = (close price - open price) x contract size x number of lots, reversed in sign for a short trade.
Leverage, margin percentage, and required margin do not change the gross result. They set how much capital you must deposit to open and hold the position. Full position value = open price x contract size x number of lots, and required margin = full position value x margin percentage.
Net profit or loss then subtracts four costs:
Spread, the difference between the bid and ask price at entry.
Commission, a fixed fee charged per lot on entry and exit.
Swap rate, the daily financing charge on any position held overnight. Wednesday usually carries a triple charge to account for the weekend.
Holding period, the number of nights the position stays open.
Here is a worked long trade on gold. The setup is a long position, open price $2,000, contract size 100 ounces, one lot, priced in USD, at 1:100 leverage. Full position value is $200,000, the margin percentage is 1%, and required margin is $2,000. Costs are a $50 spread, $7 commission, and a $5 swap per night over three nights, a $15 total swap.
Profit scenario, close price $2,050: gross profit or loss = ($2,050 - $2,000) x 100 x 1 = +$5,000. Net profit or loss = $5,000 - $50 - $7 - $15 = +$4,928.
Loss scenario, close price $1,950: gross profit or loss = ($1,950 - $2,000) x 100 x 1 = -$5,000. Net profit or loss = -$5,000 - $50 - $7 - $15 = -$5,072.
Please note that the calculations are for illustrative purposes only and that contract specifications, financing rates, spreads, and commissions vary by broker, product, and jurisdiction.









