anladığım kadarı ile.... sma rsı kesişimini bar renklensin istemişiniz....
https://www.tradingview.com/x/HZYP2UMb/
ben böyle yapmış olayım....siz yine de daha iyi bilene sorun bence....
benim yaptığımda kesişim yeri fiyat olarak belli eder ve yeşil-kırmızı renk ayarındadır....
buyrun buda kodu.....
//@version=5
indicator(title="Relative Strength Index", shorttitle="RSI", format=format.price, precision=2, timeframe="", timeframe_gaps=true)
ma(source, length, type) =>
switch type
"SMA" => ta.sma(source, length)
"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)
rsiLengthInput = input.int(14, minval=1, title="RSI Length", group="RSI Settings")
rsiSourceInput = input.source(close, "Source", group="RSI Settings")
maTypeInput = input.string("SMA", title="MA Type", options=["SMA", "Bollinger Bands", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group="MA Settings")
maLengthInput = input.int(14, title="MA Length", group="MA Settings")
bbMultInput = input.float(2.0, minval=0.001, maxval=50, title="BB StdDev", group="MA Settings")
up = ta.rma(math.max(ta.change(rsiSourceInput), 0), rsiLengthInput)
down = ta.rma(-math.min(ta.change(rsiSourceInput), 0), rsiLengthInput)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
rsiMA = ma(rsi, maLengthInput, maTypeInput)
isBB = maTypeInput == "Bollinger Bands"
plot(rsi, "RSI", color=#7E57C2)
plot(rsiMA, "RSI-based MA", color=color.yellow)
rsiUpperBand = hline(70, "RSI Upper Band", color=#787B86)
hline(50, "RSI Middle Band", color=color.new(#787B86, 50))
rsiLowerBand = hline(30, "RSI Lower Band", color=#787B86)
fill(rsiUpperBand, rsiLowerBand, color=color.rgb(126, 87, 194, 90), title="RSI Background Fill")
bbUpperBand = plot(isBB ? rsiMA + ta.stdev(rsi, maLengthInput) * bbMultInput : na, title = "Upper Bollinger Band", color=color.green)
bbLowerBand = plot(isBB ? rsiMA - ta.stdev(rsi, maLengthInput) * bbMultInput : na, title = "Lower Bollinger Band", color=color.green)
fill(bbUpperBand, bbLowerBand, color= isBB ? color.new(color.green, 90) : na, title="Bollinger Bands Background Fill")
// bullish if fast > slow, else bearish
bullish = rsi >= rsiMA
bearish = not bullish
did_cross_up = bearish[1] and bullish
did_cross_dn = bullish[1] and bearish
// Store prices that the crosses occured at.
var float[] cross_up_prices = array.new_float(1, 0.0)
var float[] cross_dn_prices = array.new_float(1, 0.0)
// Push closing price if cross up or down.
if (did_cross_up)
array.push(cross_up_prices, close)
if (did_cross_dn)
array.push(cross_dn_prices, close)
// Plotting.
plot(bullish ? array.get(cross_up_prices, array.size(cross_up_prices)-1) : array.get(cross_dn_prices, array.size(cross_dn_prices)-1), title="kesisim",color=bullish ? color.lime : color.red, style=plot.style_circles, transp=00, linewidth=1)
barcolor(bullish ? color.green : color.red)