Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Burada indikatörümüzün kimliği, tanımladığımız veri setleri ve bazı değişkenler bulunuyor.
- indicator(title='RSI Uyumsuzluk İndikatörü V3.0 - Yunus)', shorttitle='RSI Uyumsuzluk İndikatörü V3.0 - Yunus', overlay=false)
- len = input.int(title='RSI Period', minval=1, defval=8)
- src = input(title='RSI Source', defval=close)
- lbR = input(title='Pivot Lookback Right', defval=9)
- lbL = input(title='Pivot Lookback Left', defval=8)
- // Burada yazılan RSI göstergesi Tradingview'in orijinal göstergesi, 100% doğru çalışması için farklı bir gösterge tercih edilmedi.
- ma(source, length, type) =>
- switch type
- "WMA" => ta.wma(source, length)
- "SMA" => ta.sma(source, length)
- "Bollinger Bands" => ta.sma(source, length)
- "EMA" => ta.ema(source, length)
- "SMMA (RMA)" => ta.rma(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=["WMA", "Bollinger Bands", "EMA", "SMMA (RMA)", "SMA", "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"
- //Bu kısım RSI hatlarının grafiğe dönüştürüldüğü kısım.
- //Dilin yapısı sebebiyle buradaki renk değişimleri grafik üzerindeki menüden yapılabilir.
- plot(rsi, "RSI", color.new(color.white, 10))
- 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")
- // Bu kısım uyumsuzluk tespiti için kullandığımız uzun çizgilerin ve sinyal çizgilerinin grafiğe dönüştürüldüğü kısım.
- // ------------------
- // rangeUpper ve rangeLower, yalnızca pivotların aranacağı bar aralığını belirler. Varsayılan olarak, rangeUpper 60 ve rangeLower 5 olarak ayarlanmıştır.
- // Grafiğin çizileceği pivot aralığı kullanıcının isteğiyle TV içerisindeki panelden ayarlanabilir.
- rangeUpper = input(title='Max of Lookback Range', defval=50)
- rangeLower = input(title='Min of Lookback Range', defval=6)
- // ------------------
- //plotBull, plotHiddenBull, plotBear ve plotHiddenBear girdileri, hangi tür pivotlerin grafiğe çizileceğini belirler.
- //Varsayılan olarak, bu girdilerin tümü true olarak ayarlanmıştır, yani grafiğe tüm pivot tipleri çizilir.
- plotBull = input(title='Plot Bullish', defval=true)
- plotHiddenBull = input(title='Plot Hidden Bullish', defval=false)
- plotBear = input(title='Plot Bearish', defval=true)
- plotHiddenBear = input(title='Plot Hidden Bearish', defval=false)
- // ------------------
- bearColor = color.red
- bullColor = color.green
- hiddenBullColor = color.green
- hiddenBearColor = color.red
- textColor = color.white
- noneColor = color.new(color.white, 100)
- osc = ta.rsi(src, len)
- plFound = na(ta.pivotlow(osc, lbL, lbR)) ? false : true
- phFound = na(ta.pivothigh(osc, lbL, lbR)) ? false : true
- _inRange(cond) =>
- bars = ta.barssince(cond == true)
- rangeLower <= bars and bars <= rangeUpper
- ///////////////////////////////////////////////////////////////////////----------\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- // ----------------------------- Bu satırın altındaki kodlar uyumsuzluğu hesaplama ve grafikte etiketlemek üzerinedir. -------------------------- \\
- //------------------------------------------------------------------------------
- // Regular Bullish
- // Osc: Higher Low
- oscHL = osc[lbR] > ta.valuewhen(plFound, osc[lbR], 1) and _inRange(plFound[1])
- // Price: Lower Low
- priceLL = low[lbR] < ta.valuewhen(plFound, low[lbR], 1)
- bullCond = plotBull and priceLL and oscHL and plFound
- plot(
- plFound ? osc[lbR] : na,
- offset=-lbR,
- title="Regular Bullish",
- linewidth=2,
- color=(bullCond ? bullColor : noneColor)
- )
- plotshape(
- bullCond ? osc[lbR] : na,
- offset=-lbR,
- title="Regular Bullish Label",
- text=" Bull ",
- style=shape.labelup,
- location=location.absolute,
- color=bullColor,
- textcolor=textColor
- )
- //------------------------------------------------------------------------------
- // Hidden Bullish
- // Osc: Lower Low
- oscLL = osc[lbR] < ta.valuewhen(plFound, osc[lbR], 1) and _inRange(plFound[1])
- // Price: Higher Low
- priceHL = low[lbR] > ta.valuewhen(plFound, low[lbR], 1)
- hiddenBullCond = plotHiddenBull and priceHL and oscLL and plFound
- plot(
- plFound ? osc[lbR] : na,
- offset=-lbR,
- title="Hidden Bullish",
- linewidth=2,
- color=(hiddenBullCond ? hiddenBullColor : noneColor)
- )
- plotshape(
- hiddenBullCond ? osc[lbR] : na,
- offset=-lbR,
- title="Hidden Bullish Label",
- text=" H Bull ",
- style=shape.labelup,
- location=location.absolute,
- color=bullColor,
- textcolor=textColor
- )
- //------------------------------------------------------------------------------
- // Regular Bearish
- // Osc: Lower High
- oscLH = osc[lbR] < ta.valuewhen(phFound, osc[lbR], 1) and _inRange(phFound[1])
- // Price: Higher High
- priceHH = high[lbR] > ta.valuewhen(phFound, high[lbR], 1)
- bearCond = plotBear and priceHH and oscLH and phFound
- plot(
- phFound ? osc[lbR] : na,
- offset=-lbR,
- title="Regular Bearish",
- linewidth=2,
- color=(bearCond ? bearColor : noneColor)
- )
- plotshape(
- bearCond ? osc[lbR] : na,
- offset=-lbR,
- title="Regular Bearish Label",
- text=" Bear ",
- style=shape.labeldown,
- location=location.absolute,
- color=bearColor,
- textcolor=textColor
- )
- //------------------------------------------------------------------------------
- // Hidden Bearish
- // Osc: Higher High
- oscHH = osc[lbR] > ta.valuewhen(phFound, osc[lbR], 1) and _inRange(phFound[1])
- // Price: Lower High
- priceLH = high[lbR] < ta.valuewhen(phFound, high[lbR], 1)
- hiddenBearCond = plotHiddenBear and priceLH and oscHH and phFound
- plot(
- phFound ? osc[lbR] : na,
- offset=-lbR,
- title="Hidden Bearish",
- linewidth=2,
- color=(hiddenBearCond ? hiddenBearColor : noneColor)
- )
- plotshape(
- hiddenBearCond ? osc[lbR] : na,
- offset=-lbR,
- title="Hidden Bearish Label",
- text=" H Bear ",
- style=shape.labeldown,
- location=location.absolute,
- color=bearColor,
- textcolor=textColor
- )
- //\\ ---------------------------- Bu satırın üstündeki kodlar uyumsuzluğu hesaplama ve grafikte etiketlemek üzerinedir. ------------------------- //\\
- ///\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\----------/////////////////////////////////////////////////////////////////////\\\
Advertisement
Comments
-
- hello, can you make PREDICTUM INDICATOR code....???
Add Comment
Please, Sign In to add comment