π―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_pricingandexit_pricingsettings, 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?
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 β 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)
entry_pricing / exit_pricing Parameter Table (with defaults)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 β Sell Order Pricing Configurationπ exit_pricing Parameter Table
exit_pricing Parameter Tableprice_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
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
β
Recommended Configuration (Stable / Most Strategies)
Use together with
order_types.entry = "limit"andorder_types.exit = "limit".
π§ͺ Practical Recommendations
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
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.00011280price_last_balance = -0.000001β final price:0.00011279Check 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
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
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
enableRateLimitaccordingly.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