# Multi-Timeframe Trend Table

> Multi-Timeframe Trend Table is an indicator drawn over the price chart.

Source: https://algobarsx.com/docs/ex-51-multi-timeframe-table/

```algobarsx
indicator "Multi-Timeframe Trend Table"
    pane: price

h1 = bars(bars: 1h)
h4 = bars(bars: 4h)
d1 = bars(bars: 1d)

h1_up = h1.close > ema(h1.close, 50)
h4_up = h4.close > ema(h4.close, 50)
d1_up = d1.close > ema(d1.close, 50)
score = (if h1_up then 1 else 0) + (if h4_up then 1 else 0) + (if d1_up then 1 else 0)

table position: bottom_right, rows: [["1h", if h1_up then "up" else "down"], ["4h", if h4_up then "up" else "down"], ["1d", if d1_up then "up" else "down"], ["Score", "{score}/3"]]
bar_color if score == 3 then green else if score == 0 then red else gray
```
What this script says

Multi-Timeframe Trend Table is an indicator drawn over the price chart.

It calculates `h1` as 1-hour bars, `h4` as 4-hour bars, `d1` as daily bars, `h1_up` as whether `h1.close` is above the 50-bar EMA of `h1.close`, `h4_up` as whether `h4.close` is above the 50-bar EMA of `h4.close`, `d1_up` as whether `d1.close` is above the 50-bar EMA of `d1.close` and `score` as 1 when `h1_up`, otherwise 0 plus 1 when `h4_up`, otherwise 0 plus 1 when `d1_up`, otherwise 0.

On the chart, it shows a table and colors the bars.
