The total profit of all closed trades as a percent of the initial capital.
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
//@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
strategy.netprofitstrategy.initial_capitalstrategy.openprofit_percentstrategy.grossprofit_percentstrategy.equity
Runs on Sidechair