OPEN-SOURCE SCRIPT

MACD Histogram Sifira Yaklasanlar

151
//version=6
indicator("MACD Histogram Sifira Yaklasanlar", overlay=false)

// 1. Standart MACD Parametreleri ve Hesaplamasi
fast_length = input.int(12, title="Hizli Uzunluk")
slow_length = input.int(26, title="Yavas Uzunluk")
signal_length = input.int(9, title="Sinyal Uzunlugu")
[macdLine, signalLine, histLine] = ta.macd(close, fast_length, slow_length, signal_length)

// 2. Kullanici Giris Ayarlari (Tolerans Seviyesi)
tolerans = input.float(0.05, title="Sifira Yaklasma Toleransi (Mesafe)")

// 3. Mantiksal Kosullar (Gorseldeki Senaryo)
// Kosul: Histogram 0'in altinda (Kirmizi) VE Son bar bir onceki bardan buyuk (Satis azaliyor)
// VE Histogram 0'a belirlenen tolerans mesafesinden daha yakin.
satis_azaliyor = histLine < 0 and histLine > histLine[1] and histLine >= -tolerans

// 4. Tarayici (Screener) Sutunu Icin Sayisal Cikti Uretme
plot(satis_azaliyor ? 1 : 0, title="TaramaSinyali", display=display.none)

// 5. Grafik Uzerinde Gorsellestirme
// Sürüm 6 uyumlu renk fonksiyonu dinamikleri
hist_color = histLine >= 0 ? (histLine > histLine[1] ? color.green : color.lime) : (histLine > histLine[1] ? color.maroon : color.red)
plot(histLine, title="Histogram", style=plot.style_columns, color=hist_color)
hline(0, "Sifir Cizgisi", color=color.gray, linestyle=hline.style_dashed)
plotshape(satis_azaliyor, title="Sinyal Noktasi", style=shape.circle, location=location.bottom, color=color.yellow, size=size.small)

Disclaimer

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.