Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.47 KB | None | 0 0
  1. study(title="Zones AIO", overlay=true)
  2.  
  3. Fib=input(false,title="Fibs")
  4. BB=input(false,title="BB")
  5. candles=input(false)
  6. mode = input("day")
  7. hourfix = input(17, title="hourfix(at what time is 00h correct):", minval=0, maxval=23)
  8.  
  9. openprice = mode == "hour" ? valuewhen(minute == 0, open, 0) :
  10. mode == "day" ?
  11. ( isintraday ? valuewhen(hour == hourfix and minute == 0, open, 0) :
  12. valuewhen(hour == hourfix, open, 0) ) :
  13. mode == "week" ?
  14. ( isintraday ? valuewhen(dayofweek == 1 and hour == hourfix and minute == 0, open, 0) :
  15. valuewhen(dayofweek == 1, open, 0) ) :
  16. mode == "month" ?
  17. ( isintraday ? valuewhen(dayofmonth == 1 and hour == hourfix and minute == 0, open, 0) :
  18. valuewhen(dayofmonth == 1, open, 0) ) :
  19. mode == "year" ?
  20. ( isintraday ? valuewhen(weekofyear == 1 and dayofweek == 1 and hour == hourfix and minute == 0, open, 0) :
  21. isdaily ? valuewhen(weekofyear == 1 and dayofweek == 1, open, 0) :
  22. valuewhen(weekofyear == 1, open, 0) ) : na
  23.  
  24. scolor = openprice != openprice[1] ? na : close >= openprice ? lime : red
  25. plot(openprice, color=scolor, linewidth=2, transp = 0)
  26.  
  27.  
  28.  
  29. highprice =( isintraday ? valuewhen(dayofweek == 1 and hour == hourfix and minute == 0, security(tickerid,"D" ,high), 0) :
  30. valuewhen(dayofweek == 1, security(tickerid,"D" ,high), 0) )
  31. lowprice =( isintraday ? valuewhen(dayofweek == 1 and hour == hourfix and minute == 0, security(tickerid,"D" ,low), 0) :
  32. valuewhen(dayofweek == 1, security(tickerid,"D" ,low), 0) )
  33.  
  34.  
  35. tcolor = highprice != highprice[1] ? na : yellow
  36. plot(highprice, color=tcolor, linewidth=2, transp = 0)
  37. plot(lowprice , color=tcolor, linewidth=2, transp = 0)
  38.  
  39.  
  40. //Fibs
  41. mid=(highprice+lowprice)/2
  42. mid2=(highprice+mid)/2
  43. mid3=(mid+lowprice)/2
  44. plot(Fib?mid:na,color=mid!=mid[1]?na:red)
  45. plot(Fib?mid2:na,color=mid2!=mid2[1]?na:lime)
  46. plot(Fib?mid3:na,color=mid3!=mid3[1]?na:lime)
  47. ///////////////////////////////////////////////////
  48.  
  49. length = input(34, minval=2)
  50. src = input(close, title="Source")
  51. mult = input(2.0, minval=0.001, maxval=50)
  52. basis = sma(src, length)
  53. dev = mult * stdev(src, length)
  54. upper = basis + dev
  55. lower = basis - dev
  56. plot(BB?basis:na, color=aqua)
  57. p1 = plot(BB?upper:na, color=aqua)
  58. p2 = plot(BB?lower:na, color=aqua)
  59. fill(p1, p2)
  60.  
  61.  
  62. //chris moodys days of the week
  63.  
  64. disMon = input(true, title="Highlight Monday?")
  65. disTue = input(true, title="Highlight Tuesday?")
  66. disWed = input(true, title="Highlight Wednesday?")
  67. disThur = input(true, title="Highlight Thursday?")
  68. disFri = input(true, title="Highlight Friday?")
  69.  
  70. isMon() => dayofweek(time('D')) == monday and close ? 1 : 0
  71. isTue() => dayofweek(time('D')) == tuesday and close ? 1 : 0
  72. isWed() => dayofweek(time('D')) == wednesday and close ? 1 : 0
  73. isThu() => dayofweek(time('D')) == thursday and close ? 1 : 0
  74. isFri() => dayofweek(time('D')) == friday and close ? 1 : 0
  75.  
  76. barcolor(candles and disMon and isMon() ? (isMon() ? yellow : na) : na)
  77. barcolor(candles and disTue and isTue() ? (isTue() ? fuchsia : na) : na)
  78. barcolor(candles and disWed and isWed() ? (isWed() ? lime : na) : na)
  79. barcolor(candles and disThur and isThu() ? (isThu() ? aqua : na) : na)
  80. barcolor(candles and disFri and isFri() ? (isFri() ? orange : na) : na)
  81.  
  82. Session0Start = input(4)
  83. Session0End = input(9)
  84. BGColor0 = iff(hour >= Session0Start and hour <= Session0End, purple, na)
  85. bgcolor(BGColor0, 80, 0)
  86.  
  87.  
  88. ema1=ema(close,200)
  89. ema2=ema(close,1200)
  90. //plot(ema1) //you can delete this line, was for backtesting
  91. //plot(ema2) //you can delete this line, was for backtesting
  92. B=close>openprice and crossover(ema1,ema2)
  93. S=close<openprice and crossunder(ema1,ema2)
  94. plotchar(B?ema1:na,title="signal",char="X",location=location.absolute,text="BUY",textcolor=white, transp = 0)
  95. plotchar(S?ema2:na,title="signal",char="X",location=location.absolute,text="SELL",textcolor=white, transp = 0)
  96. alertcondition(B, title='Alert on Buy', message='MA BUY SIGNAL!')
  97. alertcondition(S, title='Alert on Sell', message='MA SELL SIGNAL!')
  98.  
  99.  
  100.  
  101. //EMA 200//
  102. EMA200len= input(200, minval=1, title="Length")
  103. EMA200src= input(close, title="Source")
  104. EMA200=ema(EMA200src, EMA200len)
  105. plot(EMA200,title='EMA200',transp=0,color=#ffffff,style=line,linewidth =5)
  106.  
  107. //EMA 1200//
  108. EMA1200len= input(1200, minval=1, title="Length")
  109. EMA1200src= input(close, title="Source")
  110. EMA1200=ema(EMA1200src, EMA1200len)
  111. plot(EMA1200,title='EMA1200',color=#0066ff,transp=10,style=line,linewidth =3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement