How pyramiding works in TradingView strategies
When you call strategy.entry() while a position is already active in that direction, Pine Scripts broker emulator checks the pyramiding setting declared inside the strategy() statement. If pyramiding = 0 (the default), TradingView discards the new order. If pyramiding is set to 3, the strategy permits up to 3 total entries in that direction. As new entries fill, strategy.position_size grows and strategy.position_avg_price recalibrates to reflect the volume-weighted average price of all combined entries.
| Pyramiding setting | Total entries permitted | Order behavior when condition repeats | Typical use cases |
|---|---|---|---|
| pyramiding = 0 | 1 entry max | New entry signals in same direction are ignored | Standard swing and trend-following strategies |
| pyramiding = 1 | 1 entry + 1 scale-in (2 total) | Allows one additional scale-in | Initial position + confirmation add-on |
| pyramiding = 3 to 5 | Up to 3-5 entries | Allows progressive additions as trend progresses | Multi-stage breakout or dip-buying systems |
| pyramiding = 10+ | Up to 10+ entries | Permits deep DCA ladders | Grid trading and dollar-cost averaging strategies |