Variables
strategy.position_avg_price
The average entry price of the current position, or `na` when flat.
Example
//@lipi=2
strategy("strategy.position_avg_price Example", overlay=true, 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_avg_price, title="Average Entry Price", color=color.orange, style=plotStyle.linebr)
Type
series float