Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. // © TheProfessorDev
  2. //@version=4
  3. study(title="Black Dog System v1.0 by Prof. D", overlay=true)
  4.  
  5. //EMA 1
  6.  
  7. emaplot = input (true, title="Show EMA on chart")
  8. len = input(15, minval=1, title="EMA Length")
  9. src = close
  10. out = ema(src, len)
  11. up = out > out[1]
  12. down = out < out[1]
  13. mycolor = up ? color.green : down ? color.red : color.blue
  14. plot(out and emaplot ? out :na, title="EMA", color=mycolor, linewidth=4)
  15.  
  16. //EMA 2
  17.  
  18. emaplot2 = input (true, title="Show EMA on chart")
  19. len2 = input(50, minval=1, title="EMA High Length")
  20. src2 = high
  21. out2 = ema(src2, len2)
  22. up2 = out2 > out2[1]
  23. down2 = out2 < out2[1]
  24. mycolor2 = up2 ? color.white : down2 ? color.yellow : color.blue
  25. plot(out2 and emaplot ? out2 :na, title="EMA", color=mycolor2, linewidth=2)
  26.  
  27. //EMA 3
  28.  
  29. emaplot3 = input (true, title="Show EMA on chart")
  30. len3 = input(50, minval=1, title="EMA Low Length")
  31. src3 = low
  32. out3 = ema(src3, len3)
  33. up3 = out3 > out3[1]
  34. down3 = out3 < out3[1]
  35. mycolor3 = up3 ? color.white : down3 ? color.yellow : color.blue
  36. plot(out3 and emaplot3 ? out3 :na, title="EMA", color=mycolor3, linewidth=2)
  37.  
  38. // MACD 1
  39.  
  40. fastLength = input(10)
  41. slowlength = input(20)
  42. MACDLength = input(7)
  43.  
  44. MACD = ema(close, fastLength) - ema(close, slowlength)
  45. aMACD = ema(MACD, MACDLength)
  46. delta = MACD - aMACD
  47.  
  48. // Entry Exit
  49.  
  50. trendup = crossover(ema(close,2),ema(close,15)) and close>ema(low,50) and (delta>0)
  51. trenddown = crossunder(ema(close,2),ema(close,15)) and close<ema(high,50) and (delta<0)
  52.  
  53. // Plotting
  54.  
  55. plotshape(trendup, title="LONG", text="BUY", textcolor=color.white, style=shape.labelup, location=location.belowbar, color=color.green, transp=0, size=size.tiny)
  56. plotshape(trenddown, title="SHORT", text="SELL", textcolor=color.white, style=shape.labeldown, location=location.abovebar, color=color.red, transp=0, size=size.tiny)
  57.  
  58. // Alerts
  59.  
  60. alertcondition(trendup, title="LONG", message="LONG")
  61. alertcondition(trenddown, title="SHORT", message="SHORT")