Multitime Frame SMA Dots

MTF SMA Dots v6.00 — Indicator Description

Overview

MTF SMA Dots is a MetaTrader 4 custom indicator that displays a Simple Moving Average (SMA) from a higher timeframe directly on the current chart. Instead of drawing a traditional continuous line, the SMA is rendered as a series of colored dots, one per bar, making it easy to read at a glance without cluttering the chart.

The dot color changes dynamically based on the slope of the SMA, giving an immediate visual signal of the current trend direction.



How It Works

For each bar on the current chart, the indicator:

1. Identifies which higher timeframe (HTF) candle contains that bar using iBarShift.
2. Calculates the SMA value on the HTF for the current and previous HTF bar.
3. Compares the two values to determine the slope (trend direction).
4. Plots a dot at the SMA value with a color reflecting the trend.

A built-in timer fires every 500ms on startup to force MT4 to pre-load the HTF history, ensuring dots are drawn all the way to the latest bar without gaps.



Trend Logic

| Condition | Color | Meaning |
|---|---|---|
| SMA slope > +Sensitivity threshold | Blue (default) | Uptrend |
| SMA slope < −Sensitivity threshold | Orange/Red (default) | Downtrend |
| SMA slope within ±Sensitivity threshold | Gray (default) | Neutral / Ranging |

The slope is measured as the difference between the current and previous HTF SMA values, expressed in points.



Parameters

| Parameter | Default | Description |
|---|---|---|
| Period | 20 | Number of HTF bars used to calculate the SMA |
| Timeframe | H1 | The higher timeframe on which the SMA is calculated |
| Dot Size | 3 | Visual size of the dots (1 = smallest, 5 = largest) |
| Bullish Color | DodgerBlue | Dot color when the SMA is sloping upward |
| Bearish Color | OrangeRed | Dot color when the SMA is sloping downward |
| Neutral Color | Gray | Dot color when the SMA is flat |
| Sensitivity | 3 | Minimum slope (in points) to qualify as a trend |



Installation

1. Copy MTF_SMA_Dots_v6.00.mq4 into your MT4 MQL4/Indicators/ folder.
2. Open MetaEditor and compile the file (press F7), or restart MT4.
3. In MT4, open the Navigator panel, find the indicator under *Custom Indicators*, and drag it onto any chart.
4. Configure the parameters in the settings dialog and click OK.



Notes

- The indicator can be used on any chart timeframe, as long as the selected HTF is higher than the current chart timeframe (e.g., H1 SMA on a M15 chart).
- On first load, allow 1–2 seconds for MT4 to fully load the HTF history. Dots will appear automatically once the data is ready.
- The indicator title displayed on the chart includes the version number, period and timeframe for easy identification (e.g., MTF SMA Dots v6.00 (20, H1)).



Version History

| Version | Notes |
|---|---|
| v1.00 | Initial release — basic MTF SMA with dot rendering |
| v2.00 | Attempted native HTF calculation without iMA dependency |
| v3.00–v5.00 | Various fixes to buffer direction and HTF grouping logic |
| v6.00 | Reverted to native iMA with active HTF history preloading via timer |

필터:
리뷰 없음
리뷰 답변