// === MÔ HÌNH DOUBLE TOP === doubleTop = swingHigh(high, 10) and ta.highest(high, 5) == high if doubleTop label.new(x=time, y=high, text="DT", color=color.red, textcolor=color.white, size=size.small)
// === MÔ HÌNH HEAD & SHOULDERS === leftShoulder = swingHigh(high, 20) head = swingHigh(high, 10) and high > ta.highest(high, 20) rightShoulder = swingHigh(high, 20) and ta.highest(high, 10) < high headShoulders = leftShoulder and head and rightShoulder if headShoulders label.new(x=time, y=high, text="H&S", color=color.orange, textcolor=color.white, size=size.small)
// === MÔ HÌNH CUP & HANDLE === cupFormation = swingLow(low, 20) and ta.lowest(low, 10) == low handleFormation = swingHigh(high, 5) and high < ta.highest(high, 10) cupHandle = cupFormation and handleFormation if cupHandle label.new(x=time, y=low, text="C&H", color=color.green, textcolor=color.white, size=size.small)
// === MÔ HÌNH TAM GIÁC (Triangle) === triangleUp = swingHigh(high, 10) and ta.highest(high, 5) < high triangleDown = swingLow(low, 10) and ta.lowest(low, 5) > low if triangleUp label.new(x=time, y=high, text="▲", color=color.blue, textcolor=color.white, size=size.small) if triangleDown label.new(x=time, y=low, text="▼", color=color.blue, textcolor=color.white, size=size.small)
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publications is governed by House rules. You can favorite it to use it on a chart.
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.