Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.37 KB | None | 0 0
  1. //@version=3
  2. //by MedicWillCrypto filters added and label changed picture2
  3. //This study is an custom implimentation of scripts written from Gaussian Channel and Wave Trend.
  4. //Code was customized and made to fit the Medic's Pulse Indicator.
  5. //Should be used with MPI-Pulse, MPI-RS amd MPI-Vix.
  6.  
  7. study("MPI - Medic's Pulse Indicator v6.9 Filter v3", overlay=true)
  8.  
  9. isLongOpen = false
  10. isShortOpen = false
  11.  
  12. //Order open on previous ticker?
  13. isLongOpen := nz(isLongOpen[1])
  14. isShortOpen := nz(isShortOpen[1])
  15.  
  16. fast_length = 8
  17. slow_length = 21
  18. src = close
  19. signal_length = 9
  20. sma_source = false
  21. sma_signal = false
  22.  
  23. // Calculating
  24. fast_ma = sma_source ? sma(src, fast_length) : ema(src, fast_length)
  25. slow_ma = sma_source ? sma(src, slow_length) : ema(src, slow_length)
  26. macd = fast_ma - slow_ma
  27.  
  28. length = 21
  29. mult = 0.7
  30.  
  31. basis = sma(macd, length)
  32. dev = mult * stdev(macd, length)
  33.  
  34. upper = basis + dev
  35. lower = basis - dev
  36. Shortfilter = input(title="Short Filter (static)", type=integer, defval=-10000)
  37. Longfilter = input(title="Long Filter (static)", type=integer, defval=-10000)
  38. BBGap = input(title="Dynamic Filter", type=integer, defval=3000)
  39. EMABreak = input(title="EMA Break", type=integer, defval=21)
  40. EMAB = ema(close, EMABreak)
  41.  
  42. LongSignal = crossover(macd, lower) and basis <= (Longfilter*-1/100) and (upper - lower) > BBGap*1/100 and close > EMAB
  43. ShortSignal = crossunder(macd, upper) and basis >= (Shortfilter*1/100) and (upper - lower) > BBGap*1/100 and close < EMAB
  44. //crossoverLongStrong = crossunder(macd, upper) and basis < -100
  45. //crossoverShortStrong = crossunder(macd, upper) and basis < 100
  46. //crossoverLongADD = crossover(macd, lower)
  47. //crossoverShortADD = crossunder(macd, upper)
  48. //crossoverSecureShort = crossunder(macd,lower) and basis >= (Shortfilter*1/100)
  49. //crossoverSecureLong = crossover(macd,upper) and basis <= (Longfilter*-1/100)
  50. //BasisNegative = crossover(0,basis)
  51. //BasisPositive = crossunder(0,basis)
  52.  
  53. plot(EMAB, linewidth=4, transp=5, color=green, title="EMA Break")
  54. plotshape(LongSignal, title="Long", style=shape.triangleup, location=location.belowbar, text="Long", color=green, transp=0, size=size.small)
  55. plotshape(ShortSignal, title="Short", style=shape.triangledown, location=location.abovebar, text="Short", color=red, transp=0, size=size.small)
  56. //plotshape(BasisNegative, title="Basis Negative", style=shape.xcross, location=location.bottom, text="---Pulse---", color=green, transp=0, size=size.tiny)
  57. //plotshape(BasisPositive, title="Basis Positive", style=shape.xcross, location=location.bottom, text="+++Pulse+++", color=red, transp=0, size=size.tiny)
  58. //plotshape(crossoverSecureShort, title="Secure Short", style=shape.xcross, location=location.belowbar, text="Secure Short", color=red, transp=0, size=size.tiny)
  59. //plotshape(crossoverSecureLong, title="Secure Long", style=shape.xcross, location=location.belowbar, text="Secure Long", color=green, transp=0, size=size.tiny)
  60.  
  61. // Set up alert
  62. //alertcondition(crossover(macd,lower), message="test LONG alert")
  63. //alertcondition(crossunder(macd, upper), message="test SHORT alert")
  64. //alertcondition(crossover(0,basis), message="basis change test")
  65. //alertcondition(crossunder(0,basis), message="basis change test2")
  66.  
  67. // Colour background of alert setups
  68. bgcolor(color=LongSignal ? green :
  69. ShortSignal ? red : na ,
  70. transp=80)
  71.  
  72. ExternalIndicator = input(close, "External Indicator")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement