🎯How to Precisely Control Buy & Sell Prices? Practical entry/exit_pricing Configuration

This article was produced by the Quantitative Trading Lab at https://www.itrade.icu. Visit for more benefits. In trading, the placement price of your orders determines execution efficiency and slippage risk. Freqtrade provides the entry_pricing and exit_pricing settings, allowing you to finely control limit order pricing logic.

This guide explains how to use order book data to implement precise order placement strategies, including depth filtering, to improve order quality and strategy robustness.


πŸ’‘ Why configure entry_pricing / exit_pricing?

By default, limit orders are often placed at the current price or the candle close. This approach may:

  • Fail to execute or deviate from the ideal price during volatile markets

  • Struggle with low liquidity coins, causing stuck orders

  • Increase slippage, negatively affecting strategy performance

By configuring entry_pricing and exit_pricing, you can:

βœ… Place orders at bid/ask prices according to real order book βœ… Control the order book level (1st level, 2nd level, etc.) βœ… Enable depth filtering to avoid placing orders during abnormal market movements


πŸ“₯ entry_pricing β€” Buy Order Pricing Configuration

"entry_pricing": {
  "price_side": "same",
  "use_order_book": true,
  "order_book_top": 1,
  "price_last_balance": 0.0,
  "check_depth_of_market": {
    "enabled": false,
    "bids_to_ask_delta": 1
  }
}

πŸ“‹ entry_pricing / exit_pricing Parameter Table (with defaults)

Parameter
Description
Default

price_side

Order direction: β€’ bid: buy side (bid price) β€’ ask: sell side (ask price) β€’ same: buy β†’ bid, sell β†’ ask β€’ other: buy β†’ ask, sell β†’ bid

"same"

use_order_book

Use order book pricing: β€’ true: use live order book β€’ false: use candle close (not recommended)

true

order_book_top

Choose order book level: β€’ 1: level 1 (best price) β€’ 2: level 2, etc.

1

price_last_balance

Offset from base price: β€’ Negative β†’ more conservative β€’ Positive β†’ more aggressive

0.0

check_depth_of_market.enabled

Enable depth filtering to prevent orders when bid/ask spreads are abnormal

false

bids_to_ask_delta

Maximum allowed bid/ask spread; orders are ignored if spread exceeds this (currency price unit)

0.001


πŸ“€ exit_pricing β€” Sell Order Pricing Configuration

πŸ“‹ exit_pricing Parameter Table

Parameter
Description
Recommended Default

price_side

Sell order direction, same options as entry_pricing

"same"

use_order_book

Use live order book pricing (true) or candle price (false)

true

order_book_top

Order book level; smaller β†’ faster execution, larger β†’ better price but slower

1


πŸ“Š Order Placement Behavior Comparison

Scenario
Order Side
Order Book Level
Execution Speed
Slippage Control
Risk

same + order_book_top=1

Own side (buy β†’ bid1, sell β†’ ask1)

Level 1

Medium

Low

Medium

other + order_book_top=1

Opposite side (buy β†’ ask1, sell β†’ bid1)

Level 1

Fast

Medium

High (more slippage)

same + order_book_top=2

Own side, level 2 (bid2/ask2)

Level 2

Slow

Lower

Low

use_order_book=false

Candle price, no order book

β€”

Unstable

Cannot control

High


Use together with order_types.entry = "limit" and order_types.exit = "limit".


πŸ§ͺ Practical Recommendations

Strategy Type
Recommended Setup

Conservative orders

same + top=1, enable depth filter to control execution & slippage

High-frequency arbitrage

opposite + top=1, maximize fill rate, tolerate moderate slippage

Low liquidity coins

top=1~2 + depth check, avoid abnormal prices

Aggressive low-price buys

same + top=2~3, combine with price_last_balance


πŸ§ͺ Example: Low-Price Buy + Conservative Sell

Trading PEPE/USDT on Binance (volatile, medium liquidity):

  • Buy: aim for slightly lower price without sacrificing execution

  • Sell: safely place at ask1 for fast exit


πŸ” Simulated Order Book Snapshot

Bids (Buy)
Asks (Sell)

0.00011300 (bid1)

0.00011320 (ask1)

0.00011280 (bid2)

0.00011330 (ask2)

0.00011270 (bid3)

0.00011340 (ask3)

πŸ“₯ Entry Logic

  • order_book_top = 2 β†’ bid2: 0.00011280

  • price_last_balance = -0.000001 β†’ final price: 0.00011279

  • Check if bid/ask spread (0.00011320 - 0.00011300 = 0.00020) < bids_to_ask_delta β†’ allow order

βœ… Final buy order: 0.00011279

πŸ“€ Exit Logic

  • order_book_top = 1 + price_side = same β†’ ask1: 0.00011320

βœ… Final sell order: 0.00011320 β†’ fast execution, low slippage


βœ… Usage Recommendations

Goal
Entry Pricing
Exit Pricing

Buy cheaper

same + top=2~3 + price_last_balance < 0

-

Fast execution

same + top=1

same + top=1

Avoid abnormal orders

check_depth_of_market.enabled = true

-


πŸ“Œ Summary

Config
Controls
Suggested Default

entry_pricing

Buy order placement

Use order book same/level1 + depth filter

exit_pricing

Sell order placement

Use order book same/level1

order_book_top

Which order book level

1 (conservative), 2+ (lower price)

bids_to_ask_delta

Max order book spread filter

1 (unit depends on market)

check_depth_of_market

Prevent abnormal orders during volatile swings

Enabled


⚠️ Notes

  • These settings only apply to limit orders (order_types.entry = "limit").

  • Market orders completely ignore these parameters.

  • Frequent order book queries may hit exchange rate limits; adjust enableRateLimit accordingly.

  • Some exchanges (e.g., HTX) may have delayed order book data; consider execution lag.


Good order placement is part of the strategy. Proper use of entry_pricing and exit_pricing reduces slippage and improves execution efficiency, making your strategies smarter and more reliable.

Last updated