OPEN-SOURCE SCRIPT

Phân tích Đa Khung Thời gian

56


//version=5
indicator("Phân tích Đa Khung Thời gian", shorttitle="Manual Analysis", overlay=true)

// ============== INPUTS CHO BẢNG PHÂN TÍCH XU HƯỚNG ==============
monthlyTrend = input.string("Bullish", title="Xu hướng Monthly", options=["Bullish", "Bearish"])
weeklyTrend = input.string("Bullish", title="Xu hướng Weekly", options=["Bullish", "Bearish"])
dailyTrend = input.string("Bullish", title="Xu hướng Daily", options=["Bullish", "Bearish"])
h4Trend = input.string("Bullish", title="Xu hướng H4", options=["Bullish", "Bearish"])
h1Trend = input.string("Bullish", title="Xu hướng H1", options=["Bullish", "Bearish"])
m30Trend = input.string("Bullish", title="Xu hướng M30", options=["Bullish", "Bearish"])
m15Trend = input.string("Bullish", title="Xu hướng M15", options=["Bullish", "Bearish"])
m5Trend = input.string("Bullish", title="Xu hướng M5", options=["Bullish", "Bearish"])
m1Trend = input.string("Bullish", title="Xu hướng M1", options=["Bullish", "Bearish"])

// Mảng chứa nhãn và xu hướng
labels = array.from("Mn", "W", "D", "H4", "H1", "M30", "M15", "M5", "M1")
trends = array.from(monthlyTrend, weeklyTrend, dailyTrend, h4Trend, h1Trend, m30Trend, m15Trend, m5Trend, m1Trend)

// ============== TẠO VÀ CẬP NHẬT BẢNG DUY NHẤT ==============
// Sắp xếp bảng nằm ngang
var table manual_analysis_table = table.new(position.top_right, array.size(labels), 2, bgcolor=color.new(color.black, 80), border_width=1)

if barstate.islast
// TIÊU ĐỀ HÀNG ĐẦU TIÊN (Nhãn khung thời gian)
for i = 0 to array.size(labels) - 1
table.cell(manual_analysis_table, i, 0, array.get(labels, i), text_color=color.white, bgcolor=color.new(color.blue, 50), text_size=size.small)

// ĐỔ DỮ LIỆU XU HƯỚNG VÀO HÀNG THỨ HAI
for i = 0 to array.size(trends) - 1
trendStatus = array.get(trends, i)
trendColor = trendStatus == "Bullish" ? color.green : color.red
trendSymbol = trendStatus == "Bullish" ? "▲" : "▼"

table.cell(manual_analysis_table, i, 1, trendSymbol, text_color=trendColor)

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.