Sidechair

strategy.avg_losing_trade_percent

Browse the reference

The average percentage loss of the losing closed trades.

Try it in the editor

strategy.avg_losing_trade_percent is a series float: the mean percentage result of the trades that closed with a loss, as a positive number. It is na while there is no loser.

Type

series float

Remarks

  • Each trade's percentage uses its own entry value.

Example

Pine ScriptCheck the loser against a stop distanceOpen in editor
//@version=6
strategy("Loser versus stop", initial_capital = 10000, default_qty_type = strategy.percent_of_equity, default_qty_value = 100)
stopPercent = 3.0
if ta.crossover(ta.sma(close, 10), ta.sma(close, 30))
    strategy.entry("Long", strategy.long)
    strategy.exit("Stop", "Long", stop = close * (1 - stopPercent / 100))
if ta.crossunder(ta.sma(close, 10), ta.sma(close, 30))
    strategy.close("Long")
plot(strategy.avg_losing_trade_percent, "Average loser %", color.red)
hline(stopPercent, "Stop distance", color.gray)

See also

Runs on Sidechair