Sidechair

strategy.avg_winning_trade

Browse the reference

The average profit of the winning closed trades in the account currency.

Try it in the editor

strategy.avg_winning_trade is a series float: gross profit divided by the number of winning trades. It is na while there is no winner.

Type

series float

Remarks

Example

Pine ScriptPayoff ratioOpen in editor
//@version=6
strategy("Payoff ratio", initial_capital = 10000, default_qty_type = strategy.percent_of_equity, default_qty_value = 100)
if ta.crossover(ta.sma(close, 10), ta.sma(close, 30))
    strategy.entry("Long", strategy.long)
if ta.crossunder(ta.sma(close, 10), ta.sma(close, 30))
    strategy.close("Long")
payoff = strategy.avg_losing_trade > 0 ? strategy.avg_winning_trade / strategy.avg_losing_trade : na
plot(payoff, "Average win / average loss", color.green)
hline(1, "Even", color.gray)

See also

Runs on Sidechair