How Freya Models Slippage and Fees in Backtests
The fastest way to make a losing strategy look profitable is to backtest it with zero costs. Every fill at the perfect price, no fees, no slippage. Plenty of backtesting tools do exactly that, and the strategies they bless die on contact with a real exchange.
Freya's engine does not. It applies slippage, a fill buffer, and real maker-taker commissions on every trade, so the equity curve you see already carries the friction of live trading. Knowing exactly how it does that tells you how much to trust your results and which strategies the costs will quietly kill.
Key Takeaways
- Market and stop orders are filled with 0.03% slippage in the direction that hurts you; the fill is always worse, never better.
- Limit orders take no slippage, but price must trade 0.01% past your limit before the engine counts it as filled.
- Every simulated fill is clamped to the candle's own high and low, so the engine can never fill at a price the market never printed.
- Commissions use each exchange's real maker and taker rates: limit orders pay maker, market orders pay taker.
- Fees are charged on entry, on every safety order, and on exit, and they are calculated on the leveraged position size.
- High-frequency and deep-DCA strategies pay these costs many times over, which is why they can backtest positive gross and negative net.
For the bigger picture of why live still differs even after all this, read backtest vs live results.
The rates below are the engine's modeling assumptions, described so you can read your results, not trading advice. Crypto trading can lose money. Read the Risk Disclosure before going live.
Slippage: Filling at a Realistic Price
Slippage is the gap between the price you wanted and the price you got. On a live exchange it comes from the order book moving in the instant your order lands. Freya models it with a simple, honest rule that depends on your order type.
Market and stop orders are filled with 0.03 percent slippage, always applied in the direction that costs you. Buy, and your fill is 0.03 percent higher than the reference price. Sell, and it is 0.03 percent lower. There is no lucky fill. This mirrors the reality that a market order crosses the spread and pays for immediacy.
Limit orders take no slippage, because a limit order fills at your price or not at all. But the engine does not hand you a fill just because price touched your level for an instant. Price must trade 0.01 percent past your limit before the fill counts. That small buffer prevents the classic backtest lie of assuming every wick that grazed your price would have filled your order in the real, competitive order book.
Some backtesters apply slippage symmetrically, which quietly cancels out over many trades and understates its true drag. Freya applies it directionally, always against you, because that is what a real order book does. Over hundreds of trades this is the difference between a realistic cost and a hidden subsidy.
Clamping to the Candle
There is a subtler way backtests cheat: filling at a price the candle never reached. Freya prevents it. Every simulated fill is clamped to the high and low of the candle it happens in. The engine physically cannot fill your order above the candle's high or below its low, because that price did not exist in that bar.
This matters most for stops and take-profits on volatile candles. Without clamping, an engine can assume your stop filled at exactly its level even when the candle gapped straight through it. Clamping keeps every fill inside prices the market actually printed, which is one of the quiet reasons Freya's numbers stay closer to live than a naive backtest.
Fees: Maker, Taker, and the Leveraged Notional
Slippage is only half the friction. Every fill also pays a commission, and Freya uses each exchange's real maker and taker rates, not a flat guess.
- A limit order that rests on the book and gets filled pays the maker fee, which is lower.
- A market order that crosses the spread for an immediate fill pays the taker fee, which is higher.
Two details decide how much fees actually cost you:
- They are charged on every fill, not just the round trip. You pay on entry, on every safety order a DCA bot adds, and on exit. A bot that averages down across eight safety orders pays commission nine times before it ever closes.
- They are calculated on the leveraged position size. At 10x leverage, a $1,000 margin controls a $10,000 position, and the fee is charged on the $10,000. Leverage multiplies your fees exactly as it multiplies your exposure.
| Strategy trait | Cost impact | What to check |
|---|---|---|
| Many small trades per day | Slippage and taker fees paid constantly | Compare gross vs net profit; the gap is your cost drag |
| Deep DCA / martingale ladders | A commission on every safety order | Net PnL after all the added-order fees |
| High leverage | Fees charged on the full leveraged notional | Whether the edge survives fees at that leverage |
| Mostly resting limit orders | Maker fees, no slippage | Usually the cheapest to run, if fills are realistic |
Why This Turns Some Strategies Red
A strategy can show a healthy gross profit and a negative net once these costs are applied, and that is the engine doing its job. The usual culprits are frequency and depth: a scalper paying taker fees and slippage on hundreds of trades, or a deep-DCA bot paying a commission on every one of many safety orders. If your net result is far below your gross, the costs are eating the edge, and no amount of live discipline will change the math.
The fix is strategic, not hopeful: fewer, higher-conviction trades, more resting limit orders to earn maker fees, less leverage, or a wider take-profit that clears the cost hurdle. The backtest is telling you the truth up front, which is exactly what you want it to do.
Putting It to Work
- Always compare gross to net. The gap is your total cost of trading. If it is large, frequency or leverage is the problem.
- Favor limit entries where you can. Maker fees and zero slippage make resting orders materially cheaper than chasing with market orders.
- Count your safety orders. Every one is another commission. Deep ladders are not free.
- Do not confuse this with the full live gap. Even with slippage and fees modeled, live adds latency, partial fills, real order-book depth, and Freya's performance fee. This engine gets you most of the way to realism; backtest vs live results covers the rest.
Frequently Asked Questions
How much slippage does Freya assume?
Market and stop orders are filled with 0.03 percent slippage, always in the direction that costs you. Limit orders take no slippage but require price to trade 0.01 percent past your limit before the fill is counted. Every fill is also clamped to the candle's high and low, so the engine never fills at a price the market did not print.
Does the backtest include trading fees?
Yes. It uses each exchange's real maker and taker rates. Limit orders pay the lower maker fee, market orders pay the higher taker fee, and the commission is charged on entry, on every safety order, and on exit, calculated on the leveraged position size.
Why is my net profit so much lower than my gross?
Because slippage and commissions are being deducted, and they add up fast for high-frequency strategies and deep DCA ladders that pay a fee on every order. A large gap between gross and net means the strategy's costs are eating its edge. Reduce frequency, use more limit orders, or lower leverage.
Does leverage increase my fees?
Yes. Fees are charged on the leveraged position size, not your margin. At 10x, a fee on a position backed by $1,000 of margin is calculated on the $10,000 of exposure. Higher leverage multiplies your fees just as it multiplies your risk.
