Untitled
unknown
plain_text
4 months ago
29 kB
7
Indexable
//@version=6 indicator('RSN ALL', shorttitle = 'RSN V2', overlay = true) // Alphatrend coeff = input.float(1, 'Multiplier', step=0.1) AP = input(14, 'Common Period') ATR = ta.sma(ta.tr, AP) src = input(close) showsignalsALpha = input(title='Show Signals?', defval=true) novolumedata = input(title='Change calculation (no volume data)?', defval=true) upT = low - ATR * coeff downT = high + ATR * coeff AlphaTrend = 0.0 AlphaTrend := (novolumedata ? ta.rsi(src, AP) >= 50 : ta.mfi(hlc3, AP) >= 50) ? upT < nz(AlphaTrend[1]) ? nz(AlphaTrend[1]) : upT : downT > nz(AlphaTrend[1]) ? nz(AlphaTrend[1]) : downT color1 = AlphaTrend > AlphaTrend[2] ? #00E60F : AlphaTrend < AlphaTrend[2] ? #80000B : AlphaTrend[1] > AlphaTrend[3] ? #00E60F : #80000B // k1 = plot(AlphaTrend, color=color.new(#0022FC, 0), linewidth=3) // k2 = plot(AlphaTrend[2], color=color.new(#FC0400, 0), linewidth=3) // fill(k1, k2, color=color1) buySignalAlpha = ta.crossover(AlphaTrend, AlphaTrend[2]) sellSignalAlpha = ta.crossunder(AlphaTrend, AlphaTrend[2]) K1 = ta.barssince(buySignalAlpha) K2 = ta.barssince(sellSignalAlpha) O1 = ta.barssince(buySignalAlpha[1]) O2 = ta.barssince(sellSignalAlpha[1]) plotshape(buySignalAlpha and showsignalsALpha and O1 > K2 ? AlphaTrend[2] * 0.9999 : na, title='Alpha_AL', text='Alpha_AL', location=location.absolute, style=shape.labelup, size=size.tiny, color=color.new(#0022FC, 100), textcolor=color.new(color.green, 0)) plotshape(sellSignalAlpha and showsignalsALpha and O2 > K1 ? AlphaTrend[2] * 1.0001 : na, title='Alpha_Sat', text='Alpha_Sat', location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.new(color.maroon, 100), textcolor=color.new(color.red, 0)) // MACD ayarları fastLength = input.int(12, title='Fast Length', inline="group1") slowLength = input.int(26, title='Slow Length', inline="group1") signalSmoothing = input.int(9, title='Signal Smoothing', inline="group1") [macdLine, signalLine, _] = ta.macd(close, fastLength, slowLength, signalSmoothing) // Buy condition: MACD line turns positive // Comparative Relative Strength calculations comparativeTickerId = input.symbol('BIST:XU100', title = 'KOM SYMBOL') 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') higherRSI = ta.rsi(crs, rsiLength) // ema55y = ta.ema(close, 34) buySignal = ta.crossover(macdLine, 0) // Sell condition: MACD line turns negative sellSignal = ta.crossunder(macdLine, 0) // Çizim koşulları plotshape(buySignal, location=location.belowbar, color=color.green, style=shape.diamond, title='Macd AL', text='M_AL', size=size.small, offset=-1) plotshape(sellSignal, location=location.abovebar, color=color.red, style=shape.diamond, title='Macd Sat', text='M_SAT', size=size.small, offset=-1) // Fısher Transform // len = input.int(9, minval=1, title='Length') // high_ = ta.highest(hl2, len) // low_ = 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] // // hline(1.5, '1.5', color=#E91E63) // // hline(0.75, '0.75', color=#787B86) // // hline(0, '0', color=#E91E63) // // hline(-0.75, '-0.75', color=#ff0909) // // hline(-1.5, '-1.5', color=#E91E63) // buySignalfisher = ta.crossover(fish1, 0) // // Sell condition: MACD line turns negative // sellSignalfisher = ta.crossunder(fish1, 0) // // Plot buy and sell icons on the chart // plotshape(series = buySignalfisher, location = location.belowbar, color = color.green, style = shape.diamond, title = 'FSH AL', text = 'F_AL', size = size.small, offset = -1) // plotshape(series = sellSignalfisher, location = location.abovebar, color = color.red, style = shape.diamond, title = 'FSH Sat', text = 'F_SAT', size = size.small, offset = -1) // Add enable/disable settings for comparative EMAs show_comp_ema34 = input.bool(true, "Show KOMP EMA 34", group="Comparative EMA Display") show_comp_ema55 = input.bool(true, "Show KOMP EMA 55", group="Comparative EMA Display") show_comp_ema89 = input.bool(false, "Show KOMP EMA 89", group="Comparative EMA Display") show_comp_ema233 = input.bool(false, "Show KOMP EMA 233", group="Comparative EMA Display") show_comp_ema377 = input.bool(false, "Show KOMP EMA 377", group="Comparative EMA Display") show_comp_ema610 = input.bool(false, "Show KOMP EMA 610", group="Comparative EMA Display") show_comp_ema987 = input.bool(false, "Show KOMP EMA 987", group="Comparative EMA Display") show_comp_ema1597 = input.bool(false, "Show KOMP EMA 1597", group="Comparative EMA Display") show_comp_ema2584 = input.bool(false, "Show KOMP EMA 2584", group="Comparative EMA Display") show_comp_ema4181 = input.bool(false, "Show KOMP EMA 4181", group="Comparative EMA Display") showema55_1s = input.bool(true, "Show KOMP EMA 55 1s", group="Comparative EMA Display") // 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 // SuperTrend Periods = input(title = 'ATR Period', defval = 10, inline="group2") src3 = input(hl2, title = 'Source', inline="group2") Multiplier = input.float(title = 'ATR Multiplier', step = 0.1, defval = 3.0, inline="group2") changeATR = input(title = 'Change ATR Calculation Method ?', defval = true) showsignals = input(title = 'Show Buy/Sell Signals ?', defval = true) highlighting = input(title = 'Highlighter On/Off ?', defval = true) atr2 = ta.sma(ta.tr, Periods) atr = changeATR ? ta.atr(Periods) : atr2 up2 = src3 - Multiplier * atr up1 = nz(up2[1], up2) up2 := close[1] > up1 ? math.max(up2, up1) : up2 dn2 = src3 + Multiplier * atr dn1 = nz(dn2[1], dn2) dn2 := close[1] < dn1 ? math.min(dn2, dn1) : dn2 trend = 1 trend := nz(trend[1], trend) trend := trend == -1 and close > dn1 ? 1 : trend == 1 and close < up1 ? -1 : trend buySignal1 = trend == 1 and trend[1] == -1 plotshape(buySignal1 and showsignals ? up2 : na, title = 'Sprtrnd Al', text = 'Sprtrnd Al', location = location.absolute, style = shape.circle, size = size.tiny, color = color.new(color.green, 0), textcolor = color.new(color.white, 0)) sellSignal1 = trend == -1 and trend[1] == 1 plotshape(sellSignal1 and showsignals ? dn2 : na, title = 'Sprtrnd Sat', text = 'Sprtrnd Sat', location = location.absolute, style = shape.circle, size = size.tiny, color = color.new(color.red, 0), textcolor = color.new(color.white, 0)) // mPlot = plot(ohlc4, title = '', style = plot.style_circles, linewidth = math.max(1, 0)) longFillColor = highlighting ? trend == 1 ? color.green : color.white : color.white shortFillColor = highlighting ? trend == -1 ? color.red : color.white : color.white alertcondition(buySignal1, title = 'SuperTrend Buy', message = 'SuperTrend Buy!') alertcondition(sellSignal1, title = 'SuperTrend Sell', message = 'SuperTrend Sell!') changeCond = trend != trend[1] alertcondition(changeCond, title = 'SuperTrend Direction Change', message = 'SuperTrend has changed direction!') // // AMA Trend Line // Length = input.int(21, minval = 1) // xPrice = close // xvnoise = math.abs(xPrice - xPrice[1]) // nAMA = 0.0 // nfastend = 0.666 // nslowend = 0.0645 // nsignal = math.abs(xPrice - xPrice[Length]) // nnoise = math.sum(xvnoise, Length) // nefratio = nnoise != 0 ? nsignal / nnoise : 0 // nsmooth = math.pow(nefratio * (nfastend - nslowend) + nslowend, 2) // nAMA := nz(nAMA[1]) + nsmooth * (xPrice - nz(nAMA[1])) // plot(nAMA, color = color.new(color.blue, 0), title = 'KAMA') // EMA settings useEMA14 = input.bool(false, title='Show EMA 14', group='EMA Settings') useEMA34 = input.bool(true, title='Show EMA 34', group='EMA Settings') useEMA55 = input.bool(true, title='Show EMA 55', group='EMA Settings') useEMA89 = input.bool(false, title='Show EMA 89', group='EMA Settings') useEMA144 = input.bool(false, title='Show EMA 144', group='EMA Settings') useEMA233 = input.bool(true, title='Show EMA 233', group='EMA Settings') useEMA377 = input.bool(true, title='Show EMA 377', group='EMA Settings') useEMA610 = input.bool(true, title='Show EMA 610', group='EMA Settings') useEMA987 = input.bool(false, title='Show EMA 987', group='EMA Settings') useEMA1597 = input.bool(false, title='Show EMA 1597', group='EMA Settings') useEMA115 = input.bool(false, title='Show Pivot 115', group='EMA Settings') // EMA Length inputs (unchanged) emaLength1 = input.int(12, title = ' EMA 12') emaLength2 = input.int(26, title = ' EMA 26') emaLength12 = input.int(14, title = ' EMA 14') emaLength3 = input.int(34, title = ' EMA 34') emaLength4 = input.int(55, title = ' EMA 55') emaLength10 = input.int(89, title = ' EMA 89') emaLength5 = input.int(144, title = ' EMA 144') emaLength6 = input.int(233, title = ' EMA 233') emaLength7 = input.int(377, title = ' EMA 377') emaLength8 = input.int(610, title = ' EMA 610') emaLength9 = input.int(987, title = ' EMA 987') emaLength11 = input.int(1597, title = ' EMA 1597') emaLength13 = input.int(115, title = ' Pivot 115') // 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 with conditional plotting plot(useEMA14 ? ema14 : na, title = 'EMA 14', color = color.rgb(0, 255, 17), linewidth = 2) plot(useEMA34 ? ema34 : na, title = 'EMA 34', color = color.red, linewidth = 2) plot(useEMA55 ? ema55 : na, title = 'EMA 55', color = #f8a407, linewidth = 2) plot(useEMA89 ? ema89 : na, title = 'EMA 89', color = color.rgb(207, 193, 166), linewidth = 2) plot(useEMA144 ? ema144 : na, title = 'EMA 144', color = #81f516, linewidth = 2) plot(useEMA233 ? ema233 : na, title = 'EMA 233', color = #ffffff, linewidth = 2) plot(useEMA377 ? ema377 : na, title = 'EMA 377', color = color.rgb(7, 89, 240), linewidth = 2) plot(useEMA610 ? ema610 : na, title = 'EMA 610', color = color.rgb(124, 128, 131), linewidth = 2) plot(useEMA987 ? ema987 : na, title = 'EMA 987', color = #fc009b, linewidth = 2) plot(useEMA1597 ? ema1597 : na, title = 'EMA 1597', color = color.rgb(145, 18, 18), linewidth = 2) plot(useEMA115 ? ema115 : na, title = 'Pivot 115', color = #ea754b, linewidth = 2) 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 // MACD Crossovers 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 // Bar renklerini MACD pozitif ve negatif olmasına göre ayarlama barColor = macdLine > 0 ? color.green : color.red wickColor = barColor borderColor = barColor // 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 > 4 // Çizgiyi güncelle veya yeniden oluştur if na(ema_line) and showema55_1s ema_line := line.new(x1=bar_index, y1=ema55_1s, x2=bar_index + 4, y2=ema55_1s, color=line_color, width=2) else if showema55_1s line.set_xy1(ema_line, bar_index, ema55_1s) line.set_xy2(ema_line, bar_index + 4, ema55_1s) // Çizginin hemen sağ tarafına değer etiketi ekle label_text = "KOM-55_1s: " + str.tostring(ema55_1s, '#.##') // Etiket metni 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()) plotcandle(open, high, low, close, color = barColor, wickcolor = wickColor, bordercolor = borderColor, title = '') // XU100 fiyatı ve EMA uzunlukları xu100 = request.security('BIST:XU100', timeframe.period, close) compEmaLength34 = input.int(34, title='KOM EMA 34') compEmaLength55 = input.int(55, title='KOM EMA 55') compEmaLength89 = input.int(89, title='KOM EMA 89') compEmaLength233 = input.int(233, title='KOM EMA 233') compEmaLength377 = input.int(377, title='KOM EMA 377') compEmaLength610 = input.int(610, title='KOM EMA 610') compEmaLength987 = input.int(987, title='KOM EMA 987') compEmaLength1597 = input.int(1597, title='KOM EMA 1597') compEmaLength2584 = input.int(2584, title='KOM EMA 2584') compEmaLength4181 = input.int(4181, title='KOM EMA 4181') // 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 // Ç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 // // EMA 4181 if bar_index > 6 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, '#.##')) // // EMA 2584 // 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=#04ff00, 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=#04ff00, 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 1597 // 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=#6d180f, 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=#6d180f, 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 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=#cf21e6, 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=#cf21e6, 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 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 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=#f7f6f5, 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=#ffffff, 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 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 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(255, 255, 3), 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(255, 255, 3), 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()) // 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, 5000) 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']) 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 = color.new(color.black, 90), border_color = color.new(color.gray, 50), border_width = 1) // Tablo başlıkları if bar_index == 1 table.cell(tbl, 0, 0, syminfo.ticker, text_color = color.white, text_size = fontSizeMap) table.cell(tbl, 1, 0, 'RSI', text_color = color.white, text_size = fontSizeMap) table.cell(tbl, 2, 0, 'KOM RSI', text_color = color.white, text_size = fontSizeMap) table.cell(tbl, 3, 0, 'STOP 34', text_color = color.white, text_size = fontSizeMap) table.cell(tbl, 4, 0, 'STOP 55', text_color = color.white, text_size = fontSizeMap) table.cell(tbl, 5, 0, 'Hafta', text_color = color.white, text_size = fontSizeMap) table.cell(tbl, 6, 0, 'Ay', text_color = color.white, 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.white, 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') // EMA 34 Alarm Koşulları ema34CrossUp = ta.crossover(close, ema34) // Fiyat EMA 34'ün üzerine çıkıyor ema34CrossDown = ta.crossunder(close, 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)
Editor is loading...
Leave a Comment