MT5 indicators← HTF MA Line 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

HTF MA Line

Lets you check a higher-timeframe moving average on the current chart. You switch between the value of closed higher-timeframe bars and the value as of each bar.

Indicator name: HTF MA LineMetaTrader 5Shown on the price chart

Wait for the closed higher-timeframe bar, or look at the value as of each bar

Example showing the same higher-timeframe sections side by sideLast Closed BarAs Of Each BarSection ASection BSection CA schematic showing the difference in shape. There is no feature that draws the 2 lines at the same time.
Schematic diagram of how to read it. This is not an actual terminal screen.
1

Use the closed higher-timeframe barLast Closed Bar is the average as of the closed higher-timeframe bar 1 bar back. The value is the same within a section.

2

Look at it as of each barAs Of Each Bar uses the higher-timeframe prices that were known up to each chart bar.

3

Built from the current chart's barsIt does not read the history of another timeframe directly; it groups the chart's bars for the calculation.

4 MA methodsClosed value / value as of each barDivided by server time
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
Timeframe / Timeframe
InpTimeframe
D1 → M30
Averaging period / MA Period
InpPeriod
20 → 4
Averaging method / MA Method
InpMethod
EMA → SMA

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 settingsInpTimeframe = D1 / InpPeriod = 20 / InpMethod = EMA
HTF MA Line default settings
The default D1, EMA 20, Close and Last Closed Bar. The blue horizontal line is the average value of the previous closed daily bar. The blank area on the left and the line on the right result from the available history and the calculation start conditions.
View the screen in detail at full size
HTF MA Line default settings (actual size)
Example with changed settingsInpTimeframe = M30 / InpPeriod = 4 / InpMethod = SMA
HTF MA Line example with changed settings
An example changed to M30 and SMA 4. Close and Last Closed Bar are unchanged. The value switches at each 30-minute boundary, forming a stepped line. This example changes 3 items: timeframe, period and method.
View the screen in detail at full size
HTF MA Line example with changed settings (actual size)

Example shown: 1-minute chart (M1). This is an example for explaining the display. The settings change example is not a recommended value. Details can be checked in the full-size view. Please also check the price scale of the main chart and the positions of the candlesticks.

2

How to read it in 30 seconds

The blue line is the average

Blue is a fixed display color. There is no feature that colors rising or falling states.

The steps are update boundaries

With Last Closed Bar, the line is horizontal during the same higher-timeframe bar, and in the next section it moves to the closed value of the previous section.

A moving value can also be selected

With As Of Each Bar, the value also changes in the middle of a section. On each past bar, the value calculated with the information up to that bar is drawn.

3

What it measures

A line that averages higher-timeframe prices, for comparing its position with the current chart's prices.

Higher-timeframe bars are built from the chart

For daily, bars of the same day in server time are grouped. The open is taken from the first bar, the high and low are the maximum and minimum in the section, and the close is taken from the last bar.

Last Closed Bar

The current higher-timeframe bar is not included in the calculation; the average as of the closed higher-timeframe bar 1 bar back is shown. The same value continues until the higher-timeframe bar changes.

As Of Each Bar

A forming higher-timeframe bar is built from the open, highest high, lowest low and close up to each chart bar. Because the average includes that higher-timeframe bar, it changes within a section. The value of the latest bar changes while it is forming.

Choose from 4 methods

SMA is a simple average, EMA is exponential smoothing, SMMA is a smoothed average, and LWMA is a weighted average that gives more weight to newer bars. The number of bars averaged is MA Period.

The unit is price

The line value is the average of the selected price. It does not show a price target or a level at which the price always reacts.

The displayed range and the history are different

It uses the bars loaded on the chart, not only the bars visible on screen. When history is added or corrected, the start of the calculation and the displayed values may change.

4

Situations for reading the display

Look at the higher-timeframe boundaries

Indicator
Check the horizontal sections and steps of Last Closed Bar.
Cross-check
Compare Timeframe with the chart's timeframe.
Check
Compare the positions of the steps with the server-time boundaries.
Caution
Do not treat a step change as a trading signal.

Look at changes while forming

Indicator
Check the movement of the line with As Of Each Bar.
Cross-check
Compare only how the value is taken, with the same timeframe, period and method.
Check
Tell values in the middle of a section apart from values after the section has ended.
Caution
Do not call the forming line the closed value of the higher timeframe.

Look at the distance from the price

Indicator
Look at the position of the candlesticks relative to the average line.
Cross-check
Check the applied price and the averaging method.
Check
Check the reason for the change in distance from the chart's prices.
Caution
Do not judge the future direction only from the line getting closer or farther away.

The specified timeframe is not used

Indicator
Check whether it has become an average of the same timeframe as the chart.
Cross-check
Check for Current, the same or a shorter timeframe, and combinations whose seconds do not divide evenly.
Check
Follow the setting rules to determine the timeframe actually used.
Caution
Choosing a longer timeframe does not mean it is always adopted.

There is no line at the left edge

Indicator
Check where the line appears on the starting side of the history.
Cross-check
Check the first higher-timeframe section, the averaging method, MA Period and how the value is taken.
Check
Tell the blank before the required sections are complete apart from a line that is off screen.
Caution
Do not treat the blank as a price of 0 or an abnormal value.
5

Steps for checking the display

1

Decide the timeframe

Check the current chart and Timeframe. The default is D1. Check with the rules in the settings section below whether the combination can be used as a higher timeframe.

2

Align the averaging conditions

Check MA Period, MA Method and Applied Price. If you also change the method or price, the difference in values is no longer the effect of the timeframe alone.

3

Choose how the value is taken

Choose Last Closed Bar to see the previous closed higher-timeframe bar, or As Of Each Bar to see the average as of each chart bar.

4

Check the boundaries and history

D1 is divided at 0:00 server time. Load the history needed for the calculation, and cross-check the blue line with the candlesticks and the price scale.

6

Installation and checking the package contents

Included filePurpose / location
TRI_HTF_MA_Line.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 5 inputs. Change them on the Inputs tab of the properties. The English item names and input names defined in the source are shown together.

Timeframe

English item name
Timeframe
Input name
InpTimeframe
Default
D1
Allowed range
Current, or MT5 standard M1 to MN1
Description
Current is the chart's timeframe. Normally, only a timeframe longer than the chart whose length in seconds is an integer multiple of the chart's is used as the higher timeframe. Otherwise it falls back to the chart's timeframe. For the weekly and monthly exceptions, see the technical information.

Average period

English item name
MA Period
Input name
InpPeriod
Default
20
Allowed range
1〜1000
Description
The number of bars used for the average. When a higher timeframe is used, it is the number of grouped higher-timeframe bars, not the number of chart bars.

Averaging method

English item name
MA Method
Input name
InpMethod
Default
EMA
Allowed range
SMA / EMA / SMMA / LWMA
Description
The default is EMA. EMA starts calculating from the first available price. The other 3 methods need the full number of period bars.

Price used for calculation

English item name
Applied Price
Input name
InpPrice
Default
CLOSE
Allowed range
Close / Open / High / Low / Median / Typical / Weighted
Description
The selected price is made from the higher-timeframe open, high, low and close. With As Of Each Bar, the high, low and close are the values up to that chart bar.

How higher-timeframe values are taken

English item name
Higher Timeframe Value
Input name
InpValue
Default
Last Closed Bar
Allowed range
Last Closed Bar / As Of Each Bar
Description
Choose whether to use the average as of the previous closed higher-timeframe bar, or an average that includes the forming higher-timeframe bar built from the information up to each chart bar.
8

Usage specifications

The first higher-timeframe section is not used

When using a timeframe longer than the chart, the whole higher-timeframe section containing the first loaded chart bar is excluded. This is the same even if it was loaded from the start of the section.

Display start differs by method

After the excluded section, EMA calculates from the first available higher-timeframe bar. SMA, SMMA and LWMA need the number of bars in the period. With Last Closed Bar, that average is shown in the next section.

Higher-timeframe boundaries

D1 starts at 0:00 server time, W1 at 0:00 on Sunday, and MN1 at 0:00 on the first day of the month. These are not necessarily your computer's clock or Japan time.

Not necessarily identical to a standard higher-timeframe MA

Because it builds higher-timeframe bars from the chart bars, the average may differ from one calculated on a separate higher-timeframe chart if the history start position or the available prices differ.

Future bars are not used

Each chart bar's value is calculated with information up to that bar. However, the latest bar is still forming, and there is no guarantee that values stay unchanged through recalculation caused by history additions or corrections.

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

The display is a record of calculation results. It does not direct trading decisions and does not guarantee future price movements.

9

Troubleshooting and usage notes

The line does not appear yet

With a timeframe longer than the chart, the first higher-timeframe section is excluded. SMA, SMMA and LWMA also need the full number of period bars, and Last Closed Bar waits for one more section. Check the history and the method.

The line stays horizontal

With Last Closed Bar, being horizontal within the same higher-timeframe section is the normal behavior. Check the higher-timeframe boundaries and the price feed.

The line does not fit on screen

If the average is outside the current vertical axis range, it is not visible even though it is calculated. Also check the price scale and the displayed range.

It moves in finer steps than the specified timeframe

With a timeframe that is the same as or shorter than the chart, or a combination that is not an integer multiple, the chart's timeframe is used. Also check Higher Timeframe Value.

It cannot be attached or the settings are rejected

MA Period is 1–1000. Choose the timeframe, method, price and value-taking mode from the provided choices, and check the reason that starts with HTF MA Line in the terminal log.

The values differ from another chart

Check with the same material for the higher-timeframe bars built from the chart, the same server time, the same loaded history, and the same averaging method, period, price and value-taking mode.

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

Timeframe resolution rules

Current is the chart's timeframe. A setting that is the same as or shorter than the chart, or whose seconds are not an integer multiple of the chart's, becomes the chart's timeframe. W1 and MN1 can be specified if the chart is not weekly or monthly. If the chart itself is W1 or MN1, the chart's timeframe is used even if a different timeframe is specified. When it becomes the same timeframe, the first higher-timeframe section is not excluded; As Of Each Bar gives the MA of that bar, and Last Closed Bar gives the MA 1 bar back.

Time boundaries and missing sections

D1 is divided at 0:00 on the server date, W1 at 0:00 on Sunday, and MN1 at 0:00 on the first day of the month. Others divide the time in seconds by the length of the timeframe. Sections with no bars on the chart are not filled with fictitious higher-timeframe bars. For longer timeframes, the section containing the first chart bar is always excluded.

Moving average formulas

Let the period be P and the selected higher-timeframe price be x. SMA is the average of the most recent P bars. LWMA assigns weights 1 to P from the oldest and divides the sum by P(P+1)/2. SMMA starts from the SMA of the first P bars and is then (previous value×(P−1)+current price)/P. EMA starts from the first available price and smooths with the factor 2/(P+1). EMA has a value even with fewer than P bars.

Values as of each bar

With As Of Each Bar, the selected price is made from the open of that higher-timeframe bar, the highest high and lowest low up to that chart bar, and the close of that bar. It is averaged with the values of past closed higher-timeframe bars and this forming price. It does not paste the final higher-timeframe value uniformly onto past chart bars.

7 prices

Close is the close, Open is the open, High is the high and Low is the low. Median=(high+low)/2, Typical=(high+low+close)/3, Weighted=(high+low+close×2)/4.

Display and scope of use

Draws 1 blue line on the price chart. The color is fixed. The amount of calculation needed varies with the combination of period and timeframe and the amount of history. This document describes the functions of the MT5 version; an MT4 version is not included.