Sidechair

strategy.avg_trade_percent

Browse the reference

The average result of a closed trade as a percent of the trade's entry value.

Try it in the editor

strategy.avg_trade_percent is a series float: the mean of every closed trade's percentage result. It is na until the first trade closes.

Type

series float

Remarks

  • Each trade's percentage uses its own entry value, so large and small trades count equally.
  • A strategy can have a positive value here and a negative strategy.avg_trade if small trades win and large ones lose, because each trade counts once in this average.

Example

Pine ScriptAverage trade as a percentOpen in editor
//@version=6
strategy("Average percent per trade", 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")
plot(strategy.avg_trade_percent, "Average trade %", color.blue)
hline(0, "Zero", color.gray)

See also

Runs on Sidechair