Sidechair

strategy.grossprofit_percent

Browse the reference

The gross profit of all winning closed trades as a percent of the initial capital.

Try it in the editor

strategy.grossprofit_percent is a series float equal to strategy.grossprofit divided by strategy.initial_capital, times 100.

Type

series float

Remarks

  • It never decreases, because losing trades are counted separately in strategy.grossloss_percent.
  • A 10 on a 10,000 account means winning trades have added 1,000 in total. Because it ignores losers, a high value alone says nothing about whether the strategy made money.

Example

Pine ScriptFlag when winners add 10 percentOpen in editor
//@version=6
strategy("Winners as a share of capital", 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.grossprofit_percent, "Gross profit %", color.green)
bgcolor(strategy.grossprofit_percent >= 10 ? color.new(color.green, 90) : na)

See also

Runs on Sidechair