The largest short position size the strategy has held so far.
strategy.max_contracts_held_short is a series float: the largest size of any short position, stated as a positive number. It is 0 if the strategy never went short.
Type
series float
Remarks
- It only grows.
- A short of 8 reads 8 here, while
strategy.position_sizereads -8 at the same moment.
Example
//@version=6
strategy("Short peak size", overlay = true, initial_capital = 10000)
fast = ta.sma(close, 10)
slow = ta.sma(close, 30)
if ta.crossover(fast, slow)
strategy.entry("Long", strategy.long, qty = 5)
if ta.crossunder(fast, slow)
strategy.entry("Short", strategy.short, qty = 8)
shortShare = strategy.max_contracts_held_all > 0 ? strategy.max_contracts_held_short / strategy.max_contracts_held_all * 100 : na
plot(shortShare, "Short share of peak %", color.red)See also
strategy.max_contracts_held_longstrategy.max_contracts_held_allstrategy.position_sizestrategy.entrystrategy.risk.max_position_size
Runs on Sidechair