Advertisement
Guest User

msms

a guest
Feb 1st, 2015
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. study(title="MACROSS STOCH MACD SIGNAL", shorttitle="MSMS")
  2. // ||--- Check for Cross of price with ema1
  3. ema1 = ema(close, input(13))
  4. ema1condition = cross(ema1, close)
  5. // ||--- Check ema2 for filtering
  6. // ||--- Check if candle is up or down (green/red)
  7. candlecondition = close >= open ? +1 : -1
  8.  
  9. ema2 = ema(close, input(34))
  10. ema2condition = candlecondition == -1 and ema2 > close ? -1 :
  11. candlecondition == +1 and ema2 < close ? +1 : na
  12. // ||--- Check for Stoch signal
  13. stoch1 = stoch(close, high, low, input(5))
  14. stoch1condition = stoch1[1] >= 60 ? -1 : stoch1[1] <= 40 ? +1 : 0
  15. // ||--- Check for macd signal
  16. [macd1, _, _] = macd(close, input(5, title="macd fast"), input(13, title="macd slow"), input(1, title="macd signal"))
  17. macdcondition = macd1 > 0 ? +1 : macd1 < 0 ? -1 : 0
  18.  
  19. signal = ema1condition and ema2condition == -1 and stoch1condition == -1 and macdcondition == -1 ? -1 :
  20. ema1condition and ema2condition == +1 and stoch1condition == +1 and macdcondition == +1 ? +1 : 0
  21.  
  22. signalcolor = signal == +1 ? green : signal == -1 ? maroon : gray
  23.  
  24. plot(signal, style=histogram, color=signalcolor, linewidth=3)
  25. hline(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement