Untitled
unknown
plain_text
10 months ago
4.0 kB
44
Indexable
//@version=5
indicator("RSI Candlesticks (Fitilli)", shorttitle="RSI Candles", overlay=false)
// Inputs
src = close
len = input.int(14, minval=1, title="RSI Length")
// RSI Calculation
up = ta.rma(math.max(ta.change(src), 0), len)
down = ta.rma(-math.min(ta.change(src), 0), len)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
// RSI Candle Data (Fitiller için hesaplama)
rsiOpen = rsi[1] // Bir önceki mumun RSI kapanışı
rsiClose = rsi // Mevcut mumun RSI kapanışı
rsiHigh = math.max(rsi, rsi[1]) // RSI'nın en yüksek değeri (fitil üstü)
rsiLow = math.min(rsi, rsi[1]) // RSI'nın en düşük değeri (fitil altı)
// ADDITIONAL: RSI Candle Code Integration
rsiLength = input.int(14, "RSI Periyodu", minval=1)
t(x) => request.security(syminfo.tickerid, "", ta.rsi(x, rsiLength))
o = t(open)
h = t(high)
l = t(low)
c = t(close)
var color upColor = #00ff0a
var color downColor = #dd0000
plotcandle(o, h, l, c,
title="RSI Mumları",
color = c >= o ? upColor : downColor,
bordercolor = c >= o ? upColor : downColor,
wickcolor = c >= o ? upColor : downColor)
// Fibonacci Levels Inputs
fiboLoopback = input.int(144, title="Fibonacci Loopback", minval=1)
// Fibonacci Levels Calculation
rsiHighFib = ta.highest(rsi, fiboLoopback) // RSI üzerindeki en yüksek değer
rsiLowFib = ta.lowest(rsi, fiboLoopback) // RSI üzerindeki en düşük değer
fib0 = rsiLowFib
fib23_6 = rsiLowFib + (rsiHighFib - rsiLowFib) * 0.236
fib38_2 = rsiLowFib + (rsiHighFib - rsiLowFib) * 0.382
fib50 = rsiLowFib + (rsiHighFib - rsiLowFib) * 0.5
fib61_8 = rsiLowFib + (rsiHighFib - rsiLowFib) * 0.618
fib78_6 = rsiLowFib + (rsiHighFib - rsiLowFib) * 0.786
fib100 = rsiHighFib
// Plot Fibonacci Levels
plot(fib0, title="Fib 0%", color=#ff0014)
plot(fib23_6, title="Fib 23.6%", color=#00ff0a)
plot(fib38_2, title="Fib 38.2%", color=#ffeb3b)
plot(fib50, title="Fib 50%", color=#000000)
plot(fib61_8, title="Fib 61.8%", color=#00e2ff)
plot(fib78_6, title="Fib 78.6%", color=#ff9800)
plot(fib100, title="Fib 100%", color=#00ff0a)
// Smoothing MA inputs
GRP = "Moving Average"
TT_BB = "Only applies when 'SMA + Bollinger Bands' is selected. Determines the distance between the SMA and the bands."
maTypeInput = input.string("SMA", "Type", options = ["None", "SMA", "SMA + Bollinger Bands", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group = GRP, display = display.data_window)
maLengthInput = input.int(14, "Length", group = GRP, display = display.data_window)
bbMultInput = input.float(2.0, "BB StdDev", minval = 0.001, maxval = 50, step = 0.5, tooltip = TT_BB, group = GRP, display = display.data_window)
var enableMA = maTypeInput != "None"
var isBB = maTypeInput == "SMA + Bollinger Bands"
// Smoothing MA Calculation
ma(source, length, MAtype) =>
switch MAtype
"SMA" => ta.sma(source, length)
"SMA + Bollinger Bands" => ta.sma(source, length)
"EMA" => ta.ema(source, length)
"SMMA (RMA)" => ta.rma(source, length)
"WMA" => ta.wma(source, length)
"VWMA" => ta.vwma(source, length)
// Smoothing MA plots
smoothingMA = enableMA ? ma(rsi, maLengthInput, maTypeInput) : na
smoothingStDev = isBB ? ta.stdev(rsi, maLengthInput) * bbMultInput : na
plot(smoothingMA, "RSI-based MA", color=color.yellow, display = enableMA ? display.all : display.none)
bbUpperBand = plot(smoothingMA + smoothingStDev, title = "Upper Bollinger Band", color=color.green, display = isBB ? display.all : display.none)
bbLowerBand = plot(smoothingMA - smoothingStDev, title = "Lower Bollinger Band", color=color.green, display = isBB ? display.all : display.none)
fill(bbUpperBand, bbLowerBand, color= isBB ? color.new(color.green, 90) : na, title="Bollinger Bands Background Fill", display = isBB ? display.all : display.none)Editor is loading...
Leave a Comment