// Bu, Pine Script™ kodu Mozilla Kamu Lisansı 2.0 (MPL-2.0) altında lisanslandı // © krstsntrk © BorsaPin code is priority //@version=6 indicator(title = 'BorsaPin Pivot Sistem', shorttitle = 'BorsaPin Pivot Sistem', overlay = true) // === Kullanıcı Ayarları === pivotType = input.string("Woodie", title="Pivot Tipi", options=["Classic", "Fibonacci", "Woodie"]) useCurrentBar = input.bool(true, title="Kapanış Bekleme Opsiyonu (Açık mum yerine önceki kapanışı kullanır.)") showDaily = input.bool(true, title="Günlük Pivot Göster") showWeekly = input.bool(true, title="Haftalık Pivot Göster") showMonthly = input.bool(true, title="Aylık Pivot Göster") showYearly = input.bool(true, title="Yıllık Pivot Göster") // === Zaman Aralığına Göre High/Low/Close === getHigh(_tf) => useCurrentBar ? request.security(syminfo.tickerid, _tf, high) : request.security(syminfo.tickerid, _tf, high[1]) getLow(_tf) => useCurrentBar ? request.security(syminfo.tickerid, _tf, low) : request.security(syminfo.tickerid, _tf, low[1]) getClose(_tf) => useCurrentBar ? request.security(syminfo.tickerid, _tf, close) : request.security(syminfo.tickerid, _tf, close[1]) // === Pivot Hesaplayıcı Fonksiyon === calcPivots(high_, low_, close_, _type) => pivot = 0.0 r1 = 0.0 r2 = 0.0 r3 = 0.0 s1 = 0.0 s2 = 0.0 s3 = 0.0 if _type == "Classic" pivot := (high_ + low_ + close_) / 3 r1 := 2 * pivot - low_ s1 := 2 * pivot - high_ r2 := pivot + (high_ - low_) s2 := pivot - (high_ - low_) r3 := high_ + 2 * (pivot - low_) s3 := low_ - 2 * (high_ - pivot) else if _type == "Fibonacci" pivot := (high_ + low_ + close_) / 3 r1 := pivot + 0.382 * (high_ - low_) r2 := pivot + 0.618 * (high_ - low_) r3 := pivot + 1.000 * (high_ - low_) s1 := pivot - 0.382 * (high_ - low_) s2 := pivot - 0.618 * (high_ - low_) s3 := pivot - 1.000 * (high_ - low_) else if _type == "Woodie" pivot := (high_ + low_ + 2 * close_) / 4 r1 := (2 * pivot) - low_ s1 := (2 * pivot) - high_ r2 := pivot + (high_ - low_) s2 := pivot - (high_ - low_) r3 := high_ + 2 * (pivot - low_) s3 := low_ - 2 * (high_ - pivot) [pivot, r1, r2, r3, s1, s2, s3] // === Her Zaman Dilimi İçin High / Low / Close Al === dH = getHigh("D") dL = getLow("D") dC = getClose("D") wH = getHigh("W") wL = getLow("W") wC = getClose("W") mH = getHigh("M") mL = getLow("M") mC = getClose("M") yH = getHigh("12M") yL = getLow("12M") yC = getClose("12M") // === Pivotları Hesapla === [dP, dR1, dR2, dR3, dS1, dS2, dS3] = calcPivots(dH, dL, dC, pivotType) [wP, wR1, wR2, wR3, wS1, wS2, wS3] = calcPivots(wH, wL, wC, pivotType) [mP, mR1, mR2, mR3, mS1, mS2, mS3] = calcPivots(mH, mL, mC, pivotType) [yP, yR1, yR2, yR3, yS1, yS2, yS3] = calcPivots(yH, yL, yC, pivotType) // === Tablo Oluştur === var table pivotTable = table.new(position.top_right, 8, 20, border_width=1) // === Başlıklar === if bar_index % 10 == 0 table.cell(pivotTable, 0, 0, "Zaman", text_color=color.black, bgcolor=color.gray) table.cell(pivotTable, 1, 0, "P", text_color=color.navy) table.cell(pivotTable, 2, 0, "R1", text_color=color.lime) table.cell(pivotTable, 3, 0, "R2", text_color=color.lime) table.cell(pivotTable, 4, 0, "R3", text_color=color.lime) table.cell(pivotTable, 5, 0, "S1", text_color=color.red) table.cell(pivotTable, 6, 0, "S2", text_color=color.red) table.cell(pivotTable, 7, 0, "S3", text_color=color.red) // === Veri Satırı Ekleme Fonksiyonu === addRow(idx, label, p, r1, r2, r3, s1, s2, s3) => table.cell(pivotTable, 0, idx, label, text_color=color.black) table.cell(pivotTable, 1, idx, str.tostring(p, format.mintick)) table.cell(pivotTable, 2, idx, str.tostring(r1, format.mintick)) table.cell(pivotTable, 3, idx, str.tostring(r2, format.mintick)) table.cell(pivotTable, 4, idx, str.tostring(r3, format.mintick)) table.cell(pivotTable, 5, idx, str.tostring(s1, format.mintick)) table.cell(pivotTable, 6, idx, str.tostring(s2, format.mintick)) table.cell(pivotTable, 7, idx, str.tostring(s3, format.mintick)) // === Tabloda Göster === row = 1 if showDaily addRow(row, "Günlük", dP, dR1, dR2, dR3, dS1, dS2, dS3) row += 1 if showWeekly addRow(row, "Haftalık", wP, wR1, wR2, wR3, wS1, wS2, wS3) row += 1 if showMonthly addRow(row, "Aylık", mP, mR1, mR2, mR3, mS1, mS2, mS3) row += 1 if showYearly addRow(row, "Yıllık", yP, yR1, yR2, yR3, yS1, yS2, yS3)