How to Create a Simple MTF Trend Dashboard with EMA and SMA

19 Feb 2026
0 comment
1 attachment

This indicator builds a compact multi-timeframe (MTF) dashboard that shows whether price is trading above or below a long-term moving average on several timeframes at once. It helps you quickly align trend bias across 5M, 15M, 1H, 4H, and Daily without switching charts.

//————————————————————–//
// INDICATOR: MTF_Trend_Dashboard
//————————————————————–//
DEFPARAM DrawOnLastBarOnly = true
// 1. DATA COLLECTION FROM MULTIPLE TIMEFRAMES
// Timeframe 1: 5 Minutes
TIMEFRAME(5 minutes)
sma5M = Average[200](close)
cond5M = close > sma5M

// Timeframe 2: 15 Minutes
TIMEFRAME(15 minutes)
sma15M = Average[200](close)
cond15M = close > sma15M

// Timeframe 3: 1 Hour
TIMEFRAME(1 hour)
sma1H = Average[200](close)
cond1H = close > sma1H

// Timeframe 4: 4 Hours
TIMEFRAME(4 hours)
sma4H = Average[200](close)
cond4H = close > sma4H

// Timeframe 5: Daily
TIMEFRAME(daily)
sma1D = Average[200](close)
cond1D = close > sma1D

Timeframe(default)
// 2. DASHBOARD RENDERING (Only on the last bar)
IF IsLastBarUpdate THEN
// Table Headers
//——————————————————————————————————————–
drawrectangle(-250,0,-10,-40) anchor(TopRight) coloured(“LightGray”) bordercolor(“Black”)
drawtext (” 5M | 15M | 1H | 4H | 1D “, -130,-10, SansSerif, Bold, 12) anchor(TopRight) coloured(“Black”)
//——————————————————————————————————————–
// Status Indicators (Row 1: Price vs 200 SMA)
// 5M
IF cond5M THEN
DRAWTEXT(” BULL “, -215, -25, SansSerif, Bold, 10) anchor(TopRight) coloured(“Green”)
ELSIF Not cond5M THEN
DRAWTEXT(” BEAR “, -215, -25, SansSerif, Bold, 10) anchor(TopRight) coloured(“Red”)
ENDIF
//
// 15M
IF cond15M THEN
DRAWTEXT(” BULL “, -170, -25, SansSerif, Bold, 10) anchor(TopRight) coloured(“Green”)
ELSIF Not cond15M THEN
DRAWTEXT(” BEAR “, -170, -25, SansSerif, Bold, 10) anchor(TopRight) coloured(“Red”)
ENDIF
//
// 1H
IF cond1H THEN
DRAWTEXT(” BULL “, -125, -25, SansSerif, Bold, 10) anchor(TopRight) coloured(“Green”)
ELSIF Not cond1H THEN
DRAWTEXT(” BEAR “, -125, -25, SansSerif, Bold, 10) anchor(TopRight) coloured(“Red”)
ENDIF
//
// 4H
IF cond4H THEN
DRAWTEXT(” BULL “, -80, -25, SansSerif, Bold, 10) anchor(TopRight) coloured(“Green”)
ELSIF Not cond4H THEN
DRAWTEXT(” BEAR “, -80, -25, SansSerif, Bold, 10) anchor(TopRight) coloured(“Red”)
ENDIF
//
// 1D
IF cond1D THEN
DRAWTEXT(” BULL “, -35, -25, SansSerif, Bold, 10) anchor(TopRight) coloured(“Green”)
ELSIF Not cond1D THEN
DRAWTEXT(” BEAR “, -35, -25, SansSerif, Bold, 10) anchor(TopRight) coloured(“Red”)
ENDIF
ENDIF
RETURN

Code Logic

  • DEFPARAM DrawOnLastBarOnly = true: Limits drawing operations to the most recent bar, reducing clutter and improving performance for dashboard-style overlays.
  • TIMEFRAME(5 minutes) … TIMEFRAME(daily): Switches the data context so each moving average and condition is calculated using that timeframe’s candles (not the chart’s current timeframe).
  • sma5M, sma15M, sma1H, sma4H, sma1D: Each variable stores a 200-period simple moving average computed with Average[200](close) in its respective timeframe.
  • cond5M, cond15M, cond1H, cond4H, cond1D: Boolean flags that evaluate trend bias as price above the 200 SMA (bullish) or not (bearish).
  • Timeframe(default): Returns the script to the chart’s original timeframe so the drawing coordinates and update cycle are handled in the main context.
  • IF IsLastBarUpdate THEN: Ensures the dashboard is rendered only when the last bar is updating, avoiding repeated historical drawing and keeping the panel stable.
  • drawrectangle(…): Creates the dashboard background panel; anchor(TopRight) pins it to the top-right of the chart window.
  • drawtext(…) (header): Prints the timeframe labels in a single row to align with the status cells below.
  • DRAWTEXT(” BULL “) / DRAWTEXT(” BEAR “): Displays a green bullish label when the corresponding cond* is true, otherwise a red bearish label; each label uses different X offsets to form columns.
  • RETURN: Ends the indicator after drawing the dashboard (there are no plotted lines in this script).

Notes and Practical Use

This dashboard is a quick trend filter: for example, you can require multiple timeframes to show BULL before taking long setups, or treat mixed readings as a consolidation/range warning. Although the title mentions EMA, the provided implementation uses a 200-period SMA via Average[200]; you can add EMA logic separately if you want a dual-meter display.*

Interpretation tip: A common approach is to prioritize higher timeframes (4H, 1D) for directional bias, and use lower timeframes (5M, 15M) for timing entries in the same direction.

Related Post

Check out this related content for more information:

https://www.prorealcode.com/topic/create-dashboard/#post-258075

Visit Link
What is a Snippet? A snippet is a small, reusable chunk of code designed to solve specific tasks quickly. Think of it as a shortcut that helps you achieve your coding goals without reinventing the wheel. How to Use: Simply copy the snippet and paste it into your project where needed. Don't forget to tweak it to fit your context. Snippets are not just time-savers; they're also learning tools to help you become a more efficient coder.
robertogozzi Master
Roberto https://www.ots-onlinetradingsoftware.com
Author’s Profile

Comments

Search Snippets

Showing some results...
Sorry, no result found!

Snippets Categories

global
35
indicator
133
strategy
171

Recent Snippets

How to Create a Simple MTF Trend Dashboard with EMA and SMA
indicator
This indicator builds a compact multi-timeframe (MTF) dashboard that shows whether price is trading above or below a [...]
How to Display Per-Bar Volume Accumulation in Real Time (Intrabar Updates)
global
This snippet tracks and displays the current bar’s accumulated volume while the bar is still forming, instead of only [...]
Ticks Counter: Count Tick Updates Per Bar on Tick or Time Charts
global
This snippet counts how many tick updates have occurred for the current bar by incrementing a per-bar counter on each [...]
How to Build a Step-Based Trailing Stop That Moves to Break-Even First
strategy
This snippet implements a step trailing stop that advances in fixed increments once price reaches predefined profit [...]
Utilizing Arrays to Track and Compare Indicator Values Within the Same Bar in ProBuilder
indicator
This ProBuilder code snippet demonstrates how to use arrays to compare the values of an indicator (RSI in this case) [...]
Logo Logo
Loading...