xmd79

A PLUS B

Apr 25th, 2021
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.15 KB | None | 0 0
  1. //@version=4
  2. study("A PLUS B", overlay=true)
  3.  
  4. sure = input(false, title="destek/direnç?")
  5. fb = input(true, title="fibonacci?")
  6. malar = input(true, title="malar?")
  7. emalar = input(true, title="emalar?")
  8. ichimoku = input(true, title="ichimoku?")
  9. smabolinger = input(false, title="smabolinger?")
  10.  
  11.  
  12. left = 50
  13. right = 25
  14. quick_right = 5 // Used to try and detect a more recent significant swing.
  15.  
  16. pivot_high = pivothigh(high, left, right)
  17. pivot_lows = pivotlow(low, left, right)
  18.  
  19. quick_pivot_high = pivothigh(high, left, quick_right)
  20. quick_pivot_lows = pivotlow(low, left, quick_right)
  21.  
  22. level1 = valuewhen(quick_pivot_high, high[quick_right], 0)
  23. level2 = valuewhen(quick_pivot_lows, low[quick_right], 0)
  24. level3 = valuewhen(pivot_high, high[right], 0)
  25. level4 = valuewhen(pivot_lows, low[right], 0)
  26. level5 = valuewhen(pivot_high, high[right], 1)
  27. level6 = valuewhen(pivot_lows, low[right], 1)
  28. level7 = valuewhen(pivot_high, high[right], 2)
  29. level8 = valuewhen(pivot_lows, low[right], 2)
  30.  
  31. level1_col = close >= level1 ? color.green : color.red
  32. level2_col = close >= level2 ? color.green : color.red
  33. level3_col = close >= level3 ? color.green : color.red
  34. level4_col = close >= level4 ? color.green : color.red
  35. level5_col = close >= level5 ? color.green : color.red
  36. level6_col = close >= level6 ? color.green : color.red
  37. level7_col = close >= level7 ? color.green : color.red
  38. level8_col = close >= level8 ? color.green : color.red
  39.  
  40. plot(sure and level1 ? level1 : na, style=plot.style_circles, color=level1_col, show_last=1, linewidth=1, trackprice=true)
  41. plot(sure and level2 ? level2 : na, style=plot.style_circles, color=level2_col, show_last=1, linewidth=1, trackprice=true)
  42. plot(sure and level3 ? level3 : na, style=plot.style_circles, color=level3_col, show_last=1, linewidth=1, trackprice=true)
  43. plot(sure and level4 ? level4 : na, style=plot.style_circles, color=level4_col, show_last=1, linewidth=1, trackprice=true)
  44. plot(sure and level5 ? level5 : na, style=plot.style_circles, color=level5_col, show_last=1, linewidth=1, trackprice=true)
  45. plot(sure and level6 ? level6 : na, style=plot.style_circles, color=level6_col, show_last=1, linewidth=1, trackprice=true)
  46. plot(sure and level7 ? level7 : na, style=plot.style_circles, color=level7_col, show_last=1, linewidth=1, trackprice=true)
  47. plot(sure and level8 ? level8 : na, style=plot.style_circles, color=level8_col, show_last=1, linewidth=1, trackprice=true)
  48.  
  49.  
  50. FPeriod = input(100, title="Fibo Period")
  51.  
  52.  
  53. Fhigh = highest(FPeriod)
  54. Flow = lowest(FPeriod)
  55. FH = highestbars(high, FPeriod)
  56. FL = lowestbars(low, FPeriod)
  57. downfibo = FH < FL
  58.  
  59. F0 = downfibo ? Flow : Fhigh
  60. F236 = downfibo ? (Fhigh - Flow) * 0.236 + Flow : Fhigh - (Fhigh - Flow) * 0.236
  61. F382 = downfibo ? (Fhigh - Flow) * 0.382 + Flow : Fhigh - (Fhigh - Flow) * 0.382
  62. F500 = downfibo ? (Fhigh - Flow) * 0.500 + Flow : Fhigh - (Fhigh - Flow) * 0.500
  63. F618 = downfibo ? (Fhigh - Flow) * 0.618 + Flow : Fhigh - (Fhigh - Flow) * 0.618
  64. F786 = downfibo ? (Fhigh - Flow) * 0.786 + Flow : Fhigh - (Fhigh - Flow) * 0.786
  65. F1000 = downfibo ? (Fhigh - Flow) * 1.000 + Flow : Fhigh - (Fhigh - Flow) * 1.000
  66.  
  67.  
  68. Fcolor = downfibo ? #4a9b4a : #a03e42
  69. Foffset = downfibo ? FH : FL
  70.  
  71. plot(fb and F0 ? F0 : na, color=Fcolor, linewidth=2, trackprice=true, show_last=1, title='0', transp=0)
  72. plot(fb and F236 ? F236 : na, color=Fcolor, linewidth=1, trackprice=true, show_last=1, title='0.236', transp=0)
  73. plot(fb and F382 ? F382 : na, color=Fcolor, linewidth=1, trackprice=true, show_last=1, title='0.382', transp=0)
  74. plot(fb and F500 ? F500 : na, color=Fcolor, linewidth=2, trackprice=true, show_last=1, title='0.5', transp=0)
  75. plot(fb and F618 ? F618 : na, color=Fcolor, linewidth=1, trackprice=true, show_last=1, title='0.618', transp=0)
  76. plot(fb and F786 ? F786 : na, color=Fcolor, linewidth=1, trackprice=true, show_last=1, title='0.786', transp=0)
  77. plot(fb and F1000 ? F1000 : na, color=Fcolor, linewidth=2, trackprice=true, show_last=1, title='1', transp=0)
  78.  
  79.  
  80. plotshape(fb and F0 ? F0 : na, style=shape.labeldown, location=location.absolute, color=Fcolor, textcolor=color.black, show_last=1, text="%0", offset=15, transp=30)
  81. plotshape(fb and F236 ? F236 : na, style=shape.labeldown, location=location.absolute, color=Fcolor, textcolor=color.black, show_last=1, text="%23.6", offset=15, transp=30)
  82. plotshape(fb and F382 ? F382 : na, style=shape.labeldown, location=location.absolute, color=Fcolor, textcolor=color.black, show_last=1, text="%38.2", offset=15, transp=30)
  83. plotshape(fb and F500 ? F500 : na, style=shape.labeldown, location=location.absolute, color=Fcolor, textcolor=color.black, show_last=1, text="%50", offset=15, transp=30)
  84. plotshape(fb and F618 ? F618 : na, style=shape.labeldown, location=location.absolute, color=Fcolor, textcolor=color.black, show_last=1, text="%61.8", offset=15, transp=30)
  85. plotshape(fb and F786 ? F786 : na, style=shape.labeldown, location=location.absolute, color=Fcolor, textcolor=color.black, show_last=1, text="%78.6", offset=15, transp=30)
  86. plotshape(fb and F1000 ? F1000 : na, style=shape.labeldown, location=location.absolute, color=Fcolor, textcolor=color.black, show_last=1, text="%100", offset=15, transp=30)
  87.  
  88.  
  89. ma20 = sma(close, 20)
  90. plot(malar and ma20 ? ma20 : na, color=color.green, linewidth=2, title="ma20")
  91. ma50 = sma(close, 50)
  92. plot(malar and ma50 ? ma50 : na, color=color.aqua, linewidth=2, title="ma50")
  93. ma100 = sma(close, 100)
  94. plot(malar and ma100 ? ma100 : na, color=color.orange, linewidth=1, title="ma100")
  95. ma200 = sma(close, 200)
  96. plot(malar and ma200 ? ma200 : na, color=color.fuchsia, linewidth=2, title="ma200")
  97.  
  98. ema9 = ema(close, 9)
  99. plot(emalar and ema9 ? ema9 : na, color=color.blue, linewidth=2, title="ema9")
  100. ema21 = ema(close, 21)
  101. plot(emalar and ema21 ? ema21 : na, color=color.red, linewidth=1, title="ema21")
  102. ema55 = ema(close, 55)
  103. plot(emalar and ema55 ? ema55 : na, color=color.lime, linewidth=2, title="ema55")
  104. ema89 = ema(close, 89)
  105. plot(emalar and ema89 ? ema89 : na, color=#9c27b0, linewidth=1, title="ema89")
  106. ema144 = ema(close, 144)
  107. plot(emalar and ema144 ? ema144 : na, color=color.black, linewidth=2, title="ema144")
  108. ema233 = ema(close, 233)
  109. plot(emalar and ema233 ? ema233 : na, color=color.maroon, linewidth=1, title="ema233")
  110.  
  111. TK = avg(lowest(9), highest(9))
  112. KJ = avg(lowest(26), highest(26))
  113. CS = close
  114. SB = avg(lowest(52), highest(52))
  115. SA = avg(TK, KJ)
  116.  
  117. plot(ichimoku and TK ? TK : na, linewidth=2, color=color.blue, title="TenkanSen")
  118. plot(ichimoku and KJ ? KJ : na, linewidth=2, color=color.red, title="KijunSen")
  119.  
  120. plot(ichimoku and CS ? CS : na, offset=-26, linewidth=2, color=#DDA0DD, title="ChikouSpan")
  121.  
  122. SenkouA = plot(ichimoku and SA ? SA : na, offset=26, linewidth=1, color=color.green, title="SenkouSpanA")
  123. SenkouB = plot(ichimoku and SB ? SB : na, offset=26, linewidth=1, color=color.purple, title="SenkouSpanB")
  124.  
  125. fill(SenkouA, SenkouB, color=SA > SB ? color.green : color.red)
  126.  
  127. basis = sma(close, 20)
  128. dev = 2 * stdev(close, 20)
  129. upper = basis + dev
  130. lower = basis - dev
  131. plot(smabolinger and basis ? basis : na, color=#cc37e6, linewidth=1, title="bb")
  132. plot(smabolinger and upper ? upper : na, color=#cc37e6, linewidth=1, title="bb")
  133. plot(smabolinger and lower ? lower : na, color=#cc37e6, linewidth=1, title="bb")
  134.  
Advertisement
Add Comment
Please, Sign In to add comment