Merhaba..
Pivot sağ : 3
Pivot sol : 3 değerlerini baz alarak bir tarama ve indikatör yazabilir miyiz?
Aşağıdaki gibi
//@version=5
indicator("Yükselen Destek + AL/SAT Etiketi + Alarm", overlay=true)
// Kullanıcı çizgi rengini seçer
lineColor = input.color(color.lime, "Destek Çizgisi Rengi")
// Pivot parametreleri
left = input.int(3, "Pivot Sol", minval=1)
right = input.int(3, "Pivot Sağ", minval=1)
// Değişkenler
var line supportLine = na
var float low1 = na
var int idx1 = na
var float low2 = na
var int idx2 = na
var bool wasAbove = false
var bool wasBelow = false
// Pivot dip bul
pl = ta.pivotlow(low, left, right)
if not na(pl)
low2 := low1
idx2 := idx1
low1 := pl
idx1 := bar_index - right
// Yükselen destek çiz
if not na(low1) and not na(low2) and low1 > low2
if not na(supportLine)
line.delete(supportLine)
supportLine := line.new(idx2, low2, idx1, low1, extend=extend.right, color=lineColor, width=2)
// AL/SAT etiketleri
crossedUp = false
crossedDown = false
if not na(supportLine)
linePrice = line.get_price(supportLine, bar_index)
crossedUp := not wasAbove and close > linePrice
crossedDown := not wasBelow and close < linePrice
if crossedUp
label.new(bar_index, low, "AL", style=label.style_label_up, color=color.green, textcolor=color.white, size=size.small)
if crossedDown
label.new(bar_index, high, "SAT", style=label.style_label_down, color=color.red, textcolor=color.white, size=size.small)
wasAbove := close > linePrice
wasBelow := close < linePrice
// Alarm koşulları
alertcondition(crossedUp, "AL Alarm", "Fiyat yükselen destek çizgisini yukarı kesti - AL")
alertcondition(crossedDown, "SAT Alarm", "Fiyat yükselen destek çizgisini aşağı kesti - SAT")