Untitled
unknown
plain_text
2 months ago
3.1 kB
22
Indexable
//@version=6 indicator(title="BB % ve KC % Birleşik Gösterge", shorttitle="BB & KC %", overlay=false) // === Girdiler === // Bollinger Bantları bb_length = input.int(20, title="BB Periyot") bb_mult = input.float(2.0, title="BB Çarpan") bb_maType = input.string("SMA", "BB MA Türü", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"]) bb_src = input(close, title="BB Kaynak") bb_threshold = input.int(4, title="BB Eşik Yüzdesi") // Keltner Kanalları kc_length = input.int(20, title="KC MA Periyot") kc_mult = input.float(2.0, title="KC Çarpan") kc_src = input(close, title="KC Kaynak") kc_exp = input(true, title="KC'de EMA Kullan", display=display.data_window) kc_BandsStyle = input.string("Average True Range", options=["Average True Range", "True Range", "Range"], title="KC Bant Türü") kc_atrlength = input(10, title="KC ATR Periyot") kc_threshold = input.int(4, title="KC Eşik Yüzdesi") // Ortalama için eşik değeri average_threshold = input.int(5, title="Ortalama Yüzde Eşik Değeri") // === Hareketli Ortalama Fonksiyonları === ma(source, length, _type) => switch _type "SMA" => ta.sma(source, length) "EMA" => ta.ema(source, length) "SMMA (RMA)" => ta.rma(source, length) "WMA" => ta.wma(source, length) "VWMA" => ta.vwma(source, length) esma(source, length) => kc_exp ? ta.ema(source, length) : ta.sma(source, length) // === Bollinger Bantları Hesaplamaları === bb_basis = ma(bb_src, bb_length, bb_maType) bb_dev = bb_mult * ta.stdev(bb_src, bb_length) bb_upper = bb_basis + bb_dev bb_lower = bb_basis - bb_dev bb_percentage = ((bb_upper - bb_lower) / bb_src) * 100 // === Keltner Kanalları Hesaplamaları === kc_ma = esma(kc_src, kc_length) kc_rangema = kc_BandsStyle == "True Range" ? ta.tr(true) : kc_BandsStyle == "Average True Range" ? ta.atr(kc_atrlength) : ta.rma(high - low, kc_length) kc_upper = kc_ma + kc_rangema * kc_mult kc_lower = kc_ma - kc_rangema * kc_mult kc_percentage = ((kc_upper - kc_lower) / kc_src) * 100 // === Ortalamalarını Hesaplama === average_percentage = (bb_percentage + kc_percentage) / 2 // === Dinamik Renklendirme === bb_color = bb_percentage > bb_threshold ? color.red : color.teal kc_color = kc_percentage > kc_threshold ? color.orange : color.blue average_color = average_percentage > average_threshold ? color.purple : color.green // === Grafik Elemanları === // BB Yüzdesi plot(bb_percentage, title="BB Yüzde", color=bb_color, style=plot.style_columns) // KC Yüzdesi plot(kc_percentage, title="KC Yüzde", color=kc_color, style=plot.style_columns) // Ortalama Yüzdesi plot(average_percentage, title="Ortalama Yüzde", color=average_color, style=plot.style_columns) // === Referans Çizgileri === hline(bb_threshold, "BB Threshold", color=color.gray, linestyle=hline.style_dotted) hline(kc_threshold, "KC Threshold", color=color.gray, linestyle=hline.style_dotted) hline(average_threshold, "Ortalama Threshold", color=color.gray, linestyle=hline.style_dotted)
Editor is loading...
Leave a Comment