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!")
Script de código aberto
No verdadeiro espirito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam entendê-lo e verificá-lo. Parabéns ao autor Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações e regida pelas Regras da Casa.
Aviso legal
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.
Script de código aberto
No verdadeiro espirito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam entendê-lo e verificá-lo. Parabéns ao autor Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações e regida pelas Regras da Casa.
Aviso legal
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.