The unrealised profit or loss of the open position as a percent of the initial capital.
strategy.openprofit_percent is a series float equal to strategy.openprofit divided by strategy.initial_capital, times 100.
Type
series float
Remarks
- It is 0 while the strategy is flat.
- Dividing by the initial capital, not by the trade's entry value, is what separates it from
strategy.opentrades.profit_percent(n): with a position sized at half the capital, a 2% price move reads about 1.
Example
//@version=6
strategy("Open and closed profit", 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.openprofit_percent, "Open profit %", color.orange)
plot(strategy.netprofit_percent, "Closed profit %", color.green)See also
strategy.openprofitstrategy.netprofit_percentstrategy.initial_capitalstrategy.equitystrategy.position_size
Runs on Sidechair