Sidechair

strategy.eventrades

Browse the reference

The number of closed trades that finished with exactly zero profit.

Try it in the editor

strategy.eventrades is a series int. It counts break-even trades: closed trades whose result after commission is exactly 0. They are in neither the winning nor the losing count.

Type

series int

Remarks

  • On instruments with commission, a trade that closes at its entry price is a small loss, so this count usually stays at 0.
  • Wins, losses and break-evens add up to strategy.closedtrades, so a break-even count above 0 explains a gap between the win and loss counts and the total.

Example

Pine ScriptCount wins, losses and break-evensOpen in editor
//@version=6
strategy("Trade outcome counts", 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.wintrades, "Wins", color.green, style = plot.style_stepline)
plot(strategy.losstrades, "Losses", color.red, style = plot.style_stepline)
plot(strategy.eventrades, "Break-even", color.gray, style = plot.style_stepline)

See also

Runs on Sidechair