Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.20 KB | None | 0 0
  1. //@version=3
  2. study(title='E', overlay=true)
  3.  
  4. show_labels = input(true, title='SHOW LABELS')
  5. show_daily = input(false, title='SHOW DAILY')
  6. hide_normal = input(false, title='HIDE NORMAL')
  7. show_slope = input(false, title='SHOW SLOPE')
  8. show_gdx = input(true, title='SHOW G/D X')
  9. show_x_emas = input(false, title='SHOW X EMAS')
  10.  
  11. hide_normal_1 = hide_normal == false and show_slope == false or hide_normal == true and show_slope == false
  12. hide_normal_2 = show_labels == true and show_daily == true and hide_normal == false and show_slope == true and show_gdx == true and show_x_emas == true
  13. hide_normal_3 = show_labels == false and show_daily == false and hide_normal == false and show_slope == true and show_gdx == false and show_x_emas == true
  14. hide_normal_4 = show_labels == false and show_daily == true and hide_normal == false and show_slope == true and show_gdx == false and show_x_emas == true
  15. hide_normal_5 = show_labels == false and show_daily == true and hide_normal == false and show_slope == true and show_gdx == true and show_x_emas == true
  16. hide_normal_6 = show_labels == true and show_daily == true and hide_normal == false and show_slope == true and show_gdx == false and show_x_emas == true
  17. hide_normal_7 = show_labels == false and show_daily == false and hide_normal == true and show_slope == true and show_gdx == false and show_x_emas == true
  18. hide_normal_8 = show_labels == true and show_daily == false and hide_normal == false and show_slope == true and show_gdx == true and show_x_emas == true
  19. hide_normal_9 = show_labels == true and show_daily == false and hide_normal == false and show_slope == true and show_gdx == false and show_x_emas == true
  20. hide_normal_10 = show_labels == false and show_daily == false and hide_normal == false and show_slope == true and show_gdx == true and show_x_emas == true
  21. hide_normal_11 = show_labels == true and show_daily == false and hide_normal == true and show_slope == true and show_gdx == false and show_x_emas == true
  22. hide_normal_12 = show_labels == false and show_daily == false and hide_normal == true and show_slope == true and show_gdx == true and show_x_emas == true
  23. hide_normal_13 = show_labels == true and show_daily == false and hide_normal == true and show_slope == true and show_gdx == true and show_x_emas == true
  24. hide_normal_0 = hide_normal_1 or hide_normal_2 or hide_normal_3 or hide_normal_4 or hide_normal_5 or hide_normal_6 or hide_normal_7 or hide_normal_8 or hide_normal_9 or hide_normal_10 or hide_normal_11 or hide_normal_12 or hide_normal_13
  25.  
  26. show_daily_1 = show_daily == true
  27. show_daily_2 = show_labels == false and show_daily == false and hide_normal == false and show_slope == true and show_gdx == false and show_x_emas == false
  28. show_daily_3 = show_labels == false and show_daily == false and hide_normal == false and show_slope == true and show_gdx == false and show_x_emas == true
  29. show_daily_4 = show_labels == true and show_daily == false and hide_normal == false and show_slope == true and show_gdx == false and show_x_emas == false
  30. show_daily_5 = show_labels == false and show_daily == false and hide_normal == true and show_slope == true and show_gdx == false and show_x_emas == true
  31. show_daily_6 = show_labels == true and show_daily == false and hide_normal == false and show_slope == true and show_gdx == false and show_x_emas == true
  32. show_daily_7 = show_labels == true and show_daily == false and hide_normal == true and show_slope == true and show_gdx == false and show_x_emas == true
  33. show_daily_8 = show_labels == false and show_daily == false and hide_normal == true and show_slope == true and show_gdx == true and show_x_emas == true
  34. show_daily_9 = show_labels == false and show_daily == false and hide_normal == true and show_slope == false and show_gdx == true and show_x_emas == true
  35. show_daily_10 = show_labels == true and show_daily == false and hide_normal == true and show_slope == false and show_gdx == true and show_x_emas == true
  36. show_daily_11 = show_labels == true and show_daily == false and hide_normal == true and show_slope == false and show_gdx == false and show_x_emas == true
  37. show_daily_12 = show_labels == true and show_daily == false and hide_normal == true and show_slope == true and show_gdx == true and show_x_emas == true
  38. show_daily_13 = show_labels == true and show_daily == false and hide_normal == true and show_slope == true and show_gdx == true and show_x_emas == false
  39. show_daily_14 = show_daily == false and hide_normal == false and show_slope == true and show_gdx == true and show_x_emas == false
  40. show_daily_0 = show_daily_1 or show_daily_2 or show_daily_3 or show_daily_4 or show_daily_5 or show_daily_6 or show_daily_7 or show_daily_8 or show_daily_9 or show_daily_10 or show_daily_11 or show_daily_12 or show_daily_13 or show_daily_14
  41.  
  42. show_slope_1 = show_daily == true and show_x_emas == false or show_daily == true and show_x_emas == true and hide_normal == true and show_slope == true
  43. show_slope_2 = show_labels == false and show_daily == false and hide_normal == false and show_slope == true and show_gdx == false and show_x_emas == false
  44. show_slope_3 = show_labels == false and show_daily == false and hide_normal == false and show_slope == true and show_gdx == false and show_x_emas == true
  45. show_slope_4 = show_labels == false and show_daily == true and hide_normal == false and show_slope == true and show_gdx == false and show_x_emas == true
  46. show_slope_5 = show_labels == false and show_daily == true and hide_normal == false and show_slope == true and show_gdx == true and show_x_emas == true
  47. show_slope_6 = show_labels == false and show_daily == false and hide_normal == true and show_slope == true and show_gdx == false and show_x_emas == true
  48. show_slope_7 = show_labels == true and show_daily == true and hide_normal == false and show_slope == true and show_gdx == false and show_x_emas == true
  49. show_slope_8 = show_labels == false and show_daily == false and hide_normal == false and show_slope == true and show_gdx == true and show_x_emas == true
  50. show_slope_9 = show_labels == true and show_daily == false and hide_normal == false and show_slope == true and show_gdx == true and show_x_emas == true
  51. show_slope_10 = show_labels == true and show_daily == true and hide_normal == false and show_slope == true and show_gdx == true and show_x_emas == true
  52. show_slope_11 = show_labels == true and show_daily == false and hide_normal == false and show_slope == true and show_gdx == false and show_x_emas == true
  53. show_slope_12 = show_labels == true and show_daily == false and hide_normal == true and show_slope == true and show_gdx == false and show_x_emas == true
  54. show_slope_13 = show_labels == false and show_daily == false and hide_normal == true and show_slope == true and show_gdx == true and show_x_emas == true
  55. show_slope_14 = show_labels == true and show_daily == false and hide_normal == true and show_slope == true and show_gdx == true and show_x_emas == true
  56. show_slope_15 = show_labels == true and show_daily == false and hide_normal == true and show_slope == true and show_gdx == true and show_x_emas == false
  57. show_slope_16 = show_daily == false and hide_normal == false and show_slope == true and show_gdx == false and show_x_emas == false
  58. show_slope_17 = show_daily == false and hide_normal == false and show_slope == true and show_gdx == true and show_x_emas == false
  59. show_slope_0 = show_slope_1 or show_slope_2 or show_slope_3 or show_slope_4 or show_slope_5 or show_slope_6 or show_slope_7 or show_slope_8 or show_slope_9 or show_slope_10 or show_slope_11 or show_slope_12 or show_slope_13 or show_slope_14 or show_slope_15 or show_slope_16 or show_slope_17
  60.  
  61. show_x_emas_1 = show_labels == false and show_daily == false and hide_normal == false and show_slope == false and show_gdx == false and show_x_emas == true
  62. show_x_emas_2 = show_labels == true and show_daily == false and hide_normal == false and show_slope == false and show_gdx == false and show_x_emas == true
  63. show_x_emas_3 = show_daily == false and hide_normal == false and show_slope == false and show_gdx == false and show_x_emas == true
  64. show_x_emas_4 = show_daily == false and hide_normal == false and show_slope == false and show_gdx == true and show_x_emas == true
  65. show_x_emas_5 = show_daily == false and hide_normal == false and show_slope == true and show_gdx == true and show_x_emas == true
  66. show_x_emas_0 = show_x_emas_1 or show_x_emas_2 or show_x_emas_3 or show_x_emas_4 or show_x_emas_5
  67.  
  68. sma10 = sma(close, 10)
  69. plot(hide_normal == false and show_slope == false and show_x_emas == false ? sma10:na, color=red, transp=0, linewidth=1, title='10')
  70. ema21 = ema(close, 21)
  71. plot(hide_normal == false and show_slope == false and show_x_emas == false ? ema21:na, color=yellow, transp=0, linewidth=2, title='21')
  72. ema50 = ema(close, 50)
  73. plot(hide_normal_0 ? ema50:na, color=lime, transp=0, linewidth=2, title='50')
  74. ema89 = ema(close, 89)
  75. plot(hide_normal == false and show_slope == false and show_x_emas == false ? ema89:na, color=white, transp=0, linewidth=2, title='89')
  76. ema100 = ema(close, 100)
  77. plot(hide_normal == false and show_slope == false and show_x_emas == false ? ema100:na, color=aqua, transp=0, linewidth=2, title='100')
  78. ema144 = ema(close, 144)
  79. plot(hide_normal == false and show_slope == false and show_x_emas == false ? ema144:na, color=#1976d2, transp=0, linewidth=2, title='144')
  80. ema200 = ema(close, 200)
  81. plot(hide_normal_0 ? ema200:na, color=fuchsia, transp=0, linewidth=2, title='200')
  82. sma200 = sma(close, 200)
  83. plot(hide_normal == false and show_slope == false and show_x_emas == false ? sma200:na, color=red, transp=0, linewidth=2, title='200')
  84. ema377 = ema(close, 377)
  85. plot(hide_normal == false and show_slope == false and show_x_emas == false ? ema377:na, color=maroon, transp=0, linewidth=2, title='377')
  86. ema886 = ema(close, 886)
  87. plot(hide_normal == false and show_slope == false and show_x_emas == false ? ema886:na, color=white, transp=0, linewidth=2, title='886')
  88.  
  89. sma10_m = security(tickerid, 'M', sma10)
  90. ema21_w = security(tickerid, 'W', ema21)
  91. ema21_m = security(tickerid, 'M', ema21)
  92. ema50_w = security(tickerid, 'W', ema50)
  93. ema89_w = security(tickerid, 'W', ema89)
  94. sma200_w = security(tickerid, 'W', sma200)
  95.  
  96. daily_only = not isweekly and not ismonthly
  97.  
  98. plot(daily_only ? sma10_m:na, style=line, linewidth=2, show_last=1, color=red, transp=0, title='10 M')
  99. plot(daily_only ? ema21_w:na, style=line, linewidth=2, show_last=1, color=yellow, transp=0, title='21 W')
  100. plot(daily_only ? ema21_m:na, style=line, linewidth=2, show_last=1, color=yellow, transp=0, title='21 M')
  101. plot(daily_only ? ema50_w:na, style=line, linewidth=2, show_last=1, color=lime, transp=0, title='50 W')
  102. plot(daily_only ? ema89_w:na, style=line, linewidth=2, show_last=1, color=white, transp=0, title='89 W')
  103. plot(daily_only ? sma200_w:na, style=line, linewidth=2, show_last=1, color=red, transp=0, title='200 W')
  104.  
  105. plotshape(show_labels == true and hide_normal == false and show_slope == false and show_x_emas == false ? sma10:na, style=shape.diamond, location=location.absolute, show_last=1, color=red, transp=0, text='10', title='10', offset=4)
  106. plotshape(show_labels == true and hide_normal == false and show_slope == false and show_x_emas == false ? ema21:na, style=shape.diamond, location=location.absolute, show_last=1, color=yellow, transp=0, text='21', title='21', offset=4)
  107. plotshape(show_labels == true and hide_normal_0 ? ema50:na, style=shape.diamond, location=location.absolute, show_last=1, color=lime, transp=0, text='50', title='50', offset=4)
  108. plotshape(show_labels == true and hide_normal == false and show_slope == false and show_x_emas == false ? ema89:na, style=shape.diamond, location=location.absolute, show_last=1, color=white, transp=0, text='89', title='89', offset=4)
  109. plotshape(show_labels == true and hide_normal == false and show_slope == false and show_x_emas == false ? ema100:na, style=shape.diamond, location=location.absolute, show_last=1, color=aqua, transp=0, text='100', title='100', offset=4)
  110. plotshape(show_labels == true and hide_normal == false and show_slope == false and show_x_emas == false ? ema144:na, style=shape.diamond, location=location.absolute, show_last=1, color=#1976d2, transp=0, text='144', title='144', offset=4)
  111. plotshape(show_labels == true and hide_normal_0 ? ema200:na, style=shape.diamond, location=location.absolute, show_last=1, color=fuchsia, transp=0, text='200', title='200', offset=4)
  112. plotshape(show_labels == true and hide_normal == false and show_slope == false and show_x_emas == false ? sma200:na, style=shape.diamond, location=location.absolute, show_last=1, color=red, transp=0, text='200', title='200', offset=4)
  113. plotshape(show_labels == true and hide_normal == false and show_slope == false and show_x_emas == false ? ema377:na, style=shape.diamond, location=location.absolute, show_last=1, color=maroon, transp=0, text='377', title='377', offset=4)
  114. plotshape(show_labels == true and hide_normal == false and show_slope == false and show_x_emas == false ? ema886:na, style=shape.diamond, location=location.absolute, show_last=1, color=white, transp=0, text='886', title='886', offset=4)
  115.  
  116. sma10_1d = security(tickerid, 'D', sma10)
  117. plot(show_daily_0 or show_x_emas_0 ? sma10_1d:na, color=red, transp=0, linewidth=1, title='10 D')
  118. ema21_1d = security(tickerid, 'D', ema21)
  119. plot(show_daily_0 or show_x_emas_0 ? ema21_1d:na, color=yellow, transp=0, linewidth=2, title='21 D')
  120. sma30 = sma(close, 30)
  121. sma30_1d = security(tickerid, 'D', sma30)
  122. plot(show_slope_0 ? sma30_1d:na, color=blue, transp=0, linewidth=3, title='30 D')
  123. ema50_1d = security(tickerid, 'D', ema50)
  124. plot(show_daily == true and show_slope == false and show_x_emas == false ? ema50_1d:na, color=lime, transp=0, linewidth=2, title='50 D')
  125. ema89_1d = security(tickerid, 'D', ema89)
  126. plot(show_daily == true and show_slope == false and show_x_emas == false ? ema89_1d:na, color=white, transp=0, linewidth=2, title='89 D')
  127. ema100_1d = security(tickerid, 'D', ema100)
  128. plot(show_daily == true and show_slope == false and show_x_emas == false ? ema100_1d:na, color=aqua, transp=0, linewidth=2, title='100 D')
  129. ema144_1d = security(tickerid, 'D', ema144)
  130. plot(show_daily == true and show_slope == false and show_x_emas == false ? ema144_1d:na, color=#1976d2, transp=0, linewidth=2, title='144 D')
  131. ema200_1d = security(tickerid, 'D', ema200)
  132. plot(show_daily == true and show_slope == false and show_x_emas == false ? ema200_1d:na, color=fuchsia, transp=0, linewidth=2, title='200 D')
  133. sma200_1d = security(tickerid, 'D', sma200)
  134. plot(show_daily == true and show_slope == false and show_x_emas == false ? sma200_1d:na, color=red, transp=0, linewidth=2, title='200 D')
  135. ema377_1d = security(tickerid, 'D', ema377)
  136. plot(show_daily == true and show_slope == false and show_x_emas == false ? ema377_1d:na, color=maroon, transp=0, linewidth=2, title='377 D')
  137. ema886_1d = security(tickerid, 'D', ema886)
  138. plot(show_daily == true and show_slope == false and show_x_emas == false ? ema886_1d:na, color=white, transp=0, linewidth=2, title='886 D')
  139.  
  140. plotshape(show_labels == true and show_daily_0 or show_labels == true and show_x_emas_0 ? sma10_1d:na, style=shape.diamond, location=location.absolute, show_last=1, color=red, transp=0, text='10 D', title='10 D', offset=8)
  141. plotshape(show_labels == true and show_daily_0 or show_labels == true and show_x_emas_0 ? ema21_1d:na, style=shape.diamond, location=location.absolute, show_last=1, color=yellow, transp=0, text='21 D', title='21 D', offset=8)
  142. plotshape(show_labels == true and show_slope_0 ? sma30_1d:na, style=shape.diamond, location=location.absolute, show_last=1, color=blue, transp=0, text='30 D', title='30 D', offset=8)
  143. plotshape(show_labels == true and show_daily == true and show_slope == false and show_x_emas == false ? ema50_1d:na, style=shape.diamond, location=location.absolute, show_last=1, color=lime, transp=0, text='50 D', title='50 D', offset=8)
  144. plotshape(show_labels == true and show_daily == true and show_slope == false and show_x_emas == false ? ema89_1d:na, style=shape.diamond, location=location.absolute, show_last=1, color=white, transp=0, text='89 D', title='89 D', offset=8)
  145. plotshape(show_labels == true and show_daily == true and show_slope == false and show_x_emas == false ? ema100_1d:na, style=shape.diamond, location=location.absolute, show_last=1, color=aqua, transp=0, text='100 D', title='100 D', offset=8)
  146. plotshape(show_labels == true and show_daily == true and show_slope == false and show_x_emas == false ? ema144_1d:na, style=shape.diamond, location=location.absolute, show_last=1, color=#1976d2, transp=0, text='144 D', title='144 D', offset=8)
  147. plotshape(show_labels == true and show_daily == true and show_slope == false and show_x_emas == false ? ema200_1d:na, style=shape.diamond, location=location.absolute, show_last=1, color=fuchsia, transp=0, text='200 D', title='200 D', offset=8)
  148. plotshape(show_labels == true and show_daily == true and show_slope == false and show_x_emas == false ? sma200_1d:na, style=shape.diamond, location=location.absolute, show_last=1, color=red, transp=0, text='200 D', title='200 D', offset=8)
  149. plotshape(show_labels == true and show_daily == true and show_slope == false and show_x_emas == false ? ema377_1d:na, style=shape.diamond, location=location.absolute, show_last=1, color=maroon, transp=0, text='377 D', title='377 D', offset=8)
  150. plotshape(show_labels == true and show_daily == true and show_slope == false and show_x_emas == false ? ema886_1d:na, style=shape.diamond, location=location.absolute, show_last=1, color=white, transp=0, text='886 D', title='886 D', offset=8)
  151.  
  152. plotshape(daily_only ? sma10_m:na, style=shape.diamond, location=location.absolute, show_last=1, color=red, transp=0, text='10 M', title='10 M', offset=8)
  153. plotshape(daily_only ? ema21_w:na, style=shape.diamond, location=location.absolute, show_last=1, color=yellow, transp=0, text='21 W', title='21 W', offset=8)
  154. plotshape(daily_only ? ema21_m:na, style=shape.diamond, location=location.absolute, show_last=1, color=yellow, transp=0, text='21 M', title='21 M', offset=8)
  155. plotshape(daily_only ? ema50_w:na, style=shape.diamond, location=location.absolute, show_last=1, color=lime, transp=0, text='50 W', title='50 W', offset=8)
  156. plotshape(daily_only ? ema89_w:na, style=shape.diamond, location=location.absolute, show_last=1, color=white, transp=0, text='89 W', title='89 W', offset=8)
  157. plotshape(daily_only ? sma200_w:na, style=shape.diamond, location=location.absolute, show_last=1, color=red, transp=0, text='200 W', title='200 W', offset=8)
  158.  
  159. ema50_3h = security(tickerid, '180', ema50)
  160. ema200_3h = security(tickerid, '180', ema200)
  161. ema50_4h = security(tickerid, '240', ema50)
  162. ema200_4h = security(tickerid, '240', ema200)
  163.  
  164. goldenx_3h = crossover(ema50_3h, ema200_3h) and daily_only
  165. alertcondition(goldenx_3h, title='3H GOLDEN X', message='3H GOLDEN X')
  166. plotshape(show_gdx == true ? goldenx_3h:na, style=shape.xcross, location=location.belowbar, color=yellow, transp=0, text='3H G', title='3H GOLDEN X', show_last=50, size=size.small)
  167. deathx_3h = crossunder(ema50_3h, ema200_3h) and daily_only
  168. alertcondition(deathx_3h, title='3H DEATH X', message='3H DEATH X')
  169. plotshape(show_gdx == true ? deathx_3h:na, style=shape.xcross, location=location.abovebar, color=red, transp=0, text='3H D', title='3H DEATH X', show_last=50, size=size.small)
  170.  
  171. goldenx_4h = crossover(ema50_4h, ema200_4h) and daily_only
  172. alertcondition(goldenx_4h, title='4H GOLDEN X', message='4H GOLDEN X')
  173. plotshape(show_gdx == true ? goldenx_4h:na, style=shape.xcross, location=location.belowbar, color=yellow, transp=0, text='4H G', title='4H GOLDEN X', show_last=50, size=size.small)
  174. deathx_4h = crossunder(ema50_4h, ema200_4h) and daily_only
  175. alertcondition(deathx_4h, title='4H DEATH X', message='4H DEATH X')
  176. plotshape(show_gdx == true ? deathx_4h:na, style=shape.xcross, location=location.abovebar, color=red, transp=0, text='4H D', title='4H DEATH X', show_last=50, size=size.small)
  177.  
  178. goldenx_1d = crossover(ema50_1d, ema200_1d) and daily_only
  179. alertcondition(goldenx_1d, title='1D GOLDEN X', message='1D GOLDEN X')
  180. plotshape(show_gdx == true ? goldenx_1d:na, style=shape.xcross, location=location.belowbar, color=yellow, transp=0, text='1D GOLDEN', title='1D GOLDEN X', show_last=100, size=size.huge)
  181. deathx_1d = crossunder(ema50_1d, ema200_1d) and daily_only
  182. alertcondition(deathx_1d, title='1D DEATH X', message='1D DEATH X')
  183. plotshape(show_gdx == true ? deathx_1d:na, style=shape.xcross, location=location.abovebar, color=red, transp=0, text='1D DEATH', title='1D DEATH X', show_last=100, size=size.huge)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement