Advertisement
JustUncleL

Price Action HiLo Channel Alert R1

Jan 14th, 2017
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. //@version=2
  2. //
  3. study(title="Price Action HiLo Channel Alert R1 by JustUncleL",overlay = true, shorttitle="PACALERT R1")
  4. //
  5. //Created By: JustUncleL on 3 Jan 2017
  6. //Version: R1
  7. //
  8. //Description:
  9. // This is an implementation of a Price Action Channel HiLo Alert indicator.
  10. //
  11. //Notes:
  12. //
  13. //Modifications:
  14. //
  15. // reference:
  16. //
  17. ShowPAC = input(false)
  18. lenLo = input(10, minval=2, title="Low Channel Length")
  19. lenHi = input(10, minval=2, title="High Channel Length")
  20. lenMe = input(10, minval=1, title="Median Channel Length")
  21. bars_on = input(false,title="Color Code Bars")
  22. //
  23. ShowEMA = input(false)
  24. filterE = input(false,title="Use Directional Filter")
  25. dLength = input(200,minval=2,title="Directional EMA length")
  26. dCandles= input(3,minval=2,title="Direction test Candles")
  27. //
  28. DodgerBlue = #1E90FF
  29. //
  30. // --- SOURCES ---
  31. close_ = security(ticker, period, close)
  32. open_ = security(ticker, period, open)
  33. high_ = security(ticker, period, high)
  34. low_ = security(ticker, period, low)
  35. hl2_ = security(ticker, period, hl2)
  36. //
  37. emaD = ema(close_,dLength)
  38. plot(ShowEMA?emaD:na,color=blue,transp=0,title="Slow EMA trend line", linewidth=2)
  39.  
  40. // Calculate and draw the Price Action channel
  41. pacLo = ema(low_,lenLo)
  42. pacHi = ema(high_,lenHi)
  43. pacMe = ema(close_,lenMe)
  44. plot(ShowPAC?pacLo:na,title="Low Price Line",style=line,color=gray,transp=0,linewidth=2)
  45. plot(ShowPAC?pacHi:na,title="High Price Line",style=line,color=gray,transp=0,linewidth=2)
  46. plot(ShowPAC?pacMe:na,title="Median Price Line",style=line,color=orange,transp=0,linewidth=2)
  47.  
  48. // Calculate CCI indicating continuance of trend.
  49. isup = close>open and close>pacHi and close[1]<pacHi[1]
  50. isdown = close<open and close<pacLo and close[1]>pacLo[1]
  51. barcolor(bars_on ? isup ? aqua : isdown ? black : na : na )
  52.  
  53. // Check have alert and use MACD filter
  54. up_alert = isup and (not filterE or (pacMe>emaD and rising(emaD,dCandles))) ? na(up_alert[1]) ? 1 : up_alert[1]+1 : 0
  55. dn_alert = isdown and (not filterE or (pacMe<emaD and falling(emaD,dCandles))) ? na(dn_alert[1]) ? 1 : dn_alert[1]+1 : 0
  56. //
  57. plotarrow(up_alert==1? 0.1 : dn_alert==1? -0.1 : na, colorup=aqua, colordown=black, transp=20,minheight=10,maxheight=100, title="PAC Alert Arrows")
  58.  
  59. // generate an alert if required.
  60. alertcondition(up_alert==1 or dn_alert==1, title="PACALERT", message="PACALERT")
  61.  
  62. //EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement