ROI (Return of Investment) is calculated using the **unrealized P&L of position in coins / initial margin** of position.

When leverage is adjusted for a position the initial margin requirements will change while the position size (QTY) remains unchanged

- An increase in leverage will reduce the initial margin required
- A decrease in leverage will increase the initial margin required.

Thus with the same unrealized P&L, the initial margin increases the ROI will be reduced while a reduction in the initial margin will increase the ROI, even though the actual unrealized P&L in coins is the same.

In a simple example,

Position size: 1000 BTCUSD

Direction: Long

Leverage use: 10x

Average entry price: 6800

Current last traded Price: 7000

initial margin: (1000 / 10) /6800 = 0.0147058824 BTC

Unrealized P&L of position (excluding fees): 1000 x (1/6800 - 1/7000) = 0.00420168 BTC **ROI: 0.00420168 / 0.0147058824 x 100 = 28.57142391% **

Now assuming the leverage use is increased to 20x

New initial margin: (1000 / 20) /6800 = 0.0073529412 BTC**ROI: 0.00420168 / 0.0073529412 x 100 = 57.14284782%**

Notice that in the above example, even after applying higher leverage, the only variable that changed was the position margin (denominator) and as a result, the ROI increased (from 28% to 57%). However, the P&L in coins (Blue number) remained constant if the trader closes the position, the profit and loss will still be the same regardless whether he is using 10x or 20x leverage.