Sidechair

strategy.equity

Browse the reference

The strategy's current equity: initial capital plus net profit plus open profit.

Try it in the editor

strategy.equity is a series float. It moves with every closed trade (net profit) and with the price while a trade is open (open profit), so plotting it gives the equity curve.

Type

series float

Remarks

  • Equity excludes commission not yet charged on open trades; the exit commission is charged when the trade closes.
  • strategy.equity changes on every tick of a live bar when the strategy has an open position.

Example

Pine ScriptEquity against its running peakOpen in editor
//@version=6
strategy("Equity and drawdown", overlay = false, 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")
var float peak = na
peak := na(peak) ? strategy.equity : math.max(peak, strategy.equity)
plot(strategy.equity, "Equity", color.blue)
plot(peak, "Peak equity", color.gray)
plot((strategy.equity / peak - 1) * 100, "Drawdown %", color.red, style = plot.style_area)

See also

Runs on Sidechair