OPEN-SOURCE SCRIPT
Multi-Reversal + MA50/200 + MACD + BJ (Tilson) Combo

//version=5
indicator(title="Multi-Reversal + MA50/200 + MACD + BJ (Tilson) Combo", overlay=true)
// --- Moving Averages (MA50, MA200) ---
ma_50 = ta.sma(close, 50)
ma_200 = ta.sma(close, 200)
plot(ma_50, color=color.blue, linewidth=1, title="MA50")
plot(ma_200, color=color.red, linewidth=2, title="MA200")
// --- MACD ---
fast_length = input(12, title="MACD Fast")
slow_length = input(26, title="MACD Slow")
signal_length = input(9, title="MACD Signal")
[macdLine, signalLine, _] = ta.macd(close, fast_length, slow_length, signal_length)
macd_cross_up = ta.crossover(macdLine, signalLine)
macd_cross_down = ta.crossunder(macdLine, signalLine)
// --- Tilson MA (BJ reversal) ---
tilson_length = input(20, title="Tilson MA Length (BJ reversal)")
tilson_ma = ta.ema(ta.ema(close, tilson_length), tilson_length)
bj_cross_up = close > tilson_ma and close[1] < tilson_ma[1]
bj_cross_down = close < tilson_ma and close[1] > tilson_ma[1]
plot(tilson_ma, color=color.orange, linewidth=2, title="Tilson MA (BJ reversal)")
// --- Đảo chiều tổng hợp ---
bull_reversal = macd_cross_up and bj_cross_up and close > ma_50 and close > ma_200
bear_reversal = macd_cross_down and bj_cross_down and close < ma_50 and close < ma_200
// --- Plot tín hiệu trên chart ---
plotshape(bull_reversal, location=location.belowbar, style=shape.triangleup, size=size.large, color=color.lime, title="Bullish Reversal", text="STRONG UP")
plotshape(bear_reversal, location=location.abovebar, style=shape.triangledown, size=size.large, color=color.red, title="Bearish Reversal", text="STRONG DN")
// --- BJ riêng lẻ ---
plotshape(bj_cross_up, location=location.belowbar, color=color.yellow, style=shape.circle, size=size.tiny, title="BJ Up Only")
plotshape(bj_cross_down, location=location.abovebar, color=color.yellow, style=shape.circle, size=size.tiny, title="BJ Down Only")
// --- Alert conditions ---
alertcondition(bull_reversal, title="Bullish Strong Reversal", message="Buy opportunity: MA bullish + MACD + BJ reversal!")
alertcondition(bear_reversal, title="Bearish Strong Reversal", message="Sell warning: MA bearish + MACD + BJ reversal!")
indicator(title="Multi-Reversal + MA50/200 + MACD + BJ (Tilson) Combo", overlay=true)
// --- Moving Averages (MA50, MA200) ---
ma_50 = ta.sma(close, 50)
ma_200 = ta.sma(close, 200)
plot(ma_50, color=color.blue, linewidth=1, title="MA50")
plot(ma_200, color=color.red, linewidth=2, title="MA200")
// --- MACD ---
fast_length = input(12, title="MACD Fast")
slow_length = input(26, title="MACD Slow")
signal_length = input(9, title="MACD Signal")
[macdLine, signalLine, _] = ta.macd(close, fast_length, slow_length, signal_length)
macd_cross_up = ta.crossover(macdLine, signalLine)
macd_cross_down = ta.crossunder(macdLine, signalLine)
// --- Tilson MA (BJ reversal) ---
tilson_length = input(20, title="Tilson MA Length (BJ reversal)")
tilson_ma = ta.ema(ta.ema(close, tilson_length), tilson_length)
bj_cross_up = close > tilson_ma and close[1] < tilson_ma[1]
bj_cross_down = close < tilson_ma and close[1] > tilson_ma[1]
plot(tilson_ma, color=color.orange, linewidth=2, title="Tilson MA (BJ reversal)")
// --- Đảo chiều tổng hợp ---
bull_reversal = macd_cross_up and bj_cross_up and close > ma_50 and close > ma_200
bear_reversal = macd_cross_down and bj_cross_down and close < ma_50 and close < ma_200
// --- Plot tín hiệu trên chart ---
plotshape(bull_reversal, location=location.belowbar, style=shape.triangleup, size=size.large, color=color.lime, title="Bullish Reversal", text="STRONG UP")
plotshape(bear_reversal, location=location.abovebar, style=shape.triangledown, size=size.large, color=color.red, title="Bearish Reversal", text="STRONG DN")
// --- BJ riêng lẻ ---
plotshape(bj_cross_up, location=location.belowbar, color=color.yellow, style=shape.circle, size=size.tiny, title="BJ Up Only")
plotshape(bj_cross_down, location=location.abovebar, color=color.yellow, style=shape.circle, size=size.tiny, title="BJ Down Only")
// --- Alert conditions ---
alertcondition(bull_reversal, title="Bullish Strong Reversal", message="Buy opportunity: MA bullish + MACD + BJ reversal!")
alertcondition(bear_reversal, title="Bearish Strong Reversal", message="Sell warning: MA bearish + MACD + BJ reversal!")
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。