The blue line is the average
Blue is a fixed display color. There is no feature that colors rising or falling states.
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.
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.
Look at it as of each barAs Of Each Bar uses the higher-timeframe prices that were known up to each chart bar.
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.
Compares the default settings and a settings change example on a screen with only this product applied.
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.
Blue is a fixed display color. There is no feature that colors rising or falling states.
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.
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.
A line that averages higher-timeframe prices, for comparing its position with the current chart's prices.
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.
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.
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.
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 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.
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.
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.
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.
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.
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.
| Included file | Purpose / location |
|---|---|
| TRI_HTF_MA_Line.ex5 | The 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.
Extract the ex5 main file rather than leaving it in the compressed file.
In MT5, open MQL5/Indicators from 'File → Open Data Folder' and place the included ex5 there.
Refresh the Navigator or restart MT5, and apply it to the target chart. Place only 1 instance of the same product on 1 chart.
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.
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.
InpTimeframeInpPeriodInpMethodInpPriceInpValueWhen 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.
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.
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.
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.
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.
This manual describes adding 1 instance of this product to 1 chart. To compare different settings, use separate charts.
The display is a record of calculation results. It does not direct trading decisions and does not guarantee future price movements.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.