Pine 脚本 - 如何编写检测八个相似连续蜡烛的脚本

Pine script -How to write a script that detects eight similar consecutive candles

想写一个 pine 脚本,在连续 8 根相似的蜡烛后发出警报,并在第 8 根蜡烛后或第 8 根蜡烛后发出警报。

greenCandle = close > open ? 1 : 0

cond = sum(greenCandle, 8) == 8

alertcondition(cond, title = "Alert", message = "8th green!")