QTrader
Menu

Commission, slippage and funding

Set trading costs deliberately and understand which simulated fills include commission, slippage and funding.

Before you start

Gross price movement is not net performance. Commission, fill-price slippage and funding affect a simulation in different ways. Record the cost settings with the strategy, market and dates. Read strategy settings and the futures reference before comparing runs.

Follow the workflow

  1. Check commission precedence: an explicit request/parameter override takes priority over code, then the exchange base taker fee and configured fallback apply.
  2. Commission is charged on entry and exit notionals. A returned trade P&L already includes its applicable fees; do not subtract the same fee twice.
  3. Distinguish percentage slippage from Pine tick slippage. Tick slippage uses an absolute tick distance rather than a percentage of price.
  4. Inspect order types: limit entries and take-profit fills are not slipped by the engine in the same way as signal, stop and trailing fills.
  5. For perpetuals, inspect funding separately. Positive funding makes a long pay and a short receive where funding is applied; the returned P&L already incorporates it.

Worked example

Run the same SMA strategy twice with the same data and size, changing only commission. Compare individual trade fees and net return. Repeat separately for a supported slippage setup. Keep the runs as separate records; changing several inputs at once prevents a clean explanation.

Check a funding payment on one candle

Suppose a long position of 0.2 BTC is open when a funding rate of +0.01% applies. With a candle close of 50,000 USDT, the position value is 10,000 USDT and the funding charge is 1 USDT. A short of the same size receives 1 USDT. Use the position value at the candle close, even if the margin posted was smaller.

To reproduce the check, keep the contract and timeframe fixed, select a window that spans a funding payment, and inspect the trade’s funding and net P&L. The funding-rate series supplies a value a strategy can read between payments. Seeing the same rate on several candles does not mean a charge was applied on each one. If the report’s Notes flag missing funding history, a zero charge cannot establish that the historical rate was zero.

Open the working example

Limits and interpretation

Costs are simulation assumptions, not broker quotes. Some combinations are restricted: percentage slippage with lots is rejected, while tick slippage with certain lots/partial-exit/order constructs can be dropped with a warning. Read Notes rather than assuming an entered value was applied. A strategy that looks good only with zero costs needs further investigation.

The interactive workbench needs JavaScript. Reload this page if interactive controls could not load.