OPEN-SOURCE SCRIPT
Master Forex Dashboard: Sessions, Volume & MTF Trend

//version=5
indicator("Master Forex Dashboard: Sessions, Volume & MTF Trend", overlay=true, max_boxes_count=500)
// ==========================================
// 1. SESSIONS LOGIC
// ==========================================
showAsia = input.bool(true, "Show Asia Session", group="Forex Sessions")
asiaTime = input.session("0000-0900", "Asia Session Time", group="Forex Sessions")
asiaColor = input.color(color.new(color.blue, 90), "Asia Color", group="Forex Sessions")
showLondon = input.bool(true, "Show London Session", group="Forex Sessions")
londonTime = input.session("0800-1700", "London Session Time", group="Forex Sessions")
londonColor= input.color(color.new(color.orange, 90), "London Color", group="Forex Sessions")
showNY = input.bool(true, "Show NY Session", group="Forex Sessions")
nyTime = input.session("1300-2200", "NY Session Time", group="Forex Sessions")
nyColor = input.color(color.new(color.red, 90), "NY Color", group="Forex Sessions")
is_session(sess) => not na(time(timeframe.period, sess, "UTC+0"))
bgcolor(showAsia and is_session(asiaTime) ? asiaColor : na)
bgcolor(showLondon and is_session(londonTime) ? londonColor : na)
bgcolor(showNY and is_session(nyTime) ? nyColor : na)
// ==========================================
// 2. VOLUME LOGIC
// ==========================================
volLen = input.int(20, "Volume MA Length", group="Volume Logic")
highMult = input.float(1.5, "High Vol Multiplier", group="Volume Logic")
lowMult = input.float(0.5, "Low Vol Multiplier", group="Volume Logic")
volMA = ta.sma(volume, volLen)
isHighVol = volume > (volMA * highMult)
isLowVol = volume < (volMA * lowMult)
barcolor(isHighVol ? color.yellow : isLowVol ? color.gray : na)
// ==========================================
// 3. MTF TREND DASHBOARD (FIXED)
// ==========================================
emaLen = input.int(200, "Trend EMA Length", group="Dashboard")
textSize = input.string("small", "Table Text Size", options=["tiny", "small", "normal"], group="Dashboard")
// Function defined at GLOBAL scope to avoid your error
f_fill_row(table_id, row, label, trendVal, tSize) =>
bgColor = trendVal == 1 ? color.new(color.green, 30) : color.new(color.red, 30)
txt = trendVal == 1 ? "BULLISH" : "BEARISH"
table.cell(table_id, 0, row, label, text_color=color.white, text_size=tSize)
table.cell(table_id, 1, row, txt, bgcolor=bgColor, text_color=color.white, text_size=tSize)
get_trend(tf) =>
htfEMA = request.security(syminfo.tickerid, tf, ta.ema(close, emaLen))
htfClose = request.security(syminfo.tickerid, tf, close)
htfClose > htfEMA ? 1 : -1
// Fetch Data
t15 = get_trend("15"), t1h = get_trend("60"), t4h = get_trend("240"), t1d = get_trend("1D")
// Table UI
var table trendTable = table.new(position.top_right, 2, 5, border_width = 1)
if barstate.islast
table.cell(trendTable, 0, 0, "TF", bgcolor=color.gray, text_color=color.white, text_size=textSize)
table.cell(trendTable, 1, 0, "Trend", bgcolor=color.gray, text_color=color.white, text_size=textSize)
f_fill_row(trendTable, 1, "15m", t15, textSize)
f_fill_row(trendTable, 2, "1H", t1h, textSize)
f_fill_row(trendTable, 3, "4H", t4h, textSize)
f_fill_row(trendTable, 4, "1D", t1d, textSize)
indicator("Master Forex Dashboard: Sessions, Volume & MTF Trend", overlay=true, max_boxes_count=500)
// ==========================================
// 1. SESSIONS LOGIC
// ==========================================
showAsia = input.bool(true, "Show Asia Session", group="Forex Sessions")
asiaTime = input.session("0000-0900", "Asia Session Time", group="Forex Sessions")
asiaColor = input.color(color.new(color.blue, 90), "Asia Color", group="Forex Sessions")
showLondon = input.bool(true, "Show London Session", group="Forex Sessions")
londonTime = input.session("0800-1700", "London Session Time", group="Forex Sessions")
londonColor= input.color(color.new(color.orange, 90), "London Color", group="Forex Sessions")
showNY = input.bool(true, "Show NY Session", group="Forex Sessions")
nyTime = input.session("1300-2200", "NY Session Time", group="Forex Sessions")
nyColor = input.color(color.new(color.red, 90), "NY Color", group="Forex Sessions")
is_session(sess) => not na(time(timeframe.period, sess, "UTC+0"))
bgcolor(showAsia and is_session(asiaTime) ? asiaColor : na)
bgcolor(showLondon and is_session(londonTime) ? londonColor : na)
bgcolor(showNY and is_session(nyTime) ? nyColor : na)
// ==========================================
// 2. VOLUME LOGIC
// ==========================================
volLen = input.int(20, "Volume MA Length", group="Volume Logic")
highMult = input.float(1.5, "High Vol Multiplier", group="Volume Logic")
lowMult = input.float(0.5, "Low Vol Multiplier", group="Volume Logic")
volMA = ta.sma(volume, volLen)
isHighVol = volume > (volMA * highMult)
isLowVol = volume < (volMA * lowMult)
barcolor(isHighVol ? color.yellow : isLowVol ? color.gray : na)
// ==========================================
// 3. MTF TREND DASHBOARD (FIXED)
// ==========================================
emaLen = input.int(200, "Trend EMA Length", group="Dashboard")
textSize = input.string("small", "Table Text Size", options=["tiny", "small", "normal"], group="Dashboard")
// Function defined at GLOBAL scope to avoid your error
f_fill_row(table_id, row, label, trendVal, tSize) =>
bgColor = trendVal == 1 ? color.new(color.green, 30) : color.new(color.red, 30)
txt = trendVal == 1 ? "BULLISH" : "BEARISH"
table.cell(table_id, 0, row, label, text_color=color.white, text_size=tSize)
table.cell(table_id, 1, row, txt, bgcolor=bgColor, text_color=color.white, text_size=tSize)
get_trend(tf) =>
htfEMA = request.security(syminfo.tickerid, tf, ta.ema(close, emaLen))
htfClose = request.security(syminfo.tickerid, tf, close)
htfClose > htfEMA ? 1 : -1
// Fetch Data
t15 = get_trend("15"), t1h = get_trend("60"), t4h = get_trend("240"), t1d = get_trend("1D")
// Table UI
var table trendTable = table.new(position.top_right, 2, 5, border_width = 1)
if barstate.islast
table.cell(trendTable, 0, 0, "TF", bgcolor=color.gray, text_color=color.white, text_size=textSize)
table.cell(trendTable, 1, 0, "Trend", bgcolor=color.gray, text_color=color.white, text_size=textSize)
f_fill_row(trendTable, 1, "15m", t15, textSize)
f_fill_row(trendTable, 2, "1H", t1h, textSize)
f_fill_row(trendTable, 3, "4H", t4h, textSize)
f_fill_row(trendTable, 4, "1D", t1d, textSize)
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.