OPEN-SOURCE SCRIPT

6 Consecutive Red Candles

64
//version=6
indicator("6 Consecutive Red Candles", overlay=true)

// Function to identify a red candle (close < open)
isRedCandle(close, open) =>
close < open

// Check if there are 6 consecutive red candles
consecutiveRedCandles = isRedCandle(close, open) and isRedCandle(close[1], open[1]) and isRedCandle(close[2], open[2]) and isRedCandle(close[3], open[3]) and isRedCandle(close[4], open[4]) and isRedCandle(close[5], open[5])

// Plotting a shape to indicate when the condition is met
plotshape(series=consecutiveRedCandles, style=shape.labelup, location=location.belowbar, color=color.red, size=size.small, text="6 Reds")

// Optionally, color the bars red if there are 6 consecutive red candles
barcolor(consecutiveRedCandles ? color.red : na)

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.