Check the settings first
First and Second are the order of the inputs. They are not automatically reordered into "short-term" and "long-term".
Shows the relative position of 2 moving averages and the distance between them with a light-blue and magenta band.
Light blueBars where the 1st MA is at or above the 2nd.
MagentaBars where the 1st MA is below the 2nd.
Keep width and price separateThe top and bottom of the band are the 2 MA values. They are not the current price or a future target itself.
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.
First and Second are the order of the inputs. They are not automatically reordered into "short-term" and "long-term".
Light blue is First ≥ Second; magenta is First < Second. When the values are equal, the band width is zero.
The color is a comparison of 2 averages. Even if a color continues, the price does not necessarily keep moving in the same direction.
Averages the price of each chart bar over 2 different periods and fills only the space between the 2 values. The averaging method is shared; the price used for each calculation can be chosen separately.
The relative position of the 2 averages and their difference in price units. The wider the band, the larger the difference between the 2 values; the narrower, the closer they are.
It does not by itself judge the future direction, confirm a reversal, give a range target, or judge the strength of movement. The width changes with the market and the settings.
Choose 1 of SMA, EMA, SMMA and LWMA, which is applied to both MAs. First MA Price and Second MA Price can be set to different prices.
SMA, SMMA and LWMA need as many bars as each period. Nothing is filled before both values are available. EMA starts from the price of the oldest loaded bar.
Choose a shared MA Method, and check the periods and prices of First and Second.
If history is insufficient, the band does not appear with SMA, SMMA and LWMA. EMA uses the oldest price as the initial value.
The color is the relative position; the width is the difference between the 2 values. The lines themselves are not displayed.
Refer to First MA and Second MA for the bar in question in the MT5 Data Window. Do not judge exact equality from the rounded display alone.
Align the timeframe, periods, method, prices and history range. The color and width of the forming bar are updated.
| Included file | Purpose / location |
|---|---|
| TRI_Two_MA_Band.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.
InpFirstPeriodInpSecondPeriodInpMethodInpFirstPriceInpSecondPriceThis product is for MT5. It cannot be used on MT4. No registration, account authentication or license file is required.
Only the band between the 2 values appears on the chart. The calculated values are available as First MA and Second MA in the Data Window.
On the forming bar, the band width and color change with price updates. Past values may also change when history is added or corrected.
There are no notifications such as sounds or pop-ups when the color switches, and no automatic order function.
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 SMA, SMMA and LWMA, check that there are as many bars as the longer period. If the 2 lines have the same method, period and price, the values match and the band width is zero.
If the relative position does not switch within the displayed range, it stays 1 color. This is not necessarily a fault.
Check the price scale and displayed range of the main chart. If the averages are off screen or the difference is small, the band is hard to find.
The color is decided by comparing the values before rounding to the display digits. Even if the numbers look the same, the internal values may differ very slightly.
Set the periods to 1–1000 and the method and prices within the choices. Settings outside the range are rejected at loading.
Especially with LWMA, the amount of calculation when recalculating history increases with the period length. Check that you have not set unnecessarily long periods or a large amount of history.
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.
Close=C, Open=O, High=H, Low=L, Median=(H+L)/2, Typical=(H+L+C)/3, Weighted=(H+L+2C)/4. The selected price is calculated for each bar.
Let the period be P and the selected price be x. SMA is the simple average of the most recent P bars. LWMA assigns weights 1 to P from the oldest and divides by the total weight P(P+1)/2. EMA uses the oldest x as the initial value and updates with the factor 2/(P+1). SMMA starts from the simple average of the first P bars and is then (previous value×(P−1)+x)/P.
Only on bars where both MAs can be calculated, the space between the 2 values is drawn as a dotted band. 1st ≥ 2nd is light blue (RGB 0,255,255), and 1st < 2nd is magenta (RGB 255,0,255). Equal bars are on the light-blue side, but the band height is zero. The lines themselves are not drawn.
The calculation uses the prices of that bar and earlier bars. The latest bar is subject to updates. EMA and SMMA depend on the start of history, so adding, correcting or reloading history is not necessarily free of any difference.
It is set to output First MA and Second MA to the Data Window. The display digits follow the symbol's price digits. The color is decided from the calculated values before rounding, so even if the 2 displayed values are the same, that does not necessarily contradict the color decision.