Lipi Reference
Lipi

Variables

strategy.position_size

The size of the current position: positive when long, negative when short, 0 when flat.

Example


          //@lipi=2
strategy("strategy.position_size Example", overlay=false, initial_capital=10000)
if talib.crossover(close, talib.sma(close, 20)) {
    strategy.entry("Long", strategy.long)
}
if talib.crossunder(close, talib.sma(close, 20)) {
    strategy.close("Long")
}
plot(strategy.position_size, title="Position Size", color=color.blue)
        

Type

series float