Sidechair

strategy.netprofit_percent

Browse the reference

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

Try it in the editor

strategy.netprofit_percent is a series float. It equals strategy.netprofit divided by strategy.initial_capital, times 100, so 5 means closed trades have added 5 percent of the starting capital.

Type

series float

Remarks

  • It is not compounded: the base is always the initial capital.
  • 12 on a 10,000 account means 1,200 of closed profit. Open profit is not included, so a strategy holding a large unrealised gain reads low until it exits.

Example

Pine ScriptNet profit against a 20 percent goalOpen in editor
//@version=6
strategy("Percent goal", 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)) and strategy.netprofit_percent < 20
    strategy.entry("Long", strategy.long)
if ta.crossunder(ta.sma(close, 10), ta.sma(close, 30))
    strategy.close("Long")
plot(strategy.netprofit_percent, "Net profit %", color.green)
hline(20, "Goal", color.gray)

See also

Runs on Sidechair