Sidechair

strategy.grossprofit

Browse the reference

The sum of the profits of all winning closed trades.

Try it in the editor

strategy.grossprofit is a series float: the total of every closed trade that made money, before the losing trades are subtracted. It never decreases.

Type

series float

Remarks

  • Divide it by strategy.grossloss for the profit factor; guard against a grossloss of 0 on the first winning trades.
  • A large value is not a good sign on its own. Read it beside strategy.grossloss, because net profit is the difference.

Example

Pine ScriptGross profit against net profitOpen in editor
//@version=6
strategy("Gross versus net", 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, "Gross profit", color.green)
plot(strategy.netprofit, "Net profit", color.blue)

See also

Runs on Sidechair