OPEN-SOURCE SCRIPT
Mr.Quyet hành trình triệu $$$

//version=5
indicator("RSI + MACD Combo", shorttitle="RSI_MACD", overlay=false)
// —— INPUTS ——
// RSI
rsiSrc = input.source(close, "RSI Source")
rsiLen = input.int(14, "RSI Length")
rsiOB = input.int(70, "RSI Overbought")
rsiOS = input.int(30, "RSI Oversold")
// MACD
macdSrc = input.source(close, "MACD Source")
fastLen = input.int(12, "MACD Fast Length")
slowLen = input.int(26, "MACD Slow Length")
signalLen = input.int(9, "MACD Signal Length")
// —— CALCULATIONS ——
// RSI
rsiValue = ta.rsi(rsiSrc, rsiLen)
// MACD
[macdLine, signalLine, histLine] = ta.macd(macdSrc, fastLen, slowLen, signalLen)
// —— PLOTTING ——
// RSI
p_rsi = plot(rsiValue, title="RSI", linewidth=2,
color = rsiValue > rsiOB ? color.red :
rsiValue < rsiOS ? color.green :
color.blue)
hline(rsiOB, "Overbought", color=color.red, linestyle=hline.style_dashed)
hline(rsiOS, "Oversold", color=color.green, linestyle=hline.style_dashed)
hline(50, "Middle", color=color.gray)
// MACD
plot(macdLine, title="MACD Line", color=color.blue, linewidth=1)
plot(signalLine,title="Signal Line", color=color.orange, linewidth=1)
plot(histLine, title="Histogram", style=plot.style_columns,
color = histLine >= 0 ? color.green : color.red)
// —— ALERT CONDITIONS ——
// Cảnh báo khi RSI chạm vùng quá mua/quá bán
alertcondition(cross(rsiValue, rsiOB), title="RSI Overbought", message="RSI đã vượt lên trên {{rsiOB}}")
alertcondition(cross(rsiValue, rsiOS), title="RSI Oversold", message="RSI đã xuống dưới {{rsiOS}}")
// Cảnh báo khi MACD line cắt Signal line
alertcondition(cross(macdLine, signalLine), title="MACD Cross", message="MACD Line vừa cắt Signal Line")
// —— SHOW VALUES ——
// Cho phép xem giá trị khi hover
plotshape(series=na, title="RSI value", text=str.tostring(rsiValue, format.percent), textcolor=color.white, location=location.top, style=shape.labelup, size=size.tiny)
indicator("RSI + MACD Combo", shorttitle="RSI_MACD", overlay=false)
// —— INPUTS ——
// RSI
rsiSrc = input.source(close, "RSI Source")
rsiLen = input.int(14, "RSI Length")
rsiOB = input.int(70, "RSI Overbought")
rsiOS = input.int(30, "RSI Oversold")
// MACD
macdSrc = input.source(close, "MACD Source")
fastLen = input.int(12, "MACD Fast Length")
slowLen = input.int(26, "MACD Slow Length")
signalLen = input.int(9, "MACD Signal Length")
// —— CALCULATIONS ——
// RSI
rsiValue = ta.rsi(rsiSrc, rsiLen)
// MACD
[macdLine, signalLine, histLine] = ta.macd(macdSrc, fastLen, slowLen, signalLen)
// —— PLOTTING ——
// RSI
p_rsi = plot(rsiValue, title="RSI", linewidth=2,
color = rsiValue > rsiOB ? color.red :
rsiValue < rsiOS ? color.green :
color.blue)
hline(rsiOB, "Overbought", color=color.red, linestyle=hline.style_dashed)
hline(rsiOS, "Oversold", color=color.green, linestyle=hline.style_dashed)
hline(50, "Middle", color=color.gray)
// MACD
plot(macdLine, title="MACD Line", color=color.blue, linewidth=1)
plot(signalLine,title="Signal Line", color=color.orange, linewidth=1)
plot(histLine, title="Histogram", style=plot.style_columns,
color = histLine >= 0 ? color.green : color.red)
// —— ALERT CONDITIONS ——
// Cảnh báo khi RSI chạm vùng quá mua/quá bán
alertcondition(cross(rsiValue, rsiOB), title="RSI Overbought", message="RSI đã vượt lên trên {{rsiOB}}")
alertcondition(cross(rsiValue, rsiOS), title="RSI Oversold", message="RSI đã xuống dưới {{rsiOS}}")
// Cảnh báo khi MACD line cắt Signal line
alertcondition(cross(macdLine, signalLine), title="MACD Cross", message="MACD Line vừa cắt Signal Line")
// —— SHOW VALUES ——
// Cho phép xem giá trị khi hover
plotshape(series=na, title="RSI value", text=str.tostring(rsiValue, format.percent), textcolor=color.white, location=location.top, style=shape.labelup, size=size.tiny)
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.