OPEN-SOURCE SCRIPT

3-Bar Compression Reversal Pattern

56
//version=5
indicator("3-Bar Compression Reversal Pattern", overlay=true)

// Get candle OHLCs
open1 = open[2]
close1 = close[2]
body1 = math.abs(close1 - open1)

open2 = open[1]
close2 = close[1]
body2 = math.abs(close2 - open2)

// 2nd candle body < 50% of 1st
secondSmall = body2 < (0.5 * body1)

// 3rd candle engulfs both 1st and 2nd
lowAll = math.min(low[2], low[1])
highAll = math.max(high[2], high[1])
engulfAll = (high > highAll) and (low < lowAll)

// Final condition
patternDetected = secondSmall and engulfAll

// Plot signal
plotshape(patternDetected, location=location.belowbar, color=color.green, style=shape.labelup, size=size.small, title="Pattern Signal")
alertcondition(patternDetected, title="3-Bar Reversal Alert", message="3-Bar Compression Reversal Pattern Detected!")

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.