MT5 indicators← MTF Agreement MA product page日本語の取扱説明書

This product is in preparation for release. Product files are not yet distributed; the manual is published so that you can review its content. This manual is an English translation of the Japanese manual. Images (screens and figures) are not translated and may contain Japanese text or earlier names.

For Trilogy users

MTF Agreement MA

Draws a moving average of the chart's timeframe and changes its color depending on whether the directions of up to 4 timeframes agree. The height and the color of the line are separate calculations.

Indicator name: MTF Agreement MAMetaTrader 5Main chart

Read the height and the color of the line separately

Height: the chart's moving averageColor: aggregates the directions of the enabled confirmationsAll up = green / all down = red / other = grayEven with the default closed-bar mode, the height of the latest line moves
Schematic diagram of how to read it. This is not an actual terminal screen.
1

The height is the chart's moving averageThe default is period 5, LWMA, Typical. It is not a line that overlays higher-timeframe moving averages.

2

The color shows agreement of the confirmationsIf all confirmations used are up, it is green; if all are down, red; otherwise gray.

3

By default, the color is decided by closed barsEven with Last Closed Bar, the height of the latest line changes while the bar is forming.

MT5 onlyUp to 4 confirmationsDefault is Last Closed Bar
1

MT5 display and examples of changed settings

Compares the default settings and a settings change example on a screen with only this product applied.

Settings change example: these items are changed
Handling of higher-timeframe values
InpBarMode
Last Closed Bar → Forming Bar (As Of Each Chart Bar)
Confirmation 1 timeframe
InpTf1
Current (chart timeframe) → M15
Confirmation 2 timeframe
InpTf2
H4 → H1
Confirmation 3 timeframe
InpTf3
D1 → H4
Use confirmation 4
InpUse4
false → true
Confirmation 4 timeframe
InpTf4
W1 → D1
Also draw bars not in agreement
InpShowMixed
true → false

All other inputs remain at their defaults. On a PC, the default is on the left and the change example on the right; at smartphone width they appear in the same order from top to bottom.

Default settingsInpBarMode = Last Closed Bar / InpTf1 = Current (chart timeframe) / InpTf2 = H4 / InpTf3 = D1 / InpUse4 = false / InpTf4 = W1 / InpShowMixed = true
MTF Agreement MA default settings
Default: LWMA 5 of the chart bars is shown. It switches between green, red and gray according to the direction of closed bars on H1, H4 and D1.
View the screen in detail at full size
MTF Agreement MA default settings (full size)
Example of changed settingsInpBarMode = Forming Bar (As Of Each Chart Bar) / InpTf1 = M15 / InpTf2 = H1 / InpTf3 = H4 / InpUse4 = true / InpTf4 = D1 / InpShowMixed = false
MTF Agreement MA example of changed settings
Changed example: Forming Bar, confirmation 4 enabled, the confirmation timeframes changed, and bars not in agreement hidden. M15 specified on H1 becomes H1, so confirmations 1 and 2 have the same timeframe. The line becomes partial.
View the screen in detail at full size
MTF Agreement MA example of changed settings (full size)

Example shown: 1-hour timeframe (H1). This is an example to explain the display. The changed settings are not recommended values. Details can be checked in the full-size view. Also check the price scale of the main chart and the positions of the candlesticks.

2

How to read it in 30 seconds

Height

The value of the moving average of the chart timeframe. The period of the line is changed with MA Period.

Colors

All up = green, all down = red. If there is a mix, equal values or a confirmation not yet determined, it is gray.

Hidden

When Show When Not Aligned is false, the gray parts are not drawn. An isolated value of just 1 bar may not look like a line.

3

What it measures

The color is applied by the confirmation results of the selected timeframes, not by the direction of the line itself. There is no rule that a green line always slopes upward.

Lines to display

A moving average built from the chart's prices. The method and price are shared with the confirmation moving averages, while the period is specified separately for the line and for each confirmation.

Color conditions

Only confirmations set to true are counted. All up gives green, all down gives red, and equal, mixed or not calculated gives gray. The values of disabled confirmations are not used.

Last Closed Bar (default)

Decides the direction from the closed moving averages of 1 bar before and the bar before that on each timeframe. The color does not change while the latest bar is forming, but the price of the line moves.

Forming Bar

Confirms with the interim higher-timeframe bar known as of each chart bar. The color changes while the latest bar is forming, and with the hide setting the line also appears and disappears.

Open the guide to the required history

This is a calculated guide. It assumes a calendar from January 1, 2024 with bars at each timeframe's interval for 24 hours from Monday to Friday (no Saturday or Sunday bars; weekday market holidays are not considered). The number of bars changes with the broker's actual bars, holidays, the start position of the history and the number of days in a month. It is not a guarantee that the display always starts from this number of bars on the terminal.

Ordinal of the chart bar where the calculation starts with the default settings

Chart timeframeLineConfirmation 1 (chart timeframe)Confirmation 2 (H4)Confirmation 3 (D1)First bar that can become green or red
M15th bar7th bar1,681st bar10,081st bar10,081st bar (0:00 on day 8)
M5573372,0172,017
M1557113673673
M305757337337
H15729169169
H4577 (H4 = chart timeframe)4343
D1577 (replaced with D1)77
W1577 (replaced with W1)7 (replaced with W1)7
MN1577 (replaced with MN1)7 (replaced with MN1)7

The line itself starts from bar MA Period. The last column of the table is the point where a color can appear; it is not a guarantee that the line becomes green or red. With Last Closed Bar, a confirmation on the same timeframe starts from bar period+2, and on a longer timeframe from the period+3rd interval, counting the first unused interval. With Forming Bar, each starts 1 bar earlier.

4

Situations for reading the display

The line moves but the color does not change

Indicator
The latest line with Last Closed Bar
Cross-check
The height of the line is decided by the current chart bar, and the color by closed bars.
Check
Check separately whether the height or the color changed.
Caution
It is not a setting that makes the whole line use closed values only.

There is no line even though the confirmations should agree

Indicator
Show When Not Aligned=false
Cross-check
The line is drawn by connecting 2 points. A value on only 1 bar whose neighbors are hidden is not visible as a line.
Check
Also check the state of the bars before and after.
Caution
Do not conclude that a bar is not in agreement only because no line is visible.

The confirmations become the same on the daily timeframe

Indicator
The default Current, H4 and D1
Cross-check
On a daily chart, H4 is replaced with D1, so all 3 are D1.
Check
Check the window name and the replacement message on the Experts tab.
Caution
Even if the timeframe names in the settings differ, the actual confirmations are not necessarily different.
5

Steps for checking the display

1

Check the default line

Check the line calculation with MA Period, Method and Price.

2

Read the enabled confirmations

Only the Check 1–4 items set to true decide the color. Check the timeframes, periods and the names after replacement.

3

Choose the timing of the color

The default is Last Closed Bar. To include interim values, change it after understanding the difference from Forming Bar.

4

Compare the hide setting on a separate chart

Turning off Show When Not Aligned makes the line break up. The settings in the example shown are not recommended values.

6

Installation and checking the package contents

Included filePurpose / location
TRI_MTF_Agreement_MA.ex5The MT5 main file. Place it in MQL5/Indicators.

The ZIP contains only 1 item, the main file. The manual is opened from the product page on the site. Source code is not included. MT5 only; registration, account authentication and placing a license file are not required. Use it without changing the file name.

1

Extract the ZIP

Extract the ex5 main file rather than leaving it in the compressed file.

2

Open the data folder

In MT5, open MQL5/Indicators from 'File → Open Data Folder' and place the included ex5 there.

3

Apply this product

Refresh the Navigator or restart MT5, and apply it to the target chart. Place only 1 instance of the same product on 1 chart.

4

Check the settings and display

First check with the default values. Changes and removal are done from the chart's 'Indicators List'.

Using this product does not require allowing DLLs. When removed, this product's drawings are cleared.

7

Settings

There are 17 inputs. Change them on the Inputs tab of the properties window. The English name shown on screen and the input name in the code are listed together.

Handling of higher-timeframe values

Name shown on screen
Higher Timeframe Value
Input name
InpBarMode
Default
Last Closed Bar
Allowed range
Forming Bar (As Of Each Chart Bar) / Last Closed Bar
Description
Forming Bar uses the interim higher-timeframe bar known as of each chart bar; Last Closed Bar uses the closed higher-timeframe bars up to 1 bar before.

Period of the drawn line

Name shown on screen
MA Period
Input name
InpMaPeriod
Default
5
Allowed range
1〜500
Description
The moving average period of the chart's timeframe. It is separate from the periods of confirmations 1–4.

Moving average method

Name shown on screen
MA Method
Input name
InpMaMethod
Default
LWMA
Allowed range
SMA / EMA / SMMA / LWMA
Description
Simple, exponential, smoothed and linear weighted moving averages.

Moving average price

Name shown on screen
MA Price
Input name
InpMaPrice
Default
Typical
Allowed range
Close / Open / High / Low / Median / Typical / Weighted
Description
Selects from close, open, high, low, the middle of high and low, the average of high, low and close, and the weighted average with the close counted 2 times.

Use confirmation 1

Name shown on screen
Check 1
Input name
InpUse1
Default
true
Allowed range
true / false
Description
Uses the direction of timeframe 1 to decide the color. Set at least 1 of them to true.

Confirmation 1 timeframe

Name shown on screen
Check 1 Timeframe
Input name
InpTf1
Default
Current (chart timeframe)
Allowed range
Current or a standard timeframe from M1 to MN1
Description
Current is the same timeframe as the chart. Shorter timeframes, and timeframes whose length does not divide evenly, are replaced with the chart's timeframe.

Confirmation 1 period

Name shown on screen
Check 1 Period
Input name
InpPeriod1
Default
5
Allowed range
1〜500
Description
Used to calculate the direction on that timeframe. When the confirmation is false, it has no effect, but its range is still checked.

Use confirmation 2

Name shown on screen
Check 2
Input name
InpUse2
Default
true
Allowed range
true / false
Description
Uses the direction of timeframe 2 to decide the color. Set at least 1 of them to true.

Confirmation 2 timeframe

Name shown on screen
Check 2 Timeframe
Input name
InpTf2
Default
H4
Allowed range
Current or a standard timeframe from M1 to MN1
Description
Current is the same timeframe as the chart. Shorter timeframes, and timeframes whose length does not divide evenly, are replaced with the chart's timeframe.

Confirmation 2 period

Name shown on screen
Check 2 Period
Input name
InpPeriod2
Default
5
Allowed range
1〜500
Description
Used to calculate the direction on that timeframe. When the confirmation is false, it has no effect, but its range is still checked.

Use confirmation 3

Name shown on screen
Check 3
Input name
InpUse3
Default
true
Allowed range
true / false
Description
Uses the direction of timeframe 3 to decide the color. Set at least 1 of them to true.

Confirmation 3 timeframe

Name shown on screen
Check 3 Timeframe
Input name
InpTf3
Default
D1
Allowed range
Current or a standard timeframe from M1 to MN1
Description
Current is the same timeframe as the chart. Shorter timeframes, and timeframes whose length does not divide evenly, are replaced with the chart's timeframe.

Confirmation 3 period

Name shown on screen
Check 3 Period
Input name
InpPeriod3
Default
5
Allowed range
1〜500
Description
Used to calculate the direction on that timeframe. When the confirmation is false, it has no effect, but its range is still checked.

Use confirmation 4

Name shown on screen
Check 4
Input name
InpUse4
Default
false
Allowed range
true / false
Description
Uses the direction of timeframe 4 to decide the color. Set at least 1 of them to true.

Confirmation 4 timeframe

Name shown on screen
Check 4 Timeframe
Input name
InpTf4
Default
W1
Allowed range
Current or a standard timeframe from M1 to MN1
Description
Current is the same timeframe as the chart. Shorter timeframes, and timeframes whose length does not divide evenly, are replaced with the chart's timeframe.

Confirmation 4 period

Name shown on screen
Check 4 Period
Input name
InpPeriod4
Default
5
Allowed range
1〜500
Description
Used to calculate the direction on that timeframe. When the confirmation is false, it has no effect, but its range is still checked.

Also draw bars not in agreement

Name shown on screen
Show When Not Aligned
Input name
InpShowMixed
Default
true
Allowed range
true / false
Description
true draws them in gray; false does not draw the line. Bars where a confirmation's direction is not decided because of insufficient history are handled the same way.
8

Usage specifications

When a selected timeframe is replaced

The same timeframe as the chart can be used. On charts of daily or lower timeframes, you can use daily or lower timeframes that are longer than the chart and whose length is divisible by the chart's length, as well as weekly and monthly timeframes. Others are replaced with the chart's timeframe. Example: M15 on H1 becomes H1, and H6 on H4 becomes H4. Weekly and monthly charts use only their own timeframe. Check the result after replacement in the window name and the “Experts” tab.

Higher timeframes are built from the current chart

It does not read the history of other timeframes directly; it groups the bars loaded in the current chart. There are no higher-timeframe bars older than the chart's history. For longer timeframes, the section containing the chart's first bar is not used. In calculations for the same timeframe, the first bar is also used.

Day, week and month boundaries

In server time, the boundary is 00:00 for daily bars, Sunday 00:00 for weekly bars and 00:00 on the 1st of the month for monthly bars. Sections without bars are not filled with new bars. If there are bars on Sunday, that day is also counted as 1 daily bar.

Results change with the history

The calculation is redone when the chart's history is added or corrected, or when the oldest bar or the settings change. For recursively calculated EMA, SMMA, RSI and ADX, past values and colors may also change. It is not guaranteed that past displays remain unchanged under all conditions.

Chart bars after closing

In normal bar progression, the check results known at the time of that bar are used. Even within the same higher-timeframe bar, past chart bars with Forming Bar can have different colors. If history or settings change, the past is also recalculated.

Color of line segments

On a bar where the color changes, the segment entering that bar takes the new bar's color. Read the position of the points and the segments between them separately.

Disabled checks

The Timeframe and Period of unused checks do not affect the color. However, their input ranges are checked. The 4 checks cannot all be set to false.

Meaning of gray

It is a color that combines mixed, equal and insufficient check history. Do not read an undetermined direction as the direction of the next price.

Only 1 instance of the same product on 1 chart

This manual describes adding 1 instance of this product to 1 chart. To compare different settings, use separate charts.

For on-screen display only

This product is for displaying calculation results on the screen. It does not guarantee future price movement.

9

Troubleshooting and usage notes

It stays gray

Look at the required-history table to see whether the history for the confirmations used is insufficient. Even when all confirmations can be calculated, it is gray while the directions do not agree.

The line appears only in some places

If Show When Not Aligned is false, the line is not drawn on bars not in agreement. When only 1 isolated bar is in agreement, it may also not be visible as a line.

Changing the confirmation periods does not change the shape of the line

The confirmation periods are conditions for the color. The height is changed by MA Period, Method and Price. However, if Show When Not Aligned=false, the drawn parts change.

Cannot start

Check the input ranges. If startup is refused, the reason appears as 1 line in English on the MT5 Experts tab. No panel with the reason appears on the chart. Inputs that are not used are also range-checked.

It does not match other charts

Check the timeframe, the inputs, the start of the history and how the intervals are split. Even an indicator with the same name does not match if it differs in whether values are interim or final, or in the history used for the calculation.

The required history is insufficient

Calculating longer timeframes needs many chart bars. Check the "Max bars in chart" limit and the history actually loaded. Raising the limit alone does not necessarily bring in all history that has not yet been downloaded.

If the first display does not appear, check history loading and the input ranges. If an earlier display has stopped updating, first check the price feed and the terminal's connection status.

10

Technical information and specification details

Direction comparison

Compares the moving average now with its value 1 bar before; strictly larger is up, smaller is down, and equal is unchanged. Even for EMA and SMMA in periods with no price movement, the direction can be decided by rounding in the last digit of the calculation. Distinguish this from appearing at the same height on screen.

Relation to standard moving averages

Uses the SMA, EMA, SMMA and LWMA formulas, but the higher timeframes are built from the current chart. Especially for EMA and SMMA, if the start of the calculation differs, the values and direction can differ from the standard indicator on another chart. It does not guarantee identical values on all timeframes.

Line calculation and drawing start

The moving average of the chart timeframe is drawn from bar MA Period. EMA also calculates initial values, but nothing is drawn before this number of bars. The default starts from the 5th bar. Until the confirmations can be calculated, the line is gray.

Confirmation state values

Each confirmation is +1 for up, −1 for down, 0 for equal, and an empty state when it cannot be calculated yet. Agreement is +1 when all are up, −1 when all are down, and 0 otherwise. Disabled confirmations are excluded from what is shown for the Data Window.

Default required history

With Last Closed Bar, a period 5 confirmation starts from the 7th bar on the same timeframe, and on longer timeframes from the 8th interval, counting the first unused interval. With the default on H1, the D1 confirmation is the last to become available, and the color can be judged from about the 169th bar.