The average loss of the losing closed trades in the account currency.
strategy.avg_losing_trade is a series float: gross loss divided by the number of losing trades, as a positive number. It is na while there is no loser.
Type
series float
Remarks
- Divide
strategy.avg_winning_tradeby it for the payoff ratio. - The formula is
strategy.grosslossdivided bystrategy.losstrades. Divide it by the order size to get a loss per share, contract or unit.
Example
//@version=6
strategy("Stop from average loss", overlay = true, initial_capital = 10000)
avgLossPerShare = strategy.avg_losing_trade / 10
stopDistance = na(avgLossPerShare) ? ta.atr(14) * 2 : avgLossPerShare
if ta.crossover(close, ta.sma(close, 20))
strategy.entry("Long", strategy.long, qty = 10)
strategy.exit("Stop", "Long", stop = close - stopDistance)
plot(strategy.avg_losing_trade, "Average loss", color.red, display = display.data_window)See also
strategy.avg_winning_tradestrategy.avg_tradestrategy.grosslossstrategy.losstradesstrategy.avg_losing_trade_percent
Runs on Sidechair