OPEN-SOURCE SCRIPT
4H Crypto System – EMAs + MACD

//version=5
indicator("4H Crypto System – EMAs + MACD", overlay=true)
// EMAs
ema21 = ta.ema(close, 21)
ema50 = ta.ema(close, 50)
ema200 = ta.ema(close, 200)
// MACD Settings (standard)
fastLength = 12
slowLength = 26
signalLength = 9
[macdLine, signalLine, _] = ta.macd(close, fastLength, slowLength, signalLength)
// Plot EMAs
plot(ema21, title="EMA 21", color=color.orange, linewidth=1)
plot(ema50, title="EMA 50", color=color.blue, linewidth=1)
plot(ema200, title="EMA 200", color=color.purple, linewidth=1)
// Candle coloring based on MACD trend
macdBull = macdLine > signalLine
barcolor(macdBull ? color.new(color.green, 0) : color.new(color.red, 0))
// Buy/Sell signal conditions
buySignal = ta.crossover(macdLine, signalLine) and close > ema21 and close > ema50 and close > ema200
sellSignal = ta.crossunder(macdLine, signalLine) and close < ema21 and close < ema50 and close < ema200
// Alerts
alertcondition(buySignal, title="Buy Alert", message="Buy Signal: MACD bullish crossover and price above EMAs")
alertcondition(sellSignal, title="Sell Alert", message="Sell Signal: MACD bearish crossover and price below EMAs")
indicator("4H Crypto System – EMAs + MACD", overlay=true)
// EMAs
ema21 = ta.ema(close, 21)
ema50 = ta.ema(close, 50)
ema200 = ta.ema(close, 200)
// MACD Settings (standard)
fastLength = 12
slowLength = 26
signalLength = 9
[macdLine, signalLine, _] = ta.macd(close, fastLength, slowLength, signalLength)
// Plot EMAs
plot(ema21, title="EMA 21", color=color.orange, linewidth=1)
plot(ema50, title="EMA 50", color=color.blue, linewidth=1)
plot(ema200, title="EMA 200", color=color.purple, linewidth=1)
// Candle coloring based on MACD trend
macdBull = macdLine > signalLine
barcolor(macdBull ? color.new(color.green, 0) : color.new(color.red, 0))
// Buy/Sell signal conditions
buySignal = ta.crossover(macdLine, signalLine) and close > ema21 and close > ema50 and close > ema200
sellSignal = ta.crossunder(macdLine, signalLine) and close < ema21 and close < ema50 and close < ema200
// Alerts
alertcondition(buySignal, title="Buy Alert", message="Buy Signal: MACD bullish crossover and price above EMAs")
alertcondition(sellSignal, title="Sell Alert", message="Sell Signal: MACD bearish crossover and price below EMAs")
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。