The order quantity the strategy's default sizing would give for a fill at a chosen price.
strategy.default_entry_qty(fill_price) applies default_qty_type and default_qty_value from the strategy() header to the current equity and to fill_price. With a fixed quantity it returns that quantity; with strategy.percent_of_equity or strategy.cash it divides the allotted money by the price.
A market entry fills at a price you cannot know when the order is placed, so the default sizing handles it. For a limit or stop entry the price is known up front, and this function lets you reproduce the default sizing for that price and pass it as qty.
Syntax
strategy.default_entry_qty(fill_price: series int/float) -> series floatArguments
| Name | Type | Default | Description |
|---|---|---|---|
| fill_price | series int/ | required | The price the order is expected to fill at; the default quantity is worked out for this price. |
Returns
series float: The quantity strategy.entry would use at that price under the strategy's default sizing.
Remarks
- It follows the same rounding and point value rules as an entry with no qty argument.
- The value depends on equity at the moment of the call, so it changes as the strategy wins and loses.
Example
//@version=6
strategy("Dip buy", overlay = true, default_qty_type = strategy.percent_of_equity, default_qty_value = 10)
dip = ta.lowest(low, 10)
if barstate.isconfirmed and close > open
strategy.entry("Dip", strategy.long, qty = strategy.default_entry_qty(dip), limit = dip)
plot(dip, "10-bar low", color.red)See also
strategy.entrystrategy.orderstrategy.percent_of_equitystrategy.risk.max_position_sizestrategy.convert_to_symbol
Runs on Sidechair