Untitled
unknown
plain_text
2 months ago
64 kB
8
Indexable
//@version=5 indicator('RSN_KALE', overlay = true, max_labels_count = 500, max_boxes_count = 500) // INPUTS // Kısa ve uzun EMA'lar için farklı hareketli ortalama türlerini seçme imkanı short_ma_type = input.string("EMA", title="Kısa MA", options=["Kalman", "EMA", "SMA", "WMA", "RMA", "EMA2", "RMA2"], inline="KISA_Ema", group='HAREKETLİ ORTALAMA') long_ma_type = input.string("EMA", title="Uzun MA", options=["Kalman", "EMA", "SMA", "WMA", "RMA", "EMA2", "RMA2"], inline="UZUN_Ema", group='HAREKETLİ ORTALAMA') // Kısa ve uzun hareketli ortalama length parametreleri int KISA_Ema = input.int(12, title="Kısa MA", inline="KISA_Ema", group='HAREKETLİ ORTALAMA') int UZUN_Ema = input.int(26, title="Uzun MA", inline="UZUN_Ema", group='HAREKETLİ ORTALAMA') bool retest_sig = true bool candle_color = input.bool(true, 'BAR COLOR', inline = 'colors') color upper_col = input.color(#13bd6e, 'up', inline = 'colors') color lower_col = input.color(#b1232f, 'dn', inline = 'colors') // ATR Calculation float atr = ta.atr(55) * 0.5 var lower_box = box(na) var upper_box = box(na) // Kalman filter function kalman_filter(src, length, R = 0.01, Q = 0.1) => var float estimate = na var float error_est = 1.0 var float error_meas = R * length var float kalman_gain = 0.0 var float prediction = na if na(estimate) estimate := src prediction := estimate kalman_gain := error_est / (error_est + error_meas) estimate := prediction + kalman_gain * (src - prediction) error_est := (1 - kalman_gain) * error_est + Q / length estimate // EMA2 Function ema2(src, length) => alpha = 2 / (length + 1) var float result = na result := na(result[1]) ? src : alpha * src + (1 - alpha) * result[1] result // RMA2 Function rma2(src, length) => alpha = 1 / length var float result = na result := na(result[1]) ? src : alpha * src + (1 - alpha) * result[1] result // Calculate the selected moving average for both short and long float short_ma = na float long_ma = na // Kısa dönem hareketli ortalama hesaplaması if short_ma_type == "Kalman" short_ma := kalman_filter(close, KISA_Ema) else if short_ma_type == "EMA" short_ma := ta.ema(close, KISA_Ema) else if short_ma_type == "SMA" short_ma := ta.sma(close, KISA_Ema) else if short_ma_type == "WMA" short_ma := ta.wma(close, KISA_Ema) else if short_ma_type == "RMA" short_ma := ta.rma(close, KISA_Ema) else if short_ma_type == "EMA2" short_ma := ema2(close, KISA_Ema) else if short_ma_type == "RMA2" short_ma := rma2(close, KISA_Ema) // Uzun dönem hareketli ortalama hesaplaması if long_ma_type == "Kalman" long_ma := kalman_filter(close, UZUN_Ema) else if long_ma_type == "EMA" long_ma := ta.ema(close, UZUN_Ema) else if long_ma_type == "SMA" long_ma := ta.sma(close, UZUN_Ema) else if long_ma_type == "WMA" long_ma := ta.wma(close, UZUN_Ema) else if long_ma_type == "RMA" long_ma := ta.rma(close, UZUN_Ema) else if long_ma_type == "EMA2" long_ma := ema2(close, UZUN_Ema) else if long_ma_type == "RMA2" long_ma := rma2(close, UZUN_Ema) // Trend Detection Logic bool trend_up = short_ma > long_ma color trend_col = trend_up ? upper_col : lower_col color trend_col1 = short_ma > short_ma[2] ? upper_col : lower_col color candle_col = candle_color ? trend_up and short_ma > short_ma[2] ? upper_col : not trend_up and short_ma < short_ma[2] ? lower_col : color.rgb(255, 255, 255, 26) : na // PLOTTING if trend_up and not trend_up[1] label.new(bar_index, short_ma, '\n' + str.tostring(math.round(close, 1)), color = color(na), textcolor = upper_col, style = label.style_label_up, size = size.normal) lower_box := box.new(bar_index, low + atr, bar_index, low, border_color = na, bgcolor = color.new(color.green, 80)) lower_box if not ta.change(trend_up) lower_box.set_right(bar_index) if trend_up[1] and not trend_up label.new(bar_index, short_ma, str.tostring(math.round(close, 1)) + '\n', color = color(na), textcolor = lower_col, style = label.style_label_down, size = size.normal) upper_box := box.new(bar_index, high, bar_index, high - atr, border_color = na, bgcolor = color.new(color.red, 80)) upper_box if not ta.change(trend_up) upper_box.set_right(bar_index) if retest_sig if high < upper_box.get_bottom() and high[1] >= upper_box.get_bottom() label.new(bar_index - 1, high[1], '', color = color(na), textcolor = lower_col, style = label.style_label_down, size = size.normal) if low > lower_box.get_top() and low[1] <= lower_box.get_top() label.new(bar_index - 1, low[1], '', color = color(na), textcolor = upper_col, style = label.style_label_up, size = size.normal) // Plot short and long moving averages p1 = plot(short_ma, 'Kısa MA', color = trend_col1, display = display.none) p2 = plot(long_ma, 'Uzun MA', linewidth = 2, color = trend_col, display = display.none) // Plotting candles plotcandle(open, high, low, close, title = 'RSN_KALE', color = candle_col, wickcolor = candle_col, bordercolor = candle_col) //////hacim tablo/////// // Kullanıcıdan sembol girişleri // Tabloyu göster/gizle düğmesi showTable = input.bool(true, title="HACİM TABLOSUNU GÖSTER") string s01 = syminfo.tickerid // Mevcut grafikteki sembol kullanılır frame_color1 = input.color(#000000, title="Çerçeve Rengi") frame_width1 = input.int(2, title="Çerçeve Kalınlığı", minval=1, maxval=5) // Parametreler lookbackPeriod = input.int(20, title="Geriye Dönük Mum Sayısı") // Tablo konumu için kullanıcı girişi tablePosition1 = input.string("top_center", title="Tablo Konumu", options=["top_left", "top_center", "top_right", "bottom_left", "bottom_center", "bottom_right"]) // Tablo boyutu için kullanıcı girişi tableSize = input.string("normal", title="Tablo Boyutu", options=["tiny", "small", "normal", "large"]) // Tablo stil ayarları için kullanıcı girişleri tableBgColor1 = input.color(color.new(color.gray, 90), title="Tablo Arka Plan Rengi") tableBorderColor1 = input.color(color.blue, title="Tablo Çerçeve Rengi") tableBorderWidth1 = input.int(1, title="Tablo Çerçeve Kalınlığı", minval=1, maxval=5) // Renk seçenekleri için kullanıcı girişleri headerColor = input.color(color.new(color.blue, 0), title="Başlık Arka Plan Rengi") buyColor = input.color(color.new(color.green, 85), title="Alış Hacmi Rengi") sellColor = input.color(color.new(color.red, 85), title="Satış Hacmi Rengi") resultBuyColor = input.color(color.new(color.green, 0), title="Sonuç Alış Rengi") resultSellColor = input.color(color.new(color.red, 0), title="Sonuç Satış Rengi") textColor = input.color(color.white, title="Metin Rengi") // Hücre boyutlarını belirleme fonksiyonu getFontSize(size) => switch size "tiny" => size.tiny "small" => size.small "normal" => size.normal "large" => size.large // Hacim hesaplama fonksiyonu calculateVolumes(closeData, volumeData) => float upVolumeSum = 0.0 float downVolumeSum = 0.0 for i = 0 to lookbackPeriod - 1 upVolumeSum += (closeData[i] > closeData[i + 1] ? volumeData[i] : 0) downVolumeSum += (closeData[i] < closeData[i + 1] ? volumeData[i] : 0) totalVolume = upVolumeSum + downVolumeSum result = upVolumeSum > downVolumeSum ? "Pozitif" : "Negatif" [upVolumeSum, downVolumeSum, result] // Mevcut sembol için hacim hesaplaması [up1, down1, res1] = calculateVolumes(close, volume) // Tablo oluştur var table volumeTable = na if showTable if na(volumeTable) volumeTable := table.new(position=tablePosition1, columns=4, rows=2, bgcolor=tableBgColor1, border_color=tableBorderColor1, border_width=tableBorderWidth1, frame_color=frame_color1, frame_width=frame_width1) // Başlık satırı if bar_index == 0 table.cell(volumeTable, 0, 0, "Hacim Analizi", bgcolor=headerColor, text_color=textColor, text_size=getFontSize(tableSize)) table.cell(volumeTable, 1, 0, "Alış Hacmi", bgcolor=headerColor, text_color=textColor, text_size=getFontSize(tableSize)) table.cell(volumeTable, 2, 0, "Satış Hacmi", bgcolor=headerColor, text_color=textColor, text_size=getFontSize(tableSize)) table.cell(volumeTable, 3, 0, "Sonuç", bgcolor=headerColor, text_color=textColor, text_size=getFontSize(tableSize)) // Mevcut sembol verilerini tabloya ekle table.cell(volumeTable, 0, 1, s01, text_color=textColor, text_size=getFontSize(tableSize)) table.cell(volumeTable, 1, 1, str.tostring(up1, format.volume), bgcolor=buyColor, text_color=textColor, text_size=getFontSize(tableSize)) table.cell(volumeTable, 2, 1, str.tostring(down1, format.volume), bgcolor=sellColor, text_color=textColor, text_size=getFontSize(tableSize)) table.cell(volumeTable, 3, 1, res1, bgcolor=res1 == "Pozitif" ? resultBuyColor : resultSellColor, text_color=textColor, text_size=getFontSize(tableSize)) else if not na(volumeTable) table.delete(volumeTable) volumeTable := na // // Fisher Transform // len = input.int(10, minval=1, title='Length') // higherTimeframe = input.timeframe("W", title="Higher Timeframe") // Default higher timeframe set to 1 week // // Retrieve data from the higher timeframe // high_ = request.security(syminfo.tickerid, higherTimeframe, ta.highest(hl2, len)) // low_ = request.security(syminfo.tickerid, higherTimeframe, ta.lowest(hl2, len)) // round_(val) => // val > .99 ? .999 : val < -.99 ? -.999 : val // value = 0.0 // value := round_(.66 * ((hl2 - low_) / (high_ - low_) - .5) + .67 * nz(value[1])) // fish1 = 0.0 // fish1 := .5 * math.log((1 + value) / (1 - value)) + .5 * nz(fish1[1]) // fish2 = fish1[1] // fishfup = ta.crossover(fish1, fish2) // fishdw = ta.crossunder(fish1, fish2) // // Buy and Sell Conditions // buySignal = ta.crossover(fish1, fish2) // Fisher crosses above trigger (buy signal) // sellSignal = ta.crossunder(fish1, fish2) // Fisher crosses below trigger (sell signal) // // // Plot Buy and Sell Labels // if (buySignal) // label.new(bar_index, low, "Fish_Al", color=#09daff2d, style=label.style_label_up, textcolor=color.white, size=size.small) // if (sellSignal) // label.new(bar_index, high, "Fish_Sat", color=color.rgb(7, 54, 241, 80), style=label.style_label_down, textcolor=color.white, size=size.small) // Comparative Relative Strength calculations comparativeTickerId = input.symbol('BIST:XU100', title = 'KOM SYMBOL', inline="group3", group='Komp - RSI Settings') src1 = close baseSymbol = request.security(syminfo.tickerid, timeframe.period, src1) comparativeSymbol = request.security(comparativeTickerId, timeframe.period, src1) crs = baseSymbol / comparativeSymbol rsiLength = input.int(14, minval = 1, title = 'RSI', inline="group3", group='Komp - RSI Settings') higherRSI = ta.rsi(crs, rsiLength) // MACD ayarları fastLength = input.int(12, title='Fast', inline="group1", group='Macd Settings') slowLength = input.int(26, title='Slow', inline="group1", group='Macd Settings') signalSmoothing = input.int(9, title='Signal', inline="group1", group='Macd Settings') [macdLine, signalLine, _] = ta.macd(close, fastLength, slowLength, signalSmoothing) buySignalm = ta.crossover(macdLine, 0) sellSignalm = ta.crossunder(macdLine, 0) macdsart = macdLine > 0 kalmanf = short_ma > long_ma buySignal34 = ta.crossover(macdLine, signalLine) and macdsart and kalmanf sellSignal34 = ta.crossunder(macdLine, signalLine) and macdsart and kalmanf // Çizim koşulları plotshape(buySignal34, location=location.belowbar, style=shape.arrowup, title='TEKRAR AL', text='TEKRAR AL', textcolor=#eac809, size=size.normal, offset=0) plotshape(sellSignal34, location=location.abovebar, style=shape.arrowdown, title='KAR AL', text='KAR AL', textcolor=#00ffbf, size=size.normal, offset=0) // plotshape(buySignal, location=location.belowbar, color=color.green, style=shape.diamond, title='Macd AL', text='M_AL', size=size.small, offset=0, display = display.none) // plotshape(sellSignal, location=location.abovebar, color=color.red, style=shape.diamond, title='Macd Sat', text='M_SAT', size=size.small, offset=0, display = display.none) // Add enable/disable settings for comparative EMAs show_comp_ema34 = input.bool(false, "KOMP EMA 34", group="Comparative EMA Display") show_comp_ema55 = input.bool(false, "KOMP EMA 55", group="Comparative EMA Display") show_comp_ema89 = input.bool(false, "KOMP EMA 89", group="Comparative EMA Display") show_comp_ema233 = input.bool(false, "KOMP EMA 233", group="Comparative EMA Display") show_comp_ema377 = input.bool(false, "KOMP EMA 377", group="Comparative EMA Display") show_comp_ema610 = input.bool(false, "KOMP EMA 610", group="Comparative EMA Display") show_comp_ema987 = input.bool(false, "KOMP EMA 987", group="Comparative EMA Display") show_comp_ema1597 = input.bool(false, "KOMP EMA 1597", group="Comparative EMA Display") show_comp_ema2584 = input.bool(false, "KOMP EMA 2584", group="Comparative EMA Display") show_comp_ema4181 = input.bool(false, "KOMP EMA 4181", group="Comparative EMA Display") showema55_1s = input.bool(true, "EMA 55 1s", group="EMA Values") // Add text size control for comparative EMA labels comp_ema_text_size = input.string("normal", "KOMP EMA Label Size", options=["tiny", "small", "normal", "large"], group="Comparative EMA Display") // Convert text size input to size constant get_text_size() => switch comp_ema_text_size "tiny" => size.tiny "small" => size.small "large" => size.large => size.normal // EMA Length inputs (unchanged) emaLength1 = input.int(12, title = ' EMA 12', group="EMA Values") emaLength2 = input.int(26, title = ' EMA 26', group="EMA Values") emaLength12 = input.int(14, title = ' EMA 14', group="EMA Values") emaLength3 = input.int(34, title = ' EMA 34', group="EMA Values") emaLength4 = input.int(55, title = ' EMA 55', group="EMA Values") emaLength10 = input.int(89, title = ' EMA 89', group="EMA Values") emaLength5 = input.int(144, title = ' EMA 144', group="EMA Values") emaLength6 = input.int(233, title = ' EMA 233', group="EMA Values") emaLength7 = input.int(377, title = ' EMA 377', group="EMA Values") emaLength8 = input.int(610, title = ' EMA 610', group="EMA Values") emaLength9 = input.int(987, title = ' EMA 987', group="EMA Values") emaLength11 = input.int(1597, title = ' EMA 1597', group="EMA Values") emaLength13 = input.int(115, title = ' PIVOT 115', group="EMA Values") // Calculate Regular EMAs ema12 = ta.ema(close, emaLength1) ema26 = ta.ema(close, emaLength2) ema14 = ta.ema(close, emaLength12) ema34 = ta.ema(close, emaLength3) ema55 = ta.ema(close, emaLength4) ema89 = ta.ema(close, emaLength10) ema144 = ta.ema(close, emaLength5) ema233 = ta.ema(close, emaLength6) ema377 = ta.ema(close, emaLength7) ema610 = ta.ema(close, emaLength8) ema987 = ta.ema(close, emaLength9) ema1597 = ta.ema(close, emaLength11) ema115 = ta.ema(close, emaLength13) // Plot Regular EMAs wiith conditional plotting plot(ema12, title = 'EMA 12', color = #368c3c, linewidth = 2, display = display.none) plot(ema26, title = 'EMA 26', color = #e4cb0c, linewidth = 2, display = display.none) plot(ema14, title = 'EMA 14', color = color.rgb(0, 255, 17), linewidth = 2, display = display.none) plot(ema34, title = 'EMA 34', color = color.rgb(253, 0, 0), linewidth = 2) plot(ema55, title = 'EMA 55', color = #f8a407, linewidth = 2) plot(ema89, title = 'EMA 89', color = color.rgb(207, 193, 166), linewidth = 2, display = display.none) plot(ema144, title = 'EMA 144', color = color.rgb(184, 25, 232), linewidth = 2, display = display.none) plot(ema233, title = 'EMA 233', color = color.rgb(0, 203, 254), linewidth = 2, display = display.none) plot(ema377, title = 'EMA 377', color = color.rgb(7, 89, 240), linewidth = 2, display = display.none) plot(ema610, title = 'EMA 610', color = color.rgb(124, 128, 131), linewidth = 2, display = display.none) plot(ema987, title = 'EMA 987', color = #fc009b, linewidth = 2, display = display.none) plot(ema1597, title = 'EMA 1597', color = color.rgb(145, 18, 18), linewidth = 2, display = display.none) plot(ema115, title = 'Pivot 115', color = #ea754b, linewidth = 2, display = display.none) up = ta.rma(math.max(ta.change(src1), 0), rsiLength) down = ta.rma(-math.min(ta.change(src1), 0), rsiLength) rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - 100 / (1 + up / down) // MACD settings higherrsi_CrossUp = ta.crossover(macdLine, 0) // MACD yukarı kesiş higherrsi_Crossdown = ta.crossunder(macdLine, 0) // MACD aşağı kesiş higherrsi_0 = ta.crossunder(rsi, 30) // MACD aşağı kesiş higherrsi_01 = ta.crossover(rsi, 30) // MACD aşağı kesiş emaCrossUp = ta.crossover(ema34, ema55) // EMA34 yukarı kesiş emaCrossDown = ta.crossunder(ema34, ema55) // EMA34 aşağı kesiş // Al ve Sat koşulları buySignal2 = ta.crossover(macdLine, 0) // MACD pozitif oldu sellSignal2 = ta.crossunder(macdLine, 0) // MACD negatif oldu // // Kullanıcı tarafından seçilebilir zaman dilimi parametresi timeframe_input = input.timeframe("60", title="EMA 55 1s", confirm=true) // EMA 55 hesaplama (seçilen zaman dilimine göre) ema55_1s = request.security(syminfo.tickerid, timeframe_input, ta.ema(close, 55)) // Çizgi ve etiket için değişkenler line_color = #10f751 // Çizgi için kullanılan renk var line ema_line = na // Çizgi değişkeni var label ema_label = na // Etiket değişkeni if bar_index > 6 // EMA 55_1s if showema55_1s if na(ema_line) ema_line := line.new(x1=bar_index, y1=ema55_1s, x2=bar_index + 4, y2=ema55_1s, color=line_color, width=2) else line.set_xy1(ema_line, bar_index, ema55_1s) line.set_xy2(ema_line, bar_index + 4, ema55_1s) label_text = "Ema-55_1s: " + str.tostring(ema55_1s, '#.##') if na(ema_label) ema_label := label.new(x=bar_index + 4, y=ema55_1s, text=label_text, style=label.style_label_left, color=color.new(color.white, 100), textcolor=line_color, size=size.normal) else label.set_x(ema_label, bar_index + 4) label.set_y(ema_label, ema55_1s) label.set_text(ema_label, label_text) label.set_textcolor(ema_label, line_color) label.set_size(ema_label, get_text_size()) else if not na(ema_line) line.delete(ema_line) ema_line := na if not na(ema_label) label.delete(ema_label) ema_label := na // XU100 fiyatı ve EMA uzunlukları xu100 = request.security('BIST:XU100', timeframe.period, close) compEmaLength34 = input.int(34, title='KOM EMA 34', group="Kompozit EMA Values") compEmaLength55 = input.int(55, title='KOM EMA 55', group="Kompozit EMA Values") compEmaLength89 = input.int(89, title='KOM EMA 89', group="Kompozit EMA Values") compEmaLength233 = input.int(233, title='KOM EMA 233', group="Kompozit EMA Values") compEmaLength377 = input.int(377, title='KOM EMA 377', group="Kompozit EMA Values") compEmaLength610 = input.int(610, title='KOM EMA 610', group="Kompozit EMA Values") compEmaLength987 = input.int(987, title='KOM EMA 987', group="Kompozit EMA Values") compEmaLength1597 = input.int(1597, title='KOM EMA 1597', group="Kompozit EMA Values") compEmaLength2584 = input.int(2584, title='KOM EMA 2584', group="Kompozit EMA Values") compEmaLength4181 = input.int(4181, title='KOM EMA 4181', group="Kompozit EMA Values") // Mevcut varlığın fiyatı ile XU100 arasındaki oran üzerinden EMA hesaplama comp_ema34 = ta.ema(close / xu100, compEmaLength34) comp_ema55 = ta.ema(close / xu100, compEmaLength55) comp_ema89 = ta.ema(close / xu100, compEmaLength89) comp_ema233 = ta.ema(close / xu100, compEmaLength233) comp_ema377 = ta.ema(close / xu100, compEmaLength377) comp_ema610 = ta.ema(close / xu100, compEmaLength610) comp_ema987 = ta.ema(close / xu100, compEmaLength987) comp_ema1597 = ta.ema(close / xu100, compEmaLength1597) comp_ema2584 = ta.ema(close / xu100, compEmaLength2584) comp_ema4181 = ta.ema(close / xu100, compEmaLength4181) // Çizgi ve etiketler için değişkenler var line ema_line1 = na var label ema_label1 = na var line ema_line2 = na var label ema_label2 = na var line ema_line3 = na var label ema_label3 = na var line ema_line4 = na var label ema_label4 = na var line ema_line5 = na var label ema_label5 = na var line ema_line6 = na var label ema_label6 = na var line ema_line7 = na var label ema_label7 = na var line ema_line8 = na var label ema_label8 = na var line ema_line9 = na var label ema_label9 = na var line ema_line10 = na var label ema_label10 = na // Çizgileri ve etiketleri oluşturma if bar_index > 6 // EMA 34 if na(ema_line1) and show_comp_ema34 ema_line1 := line.new(x1=bar_index, y1=comp_ema34 * xu100, x2=bar_index + 6, y2=comp_ema34 * xu100, color=#ff0303, width=2) ema_label1 := label.new(x=bar_index + 7, y=comp_ema34 * xu100, text=str.tostring(comp_ema34 * xu100, '#.##'), style=label.style_label_left, color=color.new(color.white, 100), textcolor=#ff0000, size=size.normal) else if show_comp_ema34 line.set_xy1(ema_line1, bar_index, comp_ema34 * xu100) line.set_xy2(ema_line1, bar_index + 6, comp_ema34 * xu100) label.set_x(ema_label1, bar_index + 6) // Çizginin bitiş noktasına sabitle label.set_y(ema_label1, comp_ema34 * xu100) label.set_text(ema_label1, "KOMP-34: " + str.tostring(comp_ema34 * xu100, '#.##')) label.set_size(ema_label1, get_text_size()) // EMA 55 if na(ema_line2) and show_comp_ema55 ema_line2 := line.new(x1=bar_index, y1=comp_ema55 * xu100, x2=bar_index + 6, y2=comp_ema55 * xu100, color=#dac732, width=2) ema_label2 := label.new(x=bar_index + 7, y=comp_ema55 * xu100, text=str.tostring(comp_ema55 * xu100, '#.##'), style=label.style_label_left, color=color.new(color.white, 100), textcolor=#dac732, size=size.normal) else if show_comp_ema55 line.set_xy1(ema_line2, bar_index, comp_ema55 * xu100) line.set_xy2(ema_line2, bar_index + 6, comp_ema55 * xu100) label.set_x(ema_label2, bar_index + 6) label.set_y(ema_label2, comp_ema55 * xu100) label.set_text(ema_label2, "KOMP-55: " + str.tostring(comp_ema55 * xu100, '#.##')) label.set_size(ema_label2, get_text_size()) // EMA 89 if na(ema_line6) and show_comp_ema89 ema_line6 := line.new(x1=bar_index, y1=comp_ema89 * xu100, x2=bar_index + 6, y2=comp_ema89 * xu100, color=#d47210, width=2) ema_label6 := label.new(x=bar_index + 7, y=comp_ema89 * xu100, text=str.tostring(comp_ema89 * xu100, '#.##'), style=label.style_label_left, color=color.new(color.white, 100), textcolor=#d47210, size=size.normal) else if show_comp_ema89 line.set_xy1(ema_line6, bar_index, comp_ema89 * xu100) line.set_xy2(ema_line6, bar_index + 6, comp_ema89 * xu100) label.set_x(ema_label6, bar_index + 6) label.set_y(ema_label6, comp_ema89 * xu100) label.set_text(ema_label6, "KOMP-89: " + str.tostring(comp_ema89 * xu100, '#.##')) label.set_size(ema_label6, get_text_size()) // EMA 233 if na(ema_line3) and show_comp_ema233 ema_line3 := line.new(x1=bar_index, y1=comp_ema233 * xu100, x2=bar_index + 6, y2=comp_ema233 * xu100, color=color.rgb(217, 3, 255), width=2) ema_label3 := label.new(x=bar_index + 7, y=comp_ema233 * xu100, text=str.tostring(comp_ema233 * xu100, '#.##'), style=label.style_label_left, color=color.new(color.white, 100), textcolor=color.rgb(217, 3, 255), size=size.normal) else if show_comp_ema233 line.set_xy1(ema_line3, bar_index, comp_ema233 * xu100) line.set_xy2(ema_line3, bar_index + 6, comp_ema233 * xu100) label.set_x(ema_label3, bar_index + 6) label.set_y(ema_label3, comp_ema233 * xu100) label.set_text(ema_label3, "KOMP-233: " + str.tostring(comp_ema233 * xu100, '#.##')) label.set_size(ema_label3, get_text_size()) // EMA 377 if na(ema_line4) and show_comp_ema377 ema_line4 := line.new(x1=bar_index, y1=comp_ema377 * xu100, x2=bar_index + 6, y2=comp_ema377 * xu100, color=color.rgb(25, 79, 167), width=2) ema_label4 := label.new(x=bar_index + 7, y=comp_ema377 * xu100, text=str.tostring(comp_ema377 * xu100, '#.##'), style=label.style_label_left, color=color.new(color.white, 100), textcolor=color.rgb(25, 79, 167), size=size.normal) else if show_comp_ema377 line.set_xy1(ema_line4, bar_index, comp_ema377 * xu100) line.set_xy2(ema_line4, bar_index + 6, comp_ema377 * xu100) label.set_x(ema_label4, bar_index + 6) label.set_y(ema_label4, comp_ema377 * xu100) label.set_text(ema_label4, "KOMP-377: " + str.tostring(comp_ema377 * xu100, '#.##')) label.set_size(ema_label4, get_text_size()) // EMA 610 if na(ema_line5) and show_comp_ema610 ema_line5 := line.new(x1=bar_index, y1=comp_ema610 * xu100, x2=bar_index + 6, y2=comp_ema610 * xu100, color=color.rgb(106, 98, 98), width=2) ema_label5 := label.new(x=bar_index + 7, y=comp_ema610 * xu100, text=str.tostring(comp_ema610 * xu100, '#.##'), style=label.style_label_left, color=color.new(color.white, 100), textcolor=color.rgb(135, 128, 128), size=size.normal) else if show_comp_ema610 line.set_xy1(ema_line5, bar_index, comp_ema610 * xu100) line.set_xy2(ema_line5, bar_index + 6, comp_ema610 * xu100) label.set_x(ema_label5, bar_index + 6) label.set_y(ema_label5, comp_ema610 * xu100) label.set_text(ema_label5, "KOMP-610: " + str.tostring(comp_ema610 * xu100, '#.##')) label.set_size(ema_label5, get_text_size()) // EMA 987 if na(ema_line8) and show_comp_ema987 ema_line8 := line.new(x1=bar_index, y1=comp_ema987 * xu100, x2=bar_index + 6, y2=comp_ema987 * xu100, color=color.rgb(13, 224, 247), width=2) ema_label8 := label.new(x=bar_index + 7, y=comp_ema987 * xu100, text=str.tostring(comp_ema987 * xu100, '#.##'), style=label.style_label_left, color=color.new(color.white, 100), textcolor=color.rgb(13, 224, 247), size=size.normal) else if show_comp_ema987 line.set_xy1(ema_line8, bar_index, comp_ema987 * xu100) line.set_xy2(ema_line8, bar_index + 6, comp_ema987 * xu100) label.set_x(ema_label8, bar_index + 6) // Çizginin bitiş noktasına sabitle label.set_y(ema_label8, comp_ema987 * xu100) label.set_text(ema_label8, "KOMP-987: " + str.tostring(comp_ema987 * xu100, '#.##')) label.set_size(ema_label8, get_text_size()) // EMA 1597 if na(ema_line7) and show_comp_ema1597 ema_line7 := line.new(x1=bar_index, y1=comp_ema1597 * xu100, x2=bar_index + 6, y2=comp_ema1597 * xu100, color=color.rgb(252, 27, 2), width=2) ema_label7 := label.new(x=bar_index + 7, y=comp_ema1597 * xu100, text="EMA-1597: " + str.tostring(comp_ema1597 * xu100, '#.##'), style=label.style_label_left, color=color.new(color.white, 100), textcolor=color.rgb(252, 27, 2), size=size.normal) else if show_comp_ema1597 line.set_xy1(ema_line7, bar_index, comp_ema1597 * xu100) line.set_xy2(ema_line7, bar_index + 6, comp_ema1597 * xu100) label.set_x(ema_label7, bar_index + 6) label.set_y(ema_label7, comp_ema1597 * xu100) label.set_text(ema_label7, "KOMP-1597: " + str.tostring(comp_ema1597 * xu100, '#.##')) label.set_size(ema_label7, get_text_size()) // EMA 2584 if na(ema_line9) and show_comp_ema2584 ema_line9 := line.new(x1=bar_index, y1=comp_ema2584 * xu100, x2=bar_index + 6, y2=comp_ema2584 * xu100, color=color.rgb(248, 244, 6), width=2) ema_label9 := label.new(x=bar_index + 7, y=comp_ema2584 * xu100, text=str.tostring(comp_ema2584 * xu100, '#.##'), style=label.style_label_left, color=color.new(color.white, 100), textcolor=color.rgb(248, 244, 6), size=get_text_size()) else if show_comp_ema2584 line.set_xy1(ema_line9, bar_index, comp_ema2584 * xu100) line.set_xy2(ema_line9, bar_index + 6, comp_ema2584 * xu100) label.set_x(ema_label9, bar_index + 6) label.set_y(ema_label9, comp_ema2584 * xu100) label.set_text(ema_label9, "KOMP-2584: " + str.tostring(comp_ema2584 * xu100, '#.##')) label.set_size(ema_label9, get_text_size()) // EMA 4181 if na(ema_line10) and show_comp_ema4181 ema_line10 := line.new(x1=bar_index, y1=comp_ema4181 * xu100, x2=bar_index + 6, y2=comp_ema4181 * xu100, color=color.rgb(50, 205, 248), width=2) ema_label10 := label.new(x=bar_index + 7, y=comp_ema4181 * xu100, text=str.tostring(comp_ema4181 * xu100, '#.##'), style=label.style_label_left, color=color.new(color.white, 100), textcolor=color.rgb(50, 205, 248), size=size.large) else if show_comp_ema4181 line.set_xy1(ema_line10, bar_index, comp_ema4181 * xu100) line.set_xy2(ema_line10, bar_index + 6, comp_ema4181 * xu100) label.set_x(ema_label10, bar_index + 6) // Çizginin bitiş noktasına sabitle label.set_y(ema_label10, comp_ema4181 * xu100) label.set_text(ema_label10, str.tostring(comp_ema4181 * xu100, '#.##')) // Percentage changes for different timeframes weeklyClose = request.security(syminfo.tickerid, 'D', close[5]) monthlyClose = request.security(syminfo.tickerid, 'D', close[22]) quarterlyClose = request.security(syminfo.tickerid, 'D', close[66]) weeklyChange = (close - weeklyClose) / weeklyClose * 100 monthlyChange = (close - monthlyClose) / monthlyClose * 100 quarterChange = (close - quarterlyClose) / quarterlyClose * 100 highestHigh = ta.highest(high, 2000) distanceFromPeak = (highestHigh - close) / close * 100 getHigherTimeframe() => higherTimeFrame = timeframe.isweekly ? 'M' : timeframe.isdaily ? 'W' : timeframe.isintraday ? 'D' : 'D' higherTimeFrame // Table for displaying percentage changes tablePosition = input.string('bottom_right', title = 'Table Position', options = ['top_right', 'top_left', 'bottom_right', 'bottom_left']) fontSize = input.string('normal', title = 'Font Size', options = ['tiny', 'small', 'normal', 'large']) frame_color3 = input.color(#000000, title="Ema Çerçeve Rengi") frame_width3 = input.int(2, title="Ema Çerçeve Kalınlığı", minval=1, maxval=5) // Tablo stil ayarları için kullanıcı girişleri tableBgColor3 = input.color(color.new(color.gray, 90), title="Ema Tablo Arka Plan Rengi") tableBorderColor3 = input.color(color.blue, title="Ema Tablo Çerçeve Rengi") tableBorderWidth3 = input.int(1, title="Ema Tablo Çerçeve Kalınlığı", minval=1, maxval=5) fontSizeMap = fontSize == 'normal' ? size.normal : fontSize == 'small' ? size.small : fontSize == 'normal' ? size.normal : size.large positionMap = tablePosition == 'bottom_right' ? position.bottom_right : tablePosition == 'top_left' ? position.top_left : tablePosition == 'bottom_right' ? position.bottom_right : position.bottom_left var table tbl = table.new(positionMap, 8, 2, bgcolor=tableBgColor3, border_color=tableBorderColor3, border_width=tableBorderWidth3, frame_color=frame_color3, frame_width=frame_width3) // Tablo başlıkları if bar_index == 1 table.cell(tbl, 0, 0, syminfo.ticker, text_color = color.orange, text_size = fontSizeMap) table.cell(tbl, 1, 0, 'RSI', text_color = color.orange, text_size = fontSizeMap) table.cell(tbl, 2, 0, 'KOM RSI', text_color = color.orange, text_size = fontSizeMap) table.cell(tbl, 3, 0, 'STOP 34', text_color = color.orange, text_size = fontSizeMap) table.cell(tbl, 4, 0, 'STOP 55', text_color = color.orange, text_size = fontSizeMap) table.cell(tbl, 5, 0, 'Hafta', text_color = color.orange, text_size = fontSizeMap) table.cell(tbl, 6, 0, 'Ay', text_color = color.orange, text_size = fontSizeMap) // table.cell(tbl, 0, 7, '3 Ay', text_color = color.white, text_size = fontSizeMap) table.cell(tbl, 7, 0, 'Dip-Tepe', text_color = color.orange, text_size = fontSizeMap) // EMA 34 değerini tabloya ekleme table.cell(tbl, 0, 1, str.tostring(close, '#.##'), text_color = close >= ema34 ? color.green : color.red, text_size = fontSizeMap) table.cell(tbl, 1, 1, str.tostring(rsi, '#.##'), text_color = rsi >= 50 ? color.green : color.red, text_size = fontSizeMap) table.cell(tbl, 2, 1, str.tostring(higherRSI, '#.##'), text_color = higherRSI >= 50 ? color.green : color.red, text_size = fontSizeMap) table.cell(tbl, 3, 1, str.tostring(ema34, '#.##'), text_color = ema34 >= close ? color.red : color.green, text_size = fontSizeMap) table.cell(tbl, 4, 1, str.tostring(ema55, '#.##'), text_color = ema55 >= close ? color.red : color.green, text_size = fontSizeMap) table.cell(tbl, 5, 1, str.tostring(weeklyChange, '#.##') + '%', text_color = weeklyChange >= 0 ? color.green : color.red, text_size = fontSizeMap) table.cell(tbl, 6, 1, str.tostring(monthlyChange, '#.##') + '%', text_color = monthlyChange >= 0 ? color.green : color.red, text_size = fontSizeMap) // table.cell(tbl, 1, 7, str.tostring(quarterChange, '#.##') + '%', text_color = quarterChange >= 0 ? color.green : color.red, text_size = fontSizeMap) table.cell(tbl, 7, 1, str.tostring(distanceFromPeak, '#.##') + '%', text_color = distanceFromPeak >= 0 ? color.green : color.red, text_size = fontSizeMap) // Alarm ayarları (Enable/Disable) enableEma34Alarm = input.bool(true, title = 'EMA 34 Alarm') enableEma55Alarm = input.bool(true, title = 'EMA 55 Alarm') enablekomp34Alarm = input.bool(true, title = 'KOMP 34 Alarm') enablekomp55Alarm = input.bool(true, title = 'KOMP 55 Alarm') enablekomp89Alarm = input.bool(true, title = 'KOMP 89 Alarm') enablekomp233Alarm = input.bool(true, title = 'KOMP 233 Alarm') // Alarmları etkinleştirme ayarları enableBuyAlarm = input.bool(true, title="TEKRAR AL Alarmını", group="Alarm Ayarları") enableSellAlarm = input.bool(true, title="KAR AL Alarmını", group="Alarm Ayarları") enableTrendAlarm = input.bool(true, title="Trend Alarmını", group="Alarm Ayarları") // EMA 34 Alarm Koşulları ema34CrossUp = ta.crossover(open, ema34) // Fiyat EMA 34'ün üzerine çıkıyor ema34CrossDown = ta.crossunder(open, ema34) // Fiyat EMA 34'ün altına iniyor if enableEma34Alarm if (ema34CrossUp) alert("FİYAT YUKARI KESTİ EMA 34!", alert.freq_once_per_bar) if ema34CrossDown alert('FİYAT AŞAĞI KESTİ EMA 34!', alert.freq_once_per_bar) // EMA 55 Alarm Koşulları ema55CrossUp = ta.crossover(close, ema55) // Fiyat EMA 55'in üzerine çıkıyor ema55CrossDown = ta.crossunder(close, ema55) // Fiyat EMA 55'in altına iniyor if enableEma55Alarm if (ema55CrossUp) alert("FİYAT YUKARI KESTİ EMA 34!", alert.freq_once_per_bar) if ema55CrossDown alert('FİYAT AŞAĞI KESTİ EMA 34!', alert.freq_once_per_bar) komp233CrossUp = ta.crossover(close, comp_ema233) // Fiyat EMA 55'in üzerine çıkıyor komp233CrossDown = ta.crossunder(close, comp_ema233) // Fiyat EMA 55'in altına iniyor if enablekomp233Alarm if (komp233CrossUp) alert("FİYAT YUKARI KESTİ KOMP 233!", alert.freq_once_per_bar) if komp233CrossDown alert('FİYAT AŞAĞI KESTİ KOMP 233!', alert.freq_once_per_bar) komp89CrossUp = ta.crossover(close, comp_ema89) // Fiyat EMA 55'in üzerine çıkıyor komp89CrossDown = ta.crossunder(close, comp_ema89) // Fiyat EMA 55'in altına iniyor if enablekomp89Alarm if (komp89CrossUp) alert("FİYAT YUKARI KESTİ KOMP 89!", alert.freq_once_per_bar) if komp89CrossDown alert('FİYAT AŞAĞI KESTİ KOMP 89!', alert.freq_once_per_bar) komp34CrossUp = ta.crossover(close, comp_ema34) // Fiyat EMA 55'in üzerine çıkıyor komp34CrossDown = ta.crossunder(close, comp_ema34) // Fiyat EMA 55'in altına iniyor if enablekomp34Alarm if (komp34CrossUp) alert("FİYAT YUKARI KESTİ KOMP 34!", alert.freq_once_per_bar) if komp89CrossDown alert('FİYAT AŞAĞI KESTİ KOMP 34!', alert.freq_once_per_bar) komp55CrossUp = ta.crossover(close, comp_ema55) // Fiyat EMA 55'in üzerine çıkıyor komp55CrossDown = ta.crossunder(close, comp_ema55) // Fiyat EMA 55'in altına iniyor if enablekomp55Alarm if (komp55CrossUp) alert("FİYAT YUKARI KESTİ KOMP 55!", alert.freq_once_per_bar) if komp89CrossDown alert('FİYAT AŞAĞI KESTİ KOMP 55!', alert.freq_once_per_bar) // Alarm Koşulları if enableBuyAlarm and buySignal34 alert('TEKRAR AL sinyali oluştu!', alert.freq_once_per_bar) if enableSellAlarm and sellSignal34 alert('KAR AL sinyali oluştu!', alert.freq_once_per_bar) // Trend Alarmı Koşulları if enableTrendAlarm and buySignal34 alert('Trend Alarm: BUY SIGNAL tespit edildi!', alert.freq_once_per_bar) if enableTrendAlarm and sellSignal34 alert('Trend Alarm: SELL SIGNAL tespit edildi!', alert.freq_once_per_bar) // emaFast_tf = input.string("1W", "EMA 8 Timeframe", options=["", "1", "3", "5", "15", "30", "45", "60", "120", "180", "240", "1D", "1W", "1M"], inline="ema8") emaFast_tf = input.timeframe("1W", "EMA 8 Timeframe", inline="ema8") emaFastLength = input.int(8, "Periyot", inline="ema8") ema8Color = input.color(color.green, "Renk", inline="ema8") // emaSlow_tf = input.string("1W", "EMA 14 Timeframe", options=["", "1", "3", "5", "15", "30", "45", "60", "120", "180", "240", "1D", "1W", "1M"], inline="ema14") emaSlow_tf = input.timeframe("1W", "EMA 14 Timeframe", inline="ema14") emaSlowLength = input.int(14, "Periyot", inline="ema14") ema14Color = input.color(color.orange, "Renk", inline="ema14") // kijun_tf = input.string("1W", "Kijun Timeframe", options=["", "1", "3", "5", "15", "30", "45", "60", "120", "180", "240", "1D", "1W", "1M"], inline="kijun") kijun_tf = input.timeframe("1W", "Kijun Timeframe", inline="kijun") kijunPeriod = input.int(26, "Periyot", inline="kijun") kijunColor = input.color(color.purple, "Renk", inline="kijun", display = display.none) ghostColor = input.color(color.green, "Ghost Çizgi Rengi", display = display.none) // Zaman dilimi fonksiyonu // getTimeFrame(timeFrame) => // timeFrame == "" ? timeframe.period : timeFrame // EMA hesaplamaları ema_8 = request.security(syminfo.tickerid, emaFast_tf, ta.ema(close, emaFastLength), barmerge.gaps_off) ema_14 = request.security(syminfo.tickerid, emaSlow_tf, ta.ema(close, emaSlowLength), barmerge.gaps_off) // Kijun hesaplaması kijun = request.security(syminfo.tickerid, kijun_tf, math.avg(ta.lowest(low, kijunPeriod), ta.highest(high, kijunPeriod)), barmerge.gaps_off) // EMA Ghost hesaplaması emaGhost = ema_8 * 1.14 // Çizgilerin çizilmesi plot(ema_8, "EMA 8", color=ema8Color, linewidth=2, display = display.none) plot(ema_14, "EMA 14", color=ema14Color, linewidth=2, display = display.none) plot(kijun, "Kijun", color=kijunColor, linewidth=2, display = display.none) plot(emaGhost, "EMA Ghost", color=ghostColor, linewidth=2, style=plot.style_circles, display = display.none) // Color variables upColor = color.white midColor = color.rgb(104, 118, 136) downColor = #ec17f7 // Source src = input(defval = close, title = 'Source') // Sampling Period // Settings for 5min chart, BTCUSDC. For Other coin, change the paremeters per = input.int(defval = 100, minval = 1, title = 'Sampling Period') // Range Multiplier mult = input.float(defval = 5.0, minval = 0.1, title = 'Range Multiplier') // Smooth Average Range smoothrng(x, t, m) => wper = t * 2 - 1 avrng = ta.ema(math.abs(x - x[1]), t) smoothrng = ta.ema(avrng, wper) * m smoothrng smrng = smoothrng(src, per, mult) // Range Filter rngfilt(x, r) => rngfilt = x rngfilt := x > nz(rngfilt[1]) ? x - r < nz(rngfilt[1]) ? nz(rngfilt[1]) : x - r : x + r > nz(rngfilt[1]) ? nz(rngfilt[1]) : x + r rngfilt filt = rngfilt(src, smrng) // Filter Direction upward = 0.0 upward := filt > filt[1] ? nz(upward[1]) + 1 : filt < filt[1] ? 0 : nz(upward[1]) downward = 0.0 downward := filt < filt[1] ? nz(downward[1]) + 1 : filt > filt[1] ? 0 : nz(downward[1]) // Target Bands hband = filt + smrng lband = filt - smrng // Colors filtcolor = upward > 0 ? upColor : downward > 0 ? downColor : midColor barcolor = src > filt and src > src[1] and upward > 0 ? upColor : src > filt and src < src[1] and upward > 0 ? upColor : src < filt and src < src[1] and downward > 0 ? downColor : src < filt and src > src[1] and downward > 0 ? downColor : midColor filtplot = plot(filt, color = filtcolor, linewidth = 2, title = 'Range Filter', display = display.none) // // Target // hbandplot = plot(hband, color = color.new(upColor, 70), title = 'High Target') // lbandplot = plot(lband, color = color.new(downColor, 70), title = 'Low Target') // Fills // fill(hbandplot, filtplot, color = color.new(upColor, 90), title = 'High Target Range') // fill(lbandplot, filtplot, color = color.new(downColor, 90), title = 'Low Target Range') // // Bar Color // barcolor(barcolor) // Break Outs longCond = bool(na) shortCond = bool(na) longCond := src > filt and src > src[1] and upward > 0 or src > filt and src < src[1] and upward > 0 shortCond := src < filt and src < src[1] and downward > 0 or src < filt and src > src[1] and downward > 0 CondIni = 0 CondIni := longCond ? 1 : shortCond ? -1 : CondIni[1] longCondition = longCond and CondIni[1] == -1 shortCondition = shortCond and CondIni[1] == 1 // //Alerts // plotshape(longCondition, title = 'Buy Signal', text = 'Buy', textcolor = color.white, style = shape.labelup, size = size.small, location = location.belowbar, color = color.new(#aaaaaa, 20)) // plotshape(shortCondition, title = 'Sell Signal', text = 'Sell', textcolor = color.white, style = shape.labeldown, size = size.small, location = location.abovebar, color = color.new(downColor, 20)) alertcondition(longCondition, title = 'Buy alert on Range Filter', message = 'Buy alert on Range Filter') alertcondition(shortCondition, title = 'Sell alert on Range Filter', message = 'Sell alert on Range Filter') alertcondition(longCondition or shortCondition, title = 'Buy and Sell alert on Range Filter', message = 'Buy and Sell alert on Range Filter') // For use as a Strategy // ___________________________________________________________________________________________________________ // 1. Replace the word "indicator" on line 2 with the word "strategy" // 2. Uncomment the code below by highlighting it and pressing Ctl + '/' // Settings for 5min BTCUSDT. For other timeframes and assets, adjust the parameters within the settings menu. // ___________________________________________________________________________________________________________ // grp_STRAT = "Strategy settings" // timeInput = input.time(timestamp("1 Nov 2022 00:00 +0000"), title="Start date", group=grp_STRAT) // tpInPips = input.int(400, title="TP (in pips)", group=grp_STRAT) // slInPips = input.int(100, title="SL (in pips)", group=grp_STRAT) // timePeriod = time >= timeInput // notInTrade = strategy.position_size <= 0 // if(longCondition and timePeriod and notInTrade) // strategy.entry("Long", strategy.long) // strategy.exit("Exit long", "Long", loss=slInPips, profit=tpInPips) // if(shortCondition and timePeriod and notInTrade) // strategy.entry("Short", strategy.short) // strategy.exit("Exit short", "Short", loss=slInPips, profit=tpInPips) //////MTF TABLO/////// // Dashboard showDashboard = input(true, " Panel", group = 'TABLO AYARLARI') locationDashboard = input.string("Bottom Right", "YER", ["Top Right", "Middle Right", "Bottom Right", "Top Center", "Middle Center", "Bottom Center", "Top Left", "Middle Left", "Bottom Left"], group = 'Dashboard Settings', inline = 'agfh1') sizeDashboard = input.string("Small", "BOYUT", ["Large", "Normal", "Small", "Tiny"], group = 'TABLO AYARLARI', inline = 'agfh1') trigger2 = long_ma ? 1 : 0 countBull = ta.barssince(long_ma) countBear = ta.barssince(short_ma) currentposition = countBull > countBear ? 'Negatif' : 'Pozitif' // Mevcut pozisyonu belirlemek için birden fazla zaman dilimi sinyalvar string currentposition = "Pozisyon Yok" nsensitivity = input.float(defval=2, title="AYARLAR", minval=1, maxval=20, group='AL VE SAT SİNYAL AYARLARI') // Functions f_chartTfInMinutes() => float _resInMinutes = timeframe.multiplier * ( timeframe.isseconds ? 1. / 60 : timeframe.isminutes ? 1. : timeframe.isdaily ? 60. * 24 : timeframe.isweekly ? 60. * 24 * 7 : timeframe.ismonthly ? 60. * 24 * 30.4375 : na) // Get components vosc = ta.obv - ta.ema(ta.obv, 20) bs = ta.ema(nz(math.abs((open - close) / (high - low) * 100)), 3) ema = ta.ema(close, 200) emaBull = close > ema equal_tf(res) => str.tonumber(res) == f_chartTfInMinutes() higher_tf(res) => str.tonumber(res) > f_chartTfInMinutes() too_small_tf(res) => (timeframe.isweekly and res=="1") or (timeframe.ismonthly and str.tonumber(res) < 10) securityNoRep(sym, res, src) => bool bull = na bull := equal_tf(res) ? src : bull bull := higher_tf(res) ? request.security(sym, res, src, barmerge.gaps_off, barmerge.lookahead_on) : bull bull_array = request.security_lower_tf(syminfo.tickerid, higher_tf(res) ? str.tostring(f_chartTfInMinutes()) : too_small_tf(res) ? (timeframe.isweekly ? "3" : "10") : res, src) if array.size(bull_array) > 1 and not equal_tf(res) and not higher_tf(res) bull := array.pop(bull_array) array.clear(bull_array) bull TF1Bull = securityNoRep(syminfo.tickerid, "1" , emaBull) //TF3Bull = securityNoRep(syminfo.tickerid, "3" , emaBull) TF5Bull = securityNoRep(syminfo.tickerid, "5" , emaBull) //TF10Bull = securityNoRep(syminfo.tickerid, "10" , emaBull) TF15Bull = securityNoRep(syminfo.tickerid, "15" , emaBull) TF30Bull = securityNoRep(syminfo.tickerid, "30" , emaBull) TF60Bull = securityNoRep(syminfo.tickerid, "60" , emaBull) //TF120Bull = securityNoRep(syminfo.tickerid, "120" , emaBull) TF240Bull = securityNoRep(syminfo.tickerid, "240" , emaBull) //TF720Bull = securityNoRep(syminfo.tickerid, "720" , emaBull) TFDBull = securityNoRep(syminfo.tickerid, "1440", emaBull) indicatorTF = "Chart" // Functions sqz(bbLen, bbMult, kcLen, kcMult, source) => upperBB = ta.sma(source, bbLen) + ta.stdev(source, bbLen) * bbMult lowerBB = ta.sma(source, bbLen) - ta.stdev(source, bbLen) * bbMult upperKC = ta.sma(source, kcLen) + ta.sma(ta.tr, kcLen) * kcMult lowerKC = ta.sma(source, kcLen) - ta.sma(ta.tr, kcLen) * kcMult sqzOn = lowerBB > lowerKC and upperBB < upperKC sqzOff = lowerBB < lowerKC and upperBB > upperKC [sqzOn, sqzOff] qqe(rsiLen, rsiSmooth, factor, source, bbLen, bbMult) => rsiMa = ta.ema(ta.rsi(source, rsiLen), rsiSmooth) delta = ta.ema(ta.ema(math.abs(ta.mom(rsiMa, 1)), rsiLen * 2 - 1), rsiLen * 2 - 1) * factor longBand = 0.0, longBand := rsiMa > longBand[1] and rsiMa[1] > longBand[1] ? math.max(longBand[1], rsiMa - delta) : rsiMa - delta shortBand = 0.0, shortBand := rsiMa < shortBand[1] and rsiMa[1] < shortBand[1] ? math.min(shortBand[1], rsiMa + delta) : rsiMa + delta cross1 = ta.cross(rsiMa, shortBand[1]) cross2 = ta.cross(rsiMa, longBand[1]) trend = 0.0, trend := cross1 ? 1 : cross2 ? -1 : nz(trend[1], 1) fastDelta = trend == 1 ? longBand : shortBand _hist = rsiMa - 50 _line = fastDelta - 50 [_, upper, lower] = ta.bb(_line, bbLen, bbMult) [_hist, _line, upper, lower] // Get components cond(_offset) => top = ta.highest(high, 10) bot = ta.lowest(low, 10) osc = ta.ema(hlc3, 5) - ta.ema(ohlc4, 20) oscRis = osc > osc[1] oscFal = osc < osc[1] oscA0 = osc > 0 oscB0 = osc < 0 oscTop = oscFal and oscRis[1] oscBot = oscRis and oscFal[1] bullR = oscB0 and oscBot and ((osc > ta.valuewhen(oscB0 and oscBot, osc, 1) and bot < ta.valuewhen(oscB0 and oscBot, bot, 1))) bearR = oscA0 and oscTop and ((osc < ta.valuewhen(oscA0 and oscTop, osc, 1) and top > ta.valuewhen(oscA0 and oscTop, top, 1))) bullH = oscB0 and oscBot and ((osc < ta.valuewhen(oscB0 and oscBot, osc, 1) and bot > ta.valuewhen(oscB0 and oscBot, bot, 1))) bearH = oscA0 and oscTop and ((osc > ta.valuewhen(oscA0 and oscTop, osc, 1) and top < ta.valuewhen(oscA0 and oscTop, top, 1))) [sqzOn, sqzOff] = sqz(20, 2, 20, 2, close) [_hist1, _line1, upper1, lower1] = qqe(6, 6, 3, close, 50, 0.001) [_hist2, _line2, upper2, lower2] = qqe(6, 5, 1.618, close, 50, 1) [_, _, tvr] = ta.dmi(14, 14) [osc[_offset], oscRis[_offset], oscFal[_offset], oscA0[_offset], oscB0[_offset], oscTop[_offset], oscBot[_offset], bullR[_offset], bearR[_offset], bullH[_offset], bearH[_offset], sqzOn[_offset], sqzOff[_offset], _hist1[_offset], upper1[_offset], lower1[_offset], _hist2[_offset], _line2[_offset], tvr[_offset]] tf = indicatorTF == "Chart" ? timeframe.period : indicatorTF == "1 minute" ? "1" : indicatorTF == "3 minutes" ? "3" : indicatorTF == "5 minutes" ? "5" : indicatorTF == "10 minutes" ? "10" : indicatorTF == "15 minutes" ? "15" : indicatorTF == "30 minutes" ? "30" : indicatorTF == "45 minutes" ? "45" : indicatorTF == "1 hour" ? "60" : indicatorTF == "2 hours" ? "120" : indicatorTF == "3 hours" ? "180" : indicatorTF == "4 hours" ? "240" : indicatorTF == "12 hours" ? "720" : indicatorTF == "1 day" ? "1D" : indicatorTF == "1 week" ? "1W" : indicatorTF == "1 month" ? "1M" : na [osc, oscRis, oscFal, oscA0, oscB0, oscTop, oscBot, bullR, bearR, bullH, bearH, sqzOn, sqzOff, _hist1, upper1, lower1, _hist2, _line2, tvr] = request.security(syminfo.tickerid, tf, cond(indicatorTF != "Chart" and barstate.isrealtime ? 1 : 0)) //colorTVR = tvr < 15 ? #F6525F : tvr > 15 and tvr < 25 ? #B2B5BE : #66BB6A // Plots //plot(Presets == "Money Moves TrendVR" ? tvr : na, "", colorTVR, editable=false) TrendText = "TREND VAR" if tvr < 15 and tvr < 25 TrendText := "TREND YOK" if tvr > 15 and tvr < 25 TrendText := "YATAY" //------------------------------------------------------------------------------------------------------- Volatitiry //Calculates Volatility for Dashboard atrr = 3 * ta.atr(10) stdAtr = 2 * ta.stdev(atrr, 20) smaAtr = ta.sma(atrr, 20) topAtrDev = smaAtr + stdAtr bottomAtrDev = smaAtr - stdAtr calcDev = (atrr - bottomAtrDev) / (topAtrDev - bottomAtrDev) percentVol = 40 * calcDev + 30 AvrLength = 21 PercentFilter = 144 xAavrVolume = ta.rma(volume, AvrLength) nResLess = volume * 100 / xAavrVolume < PercentFilter ? 0 : volume nRes = nResLess clr = close < open ? #b2b5be : #00dbff //plot(nRes, color=clr, style=plot.style_columns, title='Volume Filter', transp=20) VolitiText = "PASİF" if nRes VolitiText := "AKTİF" ////////////////////////////////////////// ema69 = ta.ema(close, 9) totalSentTxt = ema69 > ema69[2] ? 'Pozitif' : ema69 < ema69[2] ? 'Negatif' : 'Flat' // INputs //Timezones //------------------------------------------------------------------------------ //Settings //-----------------------------------------------------------------------------{ // Zaman dilimini UTC+3 olarak ayarlayalım tz_incr = 3 use_exchange = false // İstanbul seansını kontrol eden değişken //Session A NYSes = true NYTxt = 'New York' NYTime = '1300-2200' //Session B LDSes = true sesb_txt = 'London' sesb_ses = '0700-1600' //Session C show_sesc = true sesc_txt = 'Tokyo' sesc_ses = '0000-0900' //Session D show_sesd = true sesd_txt = 'Sydney' sesd_ses = '2100-0600' // Session E (İstanbul) // İstanbul seansını kontrol eden değişken // Session E (İstanbul) show_sese = true sese_txt = 'Istanbul' sese_ses = '0900-1800' //-----------------------------------------------------------------------------} //Sessions //-----------------------------------------------------------------------------{ tff = timeframe.period var tz = use_exchange ? syminfo.timezone : str.format('UTC{0}{1}', tz_incr >= 0 ? '+' : '-', math.abs(tz_incr)) is_sesa = math.sign(nz(time(tff, NYTime, tz))) is_sesb = math.sign(nz(time(tff, sesb_ses, tz))) is_sesc = math.sign(nz(time(tff, sesc_ses, tz))) is_sesd = math.sign(nz(time(tff, sesd_ses, tz))) is_sese = math.sign(nz(time(tff, sese_ses, tz))) // İstanbul seansını kontrol eden değişken //////////////////////////////////////////// SessionText = "Default" if is_sesd SessionText := sesd_txt if is_sesc SessionText := sesc_txt if is_sesb SessionText := sesb_txt if is_sesa SessionText := NYTxt if is_sese SessionText := sese_txt if is_sesd and is_sesc SessionText := "Sydney/Tokyo" if is_sesb and is_sesc SessionText := "Tokyo/London" if is_sesb and is_sesa SessionText := "London/Newyork" if is_sesa and is_sesd SessionText := "Newyork/Sydney" if is_sese and is_sesa SessionText := "Istanbul" //-----------------------------------------------------------------------------} //Overlays color.green : color.red // // Çerçeve ayarları frame_color = input.color(color.black, title="Çerçeve Rengi") frame_width = input.int(2, title="Çerçeve Kalınlığı", minval=1, maxval=5) // Mevcut pozisyonu belirlemek için birden fazla zaman dilimi sinyalini kontrol et // Tablo stil ayarları için kullanıcı girişleri tableBgColor = input.color(color.new(color.gray, 90), title="Tablo Arka Plan Rengi") tableBorderColor = input.color(color.blue, title="Tablo Çerçeve Rengi") tableBorderWidth = input.int(1, title="Tablo Çerçeve Kalınlığı", minval=1, maxval=5) var dashboard_loc = locationDashboard == "Top Right" ? position.top_right : locationDashboard == "Middle Right" ? position.middle_right : locationDashboard == "Bottom Right" ? position.bottom_right : locationDashboard == "Top Center" ? position.top_center : locationDashboard == "Middle Center" ? position.middle_center : locationDashboard == "Bottom Center" ? position.bottom_center : locationDashboard == "Top Left" ? position.top_left : locationDashboard == "Middle Left" ? position.middle_left : position.bottom_left var dashboard_size = sizeDashboard == "Large" ? size.large : sizeDashboard == "Normal" ? size.normal : sizeDashboard == "Small" ? size.small : size.tiny //var dashboard = showDashboard ? table.new(dashboard_loc, 3, 8, color.rgb(30, 34, 45 , 60), color.rgb(0, 0, 0, 100), 2, color.rgb(30, 34, 45 , 60), 1)bgcolor=tableBgColor, border_color=tableBorderColor, border_width=tableBorderWidth, frame_color=frame_color, frame_width=frame_width) : na //dashboard_cell(column, row, txt, signal=false) => table.cell(dashboard, column, row, txt, 0, 0, signal ? #000000 : color.white, text_size=dashboard_size) //dashboard_cell_bg(column, row, col) => table.cell_set_bgcolor(dashboard, column, row, col) // Dashboard oluşturma var dashboard = showDashboard ? table.new(dashboard_loc, columns = 3, rows = 8,bgcolor=tableBgColor, border_color=tableBorderColor, border_width=tableBorderWidth, frame_color=frame_color, frame_width=frame_width) : na // Hücre ekleme ve arka plan rengini değiştirme fonksiyonları dashboard_cell(column, row, txt, signal=false) => table.cell(dashboard, column, row, txt, 0, 0, signal ? #000000 : color.white, text_size=dashboard_size) dashboard_cell_bg(column, row, col) => table.cell_set_bgcolor(dashboard, column, row, col) if barstate.islast and showDashboard // MTF Trend dashboard_cell(0, 0 , "ZAMAN") dashboard_cell(0, 1 , "D1") , dashboard_cell_bg(0, 1 , TF1Bull ? #23bd05 : #fd0205) dashboard_cell(0, 2 , "D5") , dashboard_cell_bg(0, 2 , TF5Bull ? #23bd05 : #fd0205) dashboard_cell(0, 3 , "D15") , dashboard_cell_bg(0, 3 , TF15Bull ? #23bd05 : #fd0205) dashboard_cell(0, 4 , "D30") , dashboard_cell_bg(0, 4 , TF30Bull ? #23bd05 : #fd0205) dashboard_cell(0, 5 , "1S") , dashboard_cell_bg(0, 5 , TF60Bull ? #23bd05 : #fd0205) dashboard_cell(0, 6 , "4S") , dashboard_cell_bg(0, 6 , TF240Bull ? #23bd05 : #fd0205) dashboard_cell(0, 7 , "G") , dashboard_cell_bg(0, 7 , TFDBull ? #23bd05 : #fd0205) // Middel part dashboard_cell(1, 0 , "RSN KALE") dashboard_cell(1, 1 , "Mevcut Pozisyon ") dashboard_cell(1, 2 , "Mevcut Hassasiyet ") dashboard_cell(1, 3 , "Piyasa Durumu ") dashboard_cell(1, 4 , "Volatilite ") dashboard_cell(1, 5 , "Kurumsal Aktivite ") dashboard_cell(1, 6 , "Mevcut Seans (UTC) ") dashboard_cell(1, 7 , "Trend Durumu ") // End part // Mevcut pozisyonu belirlemek için birden fazla zaman dilimi sinyalini kontrol et dashboard_cell(2, 0 , "SONUÇ") dashboard_cell(2, 1 , str.tostring(currentposition)) dashboard_cell(2, 2 , str.tostring(nsensitivity)) dashboard_cell(2, 3 , TrendText) dashboard_cell(2, 4 , str.tostring(percentVol, '##.##') + '%') dashboard_cell(2, 5 , VolitiText) dashboard_cell(2, 6 , SessionText) dashboard_cell(2, 7 , totalSentTxt) ////FİBO/////// toggleFibo = input.bool(true, title="Fibonacci Seviyelerini Göster") // Açma/Kapama düğmesi entryPrice = input.float(0.0, title = 'Giriş Fiyatı') exitPrice1 = input.float(0.0, title = 'Çıkış Fiyatı 1 (0.880)') exitPrice2 = input.float(0.0, title = 'Çıkış Fiyatı 2 (1.236)') stopLossPercent = input.float(2.0, title = 'Stop Loss (%)') // Stop Loss hesaplama stopLossLevel = entryPrice * (1 - stopLossPercent / 100) // Basit çizgiler - her zaman görünür p11 = plot(entryPrice > 0 ? entryPrice : na, 'Giriş Fiyatı', color = #1b12ce, linewidth = 2) p22 = plot(entryPrice > 0 ? stopLossLevel : na, 'Stop Loss', color = color.red, linewidth = 2) p3 = plot(exitPrice1 > 0 ? exitPrice1 : na, 'Çıkış Fiyatı 1', color = #028be7, linewidth = 2) p4 = plot(exitPrice2 > 0 ? exitPrice2 : na, 'Çıkış Fiyatı 2', color = #02e747, linewidth = 2) // Uyarılar if close >= exitPrice1 and exitPrice1 > 0 alert('İlk Satış Rakamına Geldi (0.880): ' + str.tostring(exitPrice1)) if close >= exitPrice2 and exitPrice2 > 0 alert('İkinci Satış Rakamına Geldi (1.236): ' + str.tostring(exitPrice2)) if close <= stopLossLevel and entryPrice > 0 alert('Stop Loss seviyesine ulaşıldı: ' + str.tostring(stopLossLevel)) // Input to select the direction of the Fibonacci levels fibDirection = input.string('Top to Bottom', title = 'Fibonacci Direction', options = ['Bottom to Top', 'Top to Bottom'], display = display.none) // Input to set the number of bars to look back for Fibonacci levels lookbackBars = 144 // Input for the number of bars to look further back for the previous high/low lookbackPrevBars = 144 // Define the Fibonacci levels as input parameters fibLevel0 = 0 fibLevel3 = 0.380 fibLevel6 = 0.618 fibLevel7 = 0.880 fibLevel8 = 1 fibLevel9 = 1.236 // Calculate the highest high and lowest low within the lookback period highestHigh1 = ta.highest(high, lookbackBars) lowestLow = ta.lowest(low, lookbackBars) // Calculate the previous high and low within the extended lookback period previousHigh = ta.highest(high, lookbackPrevBars) previousLow = ta.lowest(low, lookbackPrevBars) // Calculate Fibonacci levels based on the selected direction fib0 = fibDirection == 'Bottom to Top' ? highestHigh1 - (highestHigh1 - lowestLow) * fibLevel0 : lowestLow + (highestHigh1 - lowestLow) * fibLevel0 fib3 = fibDirection == 'Bottom to Top' ? highestHigh1 - (highestHigh1 - lowestLow) * fibLevel3 : lowestLow + (highestHigh1 - lowestLow) * fibLevel3 fib6 = fibDirection == 'Bottom to Top' ? highestHigh1 - (highestHigh1 - lowestLow) * fibLevel6 : lowestLow + (highestHigh1 - lowestLow) * fibLevel6 fib7 = fibDirection == 'Bottom to Top' ? highestHigh1 - (highestHigh1 - lowestLow) * fibLevel7 : lowestLow + (highestHigh1 - lowestLow) * fibLevel7 fib8 = fibDirection == 'Bottom to Top' ? highestHigh1 - (highestHigh1 - lowestLow) * fibLevel8 : lowestLow + (highestHigh1 - lowestLow) * fibLevel8 fib9 = fibDirection == 'Bottom to Top' ? highestHigh1 - (highestHigh1 - lowestLow) * fibLevel9 : lowestLow + (highestHigh1 - lowestLow) * fibLevel9 // Persistent label variables for clearing old labels var array<label> fibLabels = array.new<label>() // Clear old labels only if the array is not empty if array.size(fibLabels) > 0 for i = 0 to array.size(fibLabels) - 1 by 1 label.delete(array.get(fibLabels, i)) array.clear(fibLabels) // Fibonacci seviyeleri için açma/kapama düğmesi kontrolü if toggleFibo label fibLabel0 = label.new(bar_index + 28, fib0, text = 'DİP - ' + str.tostring(fib0, format.mintick), color = color.yellow, textcolor = #000000, style = label.style_label_left, size = size.small) label fibLabel3 = label.new(bar_index + 28, fib3, text = 'GİRİŞ - ' + str.tostring(fib3, format.mintick), color = #000000, textcolor = color.rgb(255, 255, 255), style = label.style_label_left, size = size.small) label fibLabel6 = label.new(bar_index + 28, fib6, text = 'ONAY - ' + str.tostring(fib6, format.mintick), color = color.aqua, textcolor = color.rgb(255, 255, 255), style = label.style_label_left, size = size.small) label fibLabel7 = label.new(bar_index + 28, fib7, text = 'ÇIKIŞ - ' + str.tostring(fib7, format.mintick), color = #00dd00, textcolor = #000000, style = label.style_label_left, size = size.small) label fibLabel8 = label.new(bar_index + 28, fib8, text = 'TEPE - ' + str.tostring(fib8, format.mintick), color = #dd0000, textcolor = color.rgb(255, 255, 255), style = label.style_label_left, size = size.small) label fibLabel9 = label.new(bar_index + 28, fib9, text = '2. ÇIKIŞ - ' + str.tostring(fib9, format.mintick), color = #dd480878, textcolor = color.rgb(255, 255, 255), style = label.style_label_left, size = size.small) array.push(fibLabels, fibLabel0) array.push(fibLabels, fibLabel3) array.push(fibLabels, fibLabel6) array.push(fibLabels, fibLabel7) array.push(fibLabels, fibLabel8) array.push(fibLabels, fibLabel9) // Alerts for Fibonacci level crosses alertcondition(ta.crossunder(close, fib0), title = 'Cross Below Fib Level 0', message = 'Price crossed below Fibonacci Level 0') alertcondition(ta.crossover(close, fib0), title = 'Cross Above Fib Level 0', message = 'Price crossed above Fibonacci Level 0') alertcondition(ta.crossunder(close, fib3), title = 'Cross Below Fib Level 0.386', message = 'Price crossed below Fibonacci Level 0.386') alertcondition(ta.crossover(close, fib3), title = 'Cross Above Fib Level 0.386', message = 'Price crossed above Fibonacci Level 0.386')
Editor is loading...
Leave a Comment