Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- study(title="MACROSS STOCH MACD SIGNAL", shorttitle="MSMS")
- // ||--- Check for Cross of price with ema1
- ema1 = ema(close, input(13))
- ema1condition = cross(ema1, close)
- // ||--- Check ema2 for filtering
- // ||--- Check if candle is up or down (green/red)
- candlecondition = close >= open ? +1 : -1
- ema2 = ema(close, input(34))
- ema2condition = candlecondition == -1 and ema2 > close ? -1 :
- candlecondition == +1 and ema2 < close ? +1 : na
- // ||--- Check for Stoch signal
- stoch1 = stoch(close, high, low, input(5))
- stoch1condition = stoch1[1] >= 60 ? -1 : stoch1[1] <= 40 ? +1 : 0
- // ||--- Check for macd signal
- [macd1, _, _] = macd(close, input(5, title="macd fast"), input(13, title="macd slow"), input(1, title="macd signal"))
- macdcondition = macd1 > 0 ? +1 : macd1 < 0 ? -1 : 0
- signal = ema1condition and ema2condition == -1 and stoch1condition == -1 and macdcondition == -1 ? -1 :
- ema1condition and ema2condition == +1 and stoch1condition == +1 and macdcondition == +1 ? +1 : 0
- signalcolor = signal == +1 ? green : signal == -1 ? maroon : gray
- plot(signal, style=histogram, color=signalcolor, linewidth=3)
- hline(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement