// Bu kaynak kodu, Mozilla Kamu Lisansı 2.0 şartlarına tabidir: https://mozilla.org/MPL/2.0/ // © Jesse.Lau //@version=6 indicator(title = '[JL] Supertrend Bölge Pivot Noktası zigzag fib ile', shorttitle = 'AL SAT 1 ', overlay = true, max_labels_count = 500, max_bars_back = 4900) // Gösterim seçenekleri show_zigzag = input(true, 'Zigzagı Göster', group = 'Göster') show_fib = input(true, 'Fibonacciyi Göster', group = 'Göster') show_supertrend = input(true, 'Supertrendi Göster', group = 'Göster') show_premiumdiscount = input(true, 'Prim/İndirim çizgisini Göster', group = 'Göster') // Girdi değerleri atrPeriod = input(10, 'ATR Uzunluğu') factor = input.float(3, 'Faktör', step = 0.1) atrline = input.float(1.5, 'Prim/İndirim', step = 0.1) [supertrend, direction] = ta.supertrend(factor, atrPeriod) bodyMiddle = plot((open + close) / 2, display = display.none) upTrend = plot(direction < 0 and show_supertrend ? supertrend : na, 'Yükselen Trend', color = color.green, style = plot.style_linebr) downTrend = plot(direction > 0 and show_supertrend ? supertrend : na, 'Düşen Trend', color = color.red, style = plot.style_linebr) fill(bodyMiddle, upTrend, show_supertrend ? color.new(color.green, 100) : na, fillgaps = false) fill(bodyMiddle, downTrend, show_supertrend ? color.new(color.red, 100) : na, fillgaps = false) ATR = ta.atr(atrPeriod) upatrline = supertrend + atrline * ATR dnatrline = supertrend - atrline * ATR plot(direction < 0 and show_premiumdiscount ? upatrline : na, 'Yükselen ATR', color = color.rgb(255, 255, 255,100), style = plot.style_linebr) plot(direction > 0 and show_premiumdiscount ? dnatrline : na, 'Düşen ATR', color = color.rgb(255, 255, 255,100), style = plot.style_linebr) colorGroupTitle = 'Yazı Rengi / Etiket Rengi' // Pivot yazı ve etiket renkleri textColorH = input(title = 'Yüksek Pivot ', defval = color.white, inline = 'Yüksek Pivot ', group = colorGroupTitle) labelColorH = input(title = '', defval = #ff0000, inline = 'Pivot Yüksek', group = colorGroupTitle) textColorL = input(title = 'Düşük Pivot ', defval = color.white, inline = 'Düşük Pivot ', group = colorGroupTitle) labelColorL = input(title = '', defval = color.rgb(13, 255, 0, 30), inline = 'Düşük Pivot ', group = colorGroupTitle) turnGreen = ta.change(direction) < 0 turnRed = ta.change(direction) > 0 barsturngreen = bar_index - ta.valuewhen(turnGreen, bar_index, 0) barsturnred = bar_index - ta.valuewhen(turnRed, bar_index, 0) barsg = barsturngreen > 0 ? barsturngreen : 1 h1 = ta.highest(high, barsg) barsr = barsturnred > 0 ? barsturnred : 1 l2 = ta.lowest(low, barsr) barsh = bar_index - ta.valuewhen(bool(ta.change(h1)), bar_index, 0) barsl = bar_index - ta.valuewhen(bool(ta.change(l2)), bar_index, 0) barsh2 = bar_index - ta.valuewhen(bool(ta.change(h1)), bar_index, 1) barsl2 = bar_index - ta.valuewhen(bool(ta.change(l2)), bar_index, 1) h1Index = 0 l2Index = 0 var label h1label = na var label l2label = na // Etiket çizme fonksiyonu drawLabel(_offset, _pivot, _style, _color, _textColor, _text) => if not na(_pivot) label.new(bar_index - _offset, _pivot, _text, style = _style, color = _color, textcolor = _textColor, size = size.normal, textalign = text.align_center) if turnRed h1label := drawLabel(barsh, h1, label.style_label_down, labelColorH, textColorH, "SAT => " + str.tostring(h1, format.mintick)) if show_zigzag line.new(bar_index - barsh, h1, bar_index - barsl2, l2[3], width = 2, color = color.lime) if turnGreen l2label := drawLabel(barsl, l2, label.style_label_up, labelColorL, textColorL, "AL => " + str.tostring(l2, format.mintick)) if show_zigzag line.new(bar_index - barsh2, h1[1], bar_index - barsl, l2[3], width = 2, color = color.fuchsia) hh = ta.valuewhen(turnRed, h1, 0) ll = ta.valuewhen(turnGreen, l2, 0) mid_val = (hh + ll) / 2 // Yüksek en yüksek ve düşük en düşük için çizgiler çiziliyor var line hhLine = na var line llLine = na var line midline = na var label fibLabelh = na var label fibLabell = na var label fibLabelm = na var label fibLabel1 = na var label fibLabel2 = na var label fibLabel3 = na var label fibLabel4 = na var label fibLabel5 = na var label fibLabel6 = na var line fibLine1 = na var line fibLine2 = na var line fibLine3 = na var line fibLine4 = na var line fibLine5 = na var line fibLine6 = na if barstate.islast and show_fib while high[h1Index] != h1[1] h1Index := h1Index + 1 h1Index while low[l2Index] != l2[1] l2Index := l2Index + 1 l2Index n = math.max(h1Index, l2Index) if not na(hhLine) line.delete(hhLine) if not na(llLine) line.delete(llLine) if not na(midline) line.delete(midline) if not na(fibLabelh) label.delete(fibLabelh) if not na(fibLabell) label.delete(fibLabell) if not na(fibLabelm) label.delete(fibLabelm) if not na(fibLabel1) label.delete(fibLabel1) if not na(fibLabel2) label.delete(fibLabel2) if not na(fibLabel3) label.delete(fibLabel3) if not na(fibLabel4) label.delete(fibLabel4) if not na(fibLabel5) label.delete(fibLabel5) if not na(fibLabel6) label.delete(fibLabel6) if not na(fibLine1) line.delete(fibLine1) if not na(fibLine2) line.delete(fibLine2) if not na(fibLine3) line.delete(fibLine3) if not na(fibLine4) line.delete(fibLine4) if not na(fibLine5) line.delete(fibLine5) if not na(fibLine6) line.delete(fibLine6)