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

19 Feb 2026
8 comments
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 Legend
Roberto https://www.ots-onlinetradingsoftware.com
Author’s Profile

Comments

Leon8rd
5 months ago
#

Nice snippet. Is it possible to create with alignment of the EMAs too, please?

Nicolas
5 months ago
#

Sure, what do you mean by 'alignment' please? Please describe the conditions you want and we'll do the new version.

Leon8rd
5 months ago
#

The same display but shows bull/bear for EMA 200 instead of SMA. Will save flicking back and forth timeframes checking 200 EMA. Thank you.

robertogozzi
5 months ago
#

Replace Average[200] with: Average[200,1] Since not specifying an average, 0 (SMA) is assumed by default, while EMA is 1, to be added after the periods, separated by comma: You can une one of the 9 different values shown at https://www.prorealcode.com/documentation/average/: 0 – Simple Moving Average (SMA) 1 – Exponential Moving Average (EMA) 2 – Weighted Moving Average (WMA) 3 – Wilder’s Moving Average 4 – Triangular Moving Average 5 – End Point Moving Average 6 – Time Series Moving Average 7 – Hull Moving Average (Available only in PRT v11 and later) 8 – ZeroLag Moving Average (Available only in PRT v11 and later)

Leon8rd
5 months ago
#

Perfect, thank you!

DLVx
8 months ago
#

Hi Roberto. The indicator display a typical error "All timeframes used in your code should be multiples of the timeframe..." I applied it to within a 4H / 1D and cannot solve it. Any idea?

Nicolas
8 months ago
#

Put the indicator on a timeframe equal or inferior to 5-minutes chart, which is the minimal timeframe data used in the code.

DanielPattern
8 months ago
#

Tx!

Search Snippets

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

Snippets Categories

global
35
indicator
135
strategy
171

Recent Snippets

A multi indicator Dashboard for ProRealTime
indicator
This snippet creates a compact on-chart dashboard that aggregates multiple indicator states into a single, readable [...]
How to Track Up/Down Cumulative Volume Inside Each Candle (Tick Volume Delta)
indicator
This snippet separates the real-time, intra-candle volume into up-volume and down-volume based on whether the last [...]
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 [...]
ProRealCode ProRealCode
Loading...