// Update neckline on pattern detection if isDoubleBottom necklineBullish := swingHighBetween breakoutBullish := false
// Breakout and Retest Logic breakoutBullish := close > necklineBullish and not breakoutBullish retestBullish = breakoutBullish and low <= necklineBullish and close > necklineBullish and rsi < oversold
// ============== BEARISH PATTERN (Double Top Retest) ============== var float necklineBearish = na var bool breakoutBearish = false
// Update neckline on pattern detection if isDoubleTop necklineBearish := swingLowBetween breakoutBearish := false
// Breakdown and Retest Logic breakoutBearish := close < necklineBearish and not breakoutBearish retestBearish = breakoutBearish and high >= necklineBearish and close < necklineBearish and rsi > overbought
// ~~~~~~~~~~~~~~ BUY/SELL CONDITIONS ~~~~~~~~~~~~~~ // BUY Signal: Bullish retest OR EMA crossover + RSI oversold buyCondition = retestBullish or (ta.crossover(close, ema) and rsi < oversold)
// SELL Signal: Bearish retest OR EMA crossunder + RSI overbought sellCondition = retestBearish or (ta.crossunder(close, ema) and rsi > overbought)
// ==================== PATTERNS ==================== // 1. Double Bottom (Bullish) var float bullishNeckline = na var bool bullishBreakout = false swingLow1 = ta.lowest(low, 5) swingLow2 = ta.lowest(low, 5)[5] swingHighBetween = ta.highest(high, 5) isDoubleBottom = swingLow1 >= swingLow2 * 0.99 and swingLow1 <= swingLow2 * 1.01 and swingHighBetween > swingLow1 if isDoubleBottom bullishNeckline := swingHighBetween bullishBreakout := false bullishBreakout := close > bullishNeckline and not bullishBreakout retestBullish = bullishBreakout and low <= bullishNeckline and close > bullishNeckline and rsi < oversold
// 2. Double Top (Bearish) var float bearishNeckline = na var bool bearishBreakout = false swingHigh1 = ta.highest(high, 5) swingHigh2 = ta.highest(high, 5)[5] swingLowBetween = ta.lowest(low, 5) isDoubleTop = swingHigh1 <= swingHigh2 * 1.01 and swingHigh1 >= swingHigh2 * 0.99 and swingLowBetween < swingHigh1 if isDoubleTop bearishNeckline := swingLowBetween bearishBreakout := false bearishBreakout := close < bearishNeckline and not bearishBreakout retestBearish = bearishBreakout and high >= bearishNeckline and close < bearishNeckline and rsi > overbought
// 3. Trendline Breakout/Breakdown upTrendline = ta.lowest(low, trendlineLength) downTrendline = ta.highest(high, trendlineLength) breakout = close > upTrendline and volume > ta.sma(volume, 20) breakdown = close < downTrendline and volume > ta.sma(volume, 20)
// ~~~~~~~~~~~~~~~~~~~~ BUY/SELL SIGNALS ~~~~~~~~~~~~~~~~~~~~ buyCondition = retestBullish or breakout sellCondition = retestBearish or breakdown
// ~~~~~~~~~~~~~~~~~~~~ PLOT "BUY" AND "SELL" TEXT ON CHART ~~~~~~~~~~~~~~~~~~~~ plotshape(buyCondition, title="BUY", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY", textcolor=color.white, size=size.normal) plotshape(sellCondition, title="SELL", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL", textcolor=color.white, size=size.normal)
// ~~~~~~~~~~~~~~~~~~~~ EXECUTE ORDERS ~~~~~~~~~~~~~~~~~~~~ if (buyCondition) strategy.entry("BUY", strategy.long) if (sellCondition) strategy.close("BUY")
Dengan semangat TradingView yang sesungguhnya, penulis skrip ini telah menerbitkannya sebagai sumber terbuka, sehingga para trader dapat memahami dan memverifikasinya. Hormat untuk penulisnya! Anda dapat menggunakannya secara gratis, namun penggunaan kembali kode ini dalam publikasi diatur oleh Tata Tertib. Anda dapat memfavoritkannya untuk digunakan pada chart
Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.