//@version=5
indicator(title="CCI Pozitif - Negatif Uyumsuzluk ", format=format.price)
len = input.int(title="CCI Period", minval=1, defval=14)
src = input(title="CCI Source", defval=close)
lbR = input(title="Pivot Lookback Right", defval=5, display = display.data_window)
lbL = input(title="Pivot Lookback Left", defval=5, display = display.data_window)
rangeUpper = input(title="Max of Lookback Range", defval=60, display = display.data_window)
rangeLower = input(title="Min of Lookback Range", defval=5, display = display.data_window)
plotBull = input(title="Pozitif Uyumsuzluk", defval=true, display = display.data_window)
plotHiddenBull = input(title="Gizli Pozitif Uyumsuzluk", defval=true, display = display.data_window)
plotBear = input(title="Negatif Uyumsuzluk", defval=true, display = display.data_window)
plotHiddenBear = input(title="Gizli Negatif Uyumsuzluk", defval=true, display = display.data_window)
bearColor = color.red
bullColor = color.green
hiddenBullColor = color.green
hiddenBearColor = color.red
textColor = color.white
noneColor = color.new(color.white, 100)
osc = ta.cci(src, len)
// SMA Calculation
smaLength = input.int(title="SMA", minval=1, defval=14)
smaCCI = ta.sma(osc, smaLength)
plot(smaCCI, title="SMA", linewidth=2, color=color.orange)
plot(osc, title="CCI", linewidth=2, color=color.rgb(159, 21, 201))
hline(0, title="Middle Line", color=color.rgb(185, 31, 206), linestyle=hline.style_dotted)
obLevel = hline(100, title="Overbought", color=#787B86, linestyle=hline.style_dotted)
osLevel = hline(-100, title="Oversold", color=#787B86, linestyle=hline.style_dotted)
fill(obLevel, osLevel, title="Background", color=color.rgb(33, 150, 243, 90))
plFound = na(ta.pivotlow(osc, lbL, lbR)) ? false : true
phFound = na(ta.pivothigh(osc, lbL, lbR)) ? false : true
_inRange(cond) =>
bars = ta.barssince(cond == true)
rangeLower <= bars and bars <= rangeUpper
//------------------------------------------------------------------------------
// Regular Bullish
// Osc: Higher Low
oscHL = osc[lbR] > ta.valuewhen(plFound, osc[lbR], 1) and _inRange(plFound[1])
// Price: Lower Low
priceLL = low[lbR] < ta.valuewhen(plFound, low[lbR], 1)
bullCondAlert = priceLL and oscHL and plFound
bullCond = plotBull and bullCondAlert
plot(
plFound ? osc[lbR] : na,
offset=-lbR,
title="Regular Bullish",
linewidth=2,
color=(bullCond ? bullColor : noneColor),
display = display.pane
)
plotshape(
bullCond ? osc[lbR] : na,
offset=-lbR,
title="Regular Bullish Label",
text=" PU ",
style=shape.labelup,
location=location.absolute,
color=bullColor,
textcolor=textColor
)
//------------------------------------------------------------------------------
// Hidden Bullish
// Osc: Lower Low
oscLL = osc[lbR] < ta.valuewhen(plFound, osc[lbR], 1) and _inRange(plFound[1])
// Price: Higher Low
priceHL = low[lbR] > ta.valuewhen(plFound, low[lbR], 1)
hiddenBullCondAlert = priceHL and oscLL and plFound
hiddenBullCond = plotHiddenBull and hiddenBullCondAlert
plot(
plFound ? osc[lbR] : na,
offset=-lbR,
title="Hidden Bullish",
linewidth=2,
color=(hiddenBullCond ? hiddenBullColor : noneColor),
display = display.pane
)
plotshape(
hiddenBullCond ? osc[lbR] : na,
offset=-lbR,
title="Hidden Bullish Label",
text=" Gizli PU ",
style=shape.labelup,
location=location.absolute,
color=bullColor,
textcolor=textColor
)
//------------------------------------------------------------------------------
// Regular Bearish
// Osc: Lower High
oscLH = osc[lbR] < ta.valuewhen(phFound, osc[lbR], 1) and _inRange(phFound[1])
// Price: Higher High
priceHH = high[lbR] > ta.valuewhen(phFound, high[lbR], 1)
bearCondAlert = priceHH and oscLH and phFound
bearCond = plotBear and bearCondAlert
plot(
phFound ? osc[lbR] : na,
offset=-lbR,
title="Regular Bearish",
linewidth=2,
color=(bearCond ? bearColor : noneColor),
display = display.pane
)
plotshape(
bearCond ? osc[lbR] : na,
offset=-lbR,
title="Regular Bearish Label",
text=" NU ",
style=shape.labeldown,
location=location.absolute,
color=bearColor,
textcolor=textColor
)
//------------------------------------------------------------------------------
// Hidden Bearish
// Osc: Higher High
oscHH = osc[lbR] > ta.valuewhen(phFound, osc[lbR], 1) and _inRange(phFound[1])
// Price: Lower High
priceLH = high[lbR] < ta.valuewhen(phFound, high[lbR], 1)
hiddenBearCondAlert = priceLH and oscHH and phFound
hiddenBearCond = plotHiddenBear and hiddenBearCondAlert
plot(
phFound ? osc[lbR] : na,
offset=-lbR,
title="Hidden Bearish",
linewidth=2,
color=(hiddenBearCond ? hiddenBearColor : noneColor),
display = display.pane
)
plotshape(
hiddenBearCond ? osc[lbR] : na,
offset=-lbR,
title="Hidden Bearish Label",
text=" Gizli NU ",
style=shape.labeldown,
location=location.absolute,
color=bearColor,
textcolor=textColor
)
alertcondition(bullCondAlert, title='Regular Bullish Divergence', message="Found a new Regular Bullish Divergence, `Pivot Lookback Right` number of bars to the left of the current bar")
alertcondition(hiddenBullCondAlert, title='Hidden Bullish Divergence', message='Found a new Hidden Bullish Divergence, `Pivot Lookback Right` number of bars to the left of the current bar')
alertcondition(bearCondAlert, title='Regular Bearish Divergence', message='Found a new Regular Bearish Divergence, `Pivot Lookback Right` number of bars to the left of the current bar')
alertcondition(hiddenBearCondAlert, title='Hidden Bearish Divergence', message='Found a new Hidden Bearish Divergence, `Pivot Lookback Right` number of bars to the left of the current bar')
Bu kod, TradingView için yazılmış bir CCI Göstergesi ve Uyumsuzluk (Divergence) Tespit Sistemi'dir. Temel olarak şu işlevleri yerine getirir:
Belirlenen periyotta (varsayılan 14) CCI değerlerini hesaplar
CCI çizgisini mor renkte gösterir
0 (sıfır) seviyesini noktalı çizgi olarak işaretler
+100/-100 aşırı alım/satım seviyelerini gösterir
Bu seviyeler arasını mavi renkli arka planla doldurur
CCI değerlerinin üzerine 14 periyotluk bir SMA ekler
SMA turuncu renkte gösterilir
Fiyat: Daha düşük dip (Lower Low)
CCI: Daha yüksek dip (Higher Low)
Sinyal: Trend dönüşümü (alım fırsatı)
Görsel: Yeşil "PU" etiketi
Fiyat: Daha yüksek dip (Higher Low)
CCI: Daha düşük dip (Lower Low)
Sinyal: Trend devamı (alım fırsatı)
Görsel: Yeşil "Gizli PU" etiketi
Fiyat: Daha yüksek tepe (Higher High)
CCI: Daha düşük tepe (Lower High)
Sinyal: Trend dönüşümü (satım fırsatı)
Görsel: Kırmızı "NU" etiketi
Fiyat: Daha düşük tepe (Lower High)
CCI: Daha yüksek tepe (Higher High)
Sinyal: Trend devamı (satım fırsatı)
Görsel: Kırmızı "Gizli NU" etiketi
Pivot noktası tespiti: Sağ/sol bakış pencereleriyle esnek ayar
Zaman aralığı filtresi: 5-60 bar arası uyumsuzlukları filtreler
Alert (uyarı) sistemi: Her 4 uyumsuzluk türü için ayrı alert koşulu
Kullanıcı kontrolleri: Hangi uyumsuzlukların gösterileceği seçilebilir
Bu gösterge, trend dönüşümleri ve trend devam sinyalleri tespit etmek için kullanılır:
Regular divergences: Mevcut trendin tersine döneceğini öngörür
Hidden divergences: Mevcut trendin devam edeceğini gösterir
Traderlere fiyat hareketi ile CCI momentum göstergesi arasındaki uyumsuzluğu görselleştirerek, olası alım-satım noktalarını belirlemede yardımcı olur.