Guest User

Untitled

a guest
Apr 17th, 2023
225
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.50 KB | None | 0 0
  1. // Burada indikatörümüzün kimliği, tanımladığımız veri setleri ve bazı değişkenler bulunuyor.
  2.  
  3. indicator(title='RSI Uyumsuzluk İndikatörü V3.0 - Yunus)', shorttitle='RSI Uyumsuzluk İndikatörü V3.0 - Yunus', overlay=false)
  4.  
  5. len = input.int(title='RSI Period', minval=1, defval=8)
  6. src = input(title='RSI Source', defval=close)
  7. lbR = input(title='Pivot Lookback Right', defval=9)
  8. lbL = input(title='Pivot Lookback Left', defval=8)
  9.  
  10. // Burada yazılan RSI göstergesi Tradingview'in orijinal göstergesi, 100% doğru çalışması için farklı bir gösterge tercih edilmedi.
  11.  
  12. ma(source, length, type) =>
  13. switch type
  14. "WMA" => ta.wma(source, length)
  15. "SMA" => ta.sma(source, length)
  16. "Bollinger Bands" => ta.sma(source, length)
  17. "EMA" => ta.ema(source, length)
  18. "SMMA (RMA)" => ta.rma(source, length)
  19. "VWMA" => ta.vwma(source, length)
  20.  
  21. rsiLengthInput = input.int(14, minval=1, title="RSI Length", group="RSI Settings")
  22. rsiSourceInput = input.source(close, "Source", group="RSI Settings")
  23. maTypeInput = input.string("SMA", title="MA Type", options=["WMA", "Bollinger Bands", "EMA", "SMMA (RMA)", "SMA", "VWMA"], group="MA Settings")
  24. maLengthInput = input.int(14, title="MA Length", group="MA Settings")
  25. bbMultInput = input.float(2.0, minval=0.001, maxval=50, title="BB StdDev", group="MA Settings")
  26.  
  27. up = ta.rma(math.max(ta.change(rsiSourceInput), 0), rsiLengthInput)
  28. down = ta.rma(-math.min(ta.change(rsiSourceInput), 0), rsiLengthInput)
  29. rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
  30. rsiMA = ma(rsi, maLengthInput, maTypeInput)
  31. isBB = maTypeInput == "Bollinger Bands"
  32.  
  33. //Bu kısım RSI hatlarının grafiğe dönüştürüldüğü kısım.
  34. //Dilin yapısı sebebiyle buradaki renk değişimleri grafik üzerindeki menüden yapılabilir.
  35.  
  36. plot(rsi, "RSI", color.new(color.white, 10))
  37. plot(rsiMA, "RSI-based MA", color=color.yellow)
  38. rsiUpperBand = hline(70, "RSI Upper Band", color=#787B86)
  39. hline(50, "RSI Middle Band", color=color.new(#787B86, 50))
  40. rsiLowerBand = hline(30, "RSI Lower Band", color=#787B86)
  41. fill(rsiUpperBand, rsiLowerBand, color=color.rgb(126, 87, 194, 90), title="RSI Background Fill")
  42. bbUpperBand = plot(isBB ? rsiMA + ta.stdev(rsi, maLengthInput) * bbMultInput : na, title = "Upper Bollinger Band", color=color.green)
  43. bbLowerBand = plot(isBB ? rsiMA - ta.stdev(rsi, maLengthInput) * bbMultInput : na, title = "Lower Bollinger Band", color=color.green)
  44. fill(bbUpperBand, bbLowerBand, color= isBB ? color.new(color.green, 90) : na, title="Bollinger Bands Background Fill")
  45.  
  46. // 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.
  47.  
  48. // ------------------
  49.  
  50. // rangeUpper ve rangeLower, yalnızca pivotların aranacağı bar aralığını belirler. Varsayılan olarak, rangeUpper 60 ve rangeLower 5 olarak ayarlanmıştır.
  51. // Grafiğin çizileceği pivot aralığı kullanıcının isteğiyle TV içerisindeki panelden ayarlanabilir.
  52.  
  53. rangeUpper = input(title='Max of Lookback Range', defval=50)
  54. rangeLower = input(title='Min of Lookback Range', defval=6)
  55.  
  56. // ------------------
  57.  
  58. //plotBull, plotHiddenBull, plotBear ve plotHiddenBear girdileri, hangi tür pivotlerin grafiğe çizileceğini belirler.
  59. //Varsayılan olarak, bu girdilerin tümü true olarak ayarlanmıştır, yani grafiğe tüm pivot tipleri çizilir.
  60.  
  61. plotBull = input(title='Plot Bullish', defval=true)
  62. plotHiddenBull = input(title='Plot Hidden Bullish', defval=false)
  63. plotBear = input(title='Plot Bearish', defval=true)
  64. plotHiddenBear = input(title='Plot Hidden Bearish', defval=false)
  65.  
  66. // ------------------
  67.  
  68. bearColor = color.red
  69. bullColor = color.green
  70. hiddenBullColor = color.green
  71. hiddenBearColor = color.red
  72. textColor = color.white
  73. noneColor = color.new(color.white, 100)
  74.  
  75. osc = ta.rsi(src, len)
  76.  
  77. plFound = na(ta.pivotlow(osc, lbL, lbR)) ? false : true
  78. phFound = na(ta.pivothigh(osc, lbL, lbR)) ? false : true
  79.  
  80. _inRange(cond) =>
  81. bars = ta.barssince(cond == true)
  82. rangeLower <= bars and bars <= rangeUpper
  83.  
  84. ///////////////////////////////////////////////////////////////////////----------\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  85. // ----------------------------- Bu satırın altındaki kodlar uyumsuzluğu hesaplama ve grafikte etiketlemek üzerinedir. -------------------------- \\
  86.  
  87.  
  88. //------------------------------------------------------------------------------
  89. // Regular Bullish
  90. // Osc: Higher Low
  91.  
  92. oscHL = osc[lbR] > ta.valuewhen(plFound, osc[lbR], 1) and _inRange(plFound[1])
  93.  
  94. // Price: Lower Low
  95.  
  96. priceLL = low[lbR] < ta.valuewhen(plFound, low[lbR], 1)
  97. bullCond = plotBull and priceLL and oscHL and plFound
  98.  
  99. plot(
  100. plFound ? osc[lbR] : na,
  101. offset=-lbR,
  102. title="Regular Bullish",
  103. linewidth=2,
  104. color=(bullCond ? bullColor : noneColor)
  105. )
  106.  
  107. plotshape(
  108. bullCond ? osc[lbR] : na,
  109. offset=-lbR,
  110. title="Regular Bullish Label",
  111. text=" Bull ",
  112. style=shape.labelup,
  113. location=location.absolute,
  114. color=bullColor,
  115. textcolor=textColor
  116. )
  117.  
  118. //------------------------------------------------------------------------------
  119. // Hidden Bullish
  120. // Osc: Lower Low
  121.  
  122. oscLL = osc[lbR] < ta.valuewhen(plFound, osc[lbR], 1) and _inRange(plFound[1])
  123.  
  124. // Price: Higher Low
  125.  
  126. priceHL = low[lbR] > ta.valuewhen(plFound, low[lbR], 1)
  127. hiddenBullCond = plotHiddenBull and priceHL and oscLL and plFound
  128.  
  129. plot(
  130. plFound ? osc[lbR] : na,
  131. offset=-lbR,
  132. title="Hidden Bullish",
  133. linewidth=2,
  134. color=(hiddenBullCond ? hiddenBullColor : noneColor)
  135. )
  136.  
  137. plotshape(
  138. hiddenBullCond ? osc[lbR] : na,
  139. offset=-lbR,
  140. title="Hidden Bullish Label",
  141. text=" H Bull ",
  142. style=shape.labelup,
  143. location=location.absolute,
  144. color=bullColor,
  145. textcolor=textColor
  146. )
  147.  
  148. //------------------------------------------------------------------------------
  149. // Regular Bearish
  150. // Osc: Lower High
  151.  
  152. oscLH = osc[lbR] < ta.valuewhen(phFound, osc[lbR], 1) and _inRange(phFound[1])
  153.  
  154. // Price: Higher High
  155.  
  156. priceHH = high[lbR] > ta.valuewhen(phFound, high[lbR], 1)
  157.  
  158. bearCond = plotBear and priceHH and oscLH and phFound
  159.  
  160. plot(
  161. phFound ? osc[lbR] : na,
  162. offset=-lbR,
  163. title="Regular Bearish",
  164. linewidth=2,
  165. color=(bearCond ? bearColor : noneColor)
  166. )
  167.  
  168. plotshape(
  169. bearCond ? osc[lbR] : na,
  170. offset=-lbR,
  171. title="Regular Bearish Label",
  172. text=" Bear ",
  173. style=shape.labeldown,
  174. location=location.absolute,
  175. color=bearColor,
  176. textcolor=textColor
  177. )
  178.  
  179. //------------------------------------------------------------------------------
  180. // Hidden Bearish
  181. // Osc: Higher High
  182.  
  183. oscHH = osc[lbR] > ta.valuewhen(phFound, osc[lbR], 1) and _inRange(phFound[1])
  184.  
  185. // Price: Lower High
  186.  
  187. priceLH = high[lbR] < ta.valuewhen(phFound, high[lbR], 1)
  188.  
  189. hiddenBearCond = plotHiddenBear and priceLH and oscHH and phFound
  190.  
  191. plot(
  192. phFound ? osc[lbR] : na,
  193. offset=-lbR,
  194. title="Hidden Bearish",
  195. linewidth=2,
  196. color=(hiddenBearCond ? hiddenBearColor : noneColor)
  197. )
  198.  
  199. plotshape(
  200. hiddenBearCond ? osc[lbR] : na,
  201. offset=-lbR,
  202. title="Hidden Bearish Label",
  203. text=" H Bear ",
  204. style=shape.labeldown,
  205. location=location.absolute,
  206. color=bearColor,
  207. textcolor=textColor
  208. )
  209.  
  210. //\\ ---------------------------- Bu satırın üstündeki kodlar uyumsuzluğu hesaplama ve grafikte etiketlemek üzerinedir. ------------------------- //\\
  211.  
  212. ///\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\----------/////////////////////////////////////////////////////////////////////\\\
Advertisement
Comments
Add Comment
Please, Sign In to add comment