Untitled
unknown
plain_text
5 months ago
3.9 kB
28
Indexable
//@version=5 indicator("Trend Kırılımı ve İndikatörler", overlay=true) // === Kullanıcı Girdileri === // EMA Ayarları ema1_length = input.int(10, title="EMA 1 Length", minval=1) ema2_length = input.int(20, title="EMA 2 Length", minval=1) ema3_length = input.int(50, title="EMA 3 Length", minval=1) // RSI Ayarları rsi_length = input.int(14, title="RSI Length", minval=1) rsi_overbought = input.float(70, title="RSI Overbought Level", minval=50, maxval=100) rsi_oversold = input.float(30, title="RSI Oversold Level", minval=0, maxval=50) // MACD Ayarları macd_fast = input.int(12, title="MACD Fast Length") macd_slow = input.int(26, title="MACD Slow Length") macd_signal = input.int(9, title="MACD Signal Length") // === EMA Hesaplamaları === ema1 = ta.ema(close, ema1_length) ema2 = ta.ema(close, ema2_length) ema3 = ta.ema(close, ema3_length) // === RSI Hesaplaması === rsi = ta.rsi(close, rsi_length) // === MACD Hesaplaması === [macd_line, signal_line, _] = ta.macd(close, macd_fast, macd_slow, macd_signal) // === Trend Çizgileri === var trendline_down = line.new(x1=na, y1=na, x2=na, y2=na, color=color.red, width=1, extend=extend.none) var trendline_up = line.new(x1=na, y1=na, x2=na, y2=na, color=color.green, width=1, extend=extend.none) // 100 Bar içinde düşen ve yükselen trend çizgileri highest_bar = ta.highestbars(high, 100) lowest_bar = ta.lowestbars(low, 100) highest_price = na(highest_bar) ? na : high[highest_bar] lowest_price = na(lowest_bar) ? na : low[lowest_bar] current_index = bar_index // Düşen trend çizgisini güncelle if not na(highest_bar) and not na(highest_price) line.set_xy1(trendline_down, x1=current_index[highest_bar], y1=highest_price) line.set_xy2(trendline_down, x1=current_index, y2=close) else line.set_xy1(trendline_down, na, na) line.set_xy2(trendline_down, na, na) // Yükselen trend çizgisini güncelle if not na(lowest_bar) and not na(lowest_price) line.set_xy1(trendline_up, x1=current_index[lowest_bar], y1=lowest_price) line.set_xy2(trendline_up, x1=current_index, y2=close) else line.set_xy1(trendline_up, na, na) line.set_xy2(trendline_up, na, na) // === Trend Kırılımı ve Metin Yazdırma === // Düşen trend kırılımı if close > line.get_y1(trendline_down) and close > line.get_y2(trendline_down) label.new(bar_index, high, "Attention", style=label.style_label_down, color=color.red, textcolor=color.white) // Düşen trend üzerinde kapanış if close > line.get_y1(trendline_down) and close > line.get_y2(trendline_down) and close[1] > line.get_y2(trendline_down) label.new(bar_index, high, "B.Out", style=label.style_label_down, color=color.yellow, textcolor=color.black) // Yükselen trend üzerinde kapanış if close < line.get_y1(trendline_up) and close < line.get_y2(trendline_up) and close[1] < line.get_y2(trendline_up) label.new(bar_index, low, "B.Down", style=label.style_label_up, color=color.green, textcolor=color.white) // === RSI Gösterimi === rsi_label = label.new(bar_index, high + 10, "RSI: " + str.tostring(rsi, format.mintick), style=label.style_label_right, color=color.new(color.blue, 90)) if rsi > rsi_overbought label.set_text(rsi_label, "RSI Overbought: " + str.tostring(rsi, format.mintick)) label.set_color(rsi_label, color.new(color.red, 90)) if rsi < rsi_oversold label.set_text(rsi_label, "RSI Oversold: " + str.tostring(rsi, format.mintick)) label.set_color(rsi_label, color.new(color.green, 90)) // === MACD Gösterimi === macd_label = label.new(bar_index, low - 10, "MACD: " + str.tostring(macd_line, format.mintick) + " / Signal: " + str.tostring(signal_line, format.mintick), style=label.style_label_left, color=color.new(color.purple, 90)) // === EMA Çizimleri === plot(ema1, color=color.blue, title="EMA 1") plot(ema2, color=color.orange, title="EMA 2") plot(ema3, color=color.green, title="EMA 3")
Editor is loading...
Leave a Comment