Check the output first
%B and Z-Score have different values for the center and the level lines. You can also tell them apart by the window name.
Quantifies where the close is within the deviation bands. You can switch between %B and Z-Score and combine smoothing of the main line, an average line and closed-bar notifications.
Blue: main line%B is the position within the bands; Z-Score is the distance from the mean divided by the standard deviation.
Orange: average lineA dashed line that averages the main line. It is not a moving average of price.
Silver: level linesScale marks for checking the position of the value. They do not indicate trading decisions.
Compares the default settings and a settings change example on a screen with only this product applied.
Published example: M1. This is an example to explain the display. The example with changed settings is not a set of recommended values. Details can be checked in the actual-size view. Also check the vertical axis and units of the separate window. Except for products with a fixed scale, the scale changes with the settings and the displayed range.
%B and Z-Score have different values for the center and the level lines. You can also tell them apart by the window name.
Close centers the bands on the average of closes. High/Low builds the upper and lower bands separately from highs and lows.
Whether blue is above or below orange, and where they cross, is a relation between calculation results. It is not the amount of price change itself.
Measures the position relative to the band width. A large value is not the same as a large price move.
With Close, the bands are the simple average of closes ± multiplier × population standard deviation. 0 is the lower band, 0.5 the mean and 1 the upper band. Outside the bands, the value is below 0 or above 1.
Divides the difference between the close and the mean by the population standard deviation. Changing the multiplier does not change the main line; only the positions of the level lines change. Available only with Close.
The upper band is the average of highs + multiplier × standard deviation of highs, and the lower band is the average of lows − multiplier × standard deviation of lows. 0.5 is their midpoint, not the average of closes.
The main line starts at bar Bands Period+Smoothing Period−1, and the average line Average Period−1 bars after that. By default, the main line starts at the 20th bar and the average line at the 69th. With the average OFF, only the main line is drawn.
If all closes in the period are the same, %B before smoothing is 0.5 and Z-Score is 0. With High/Low, it is 0.5 if all highs and lows in the period are the same. When smoothing or the average line is used, more bars are also needed before they settle.
The theoretical limit of Z-Score with Close is ±√(period−1). With period 20 it is about ±4.36, and for %B with multiplier 2 it is about −0.59 to 1.59. Right after a quiet stretch, even a small price change gives a large value. Tiny differences due to rounding exist.
Check how 0, 0.5 and 1 of %B relate to the blue line.
Changing Output, Band Source, smoothing and averaging separately makes it easier to track what changed.
Set Average Period to 1 or more, then turn crossover and reversal notifications ON individually.
The latest bar's value moves. Notifications evaluate the bar that has just closed when the next bar's price updates.
| Included file | Purpose / location |
|---|---|
| TRI_Deviation_Band_Percent_B.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 9 inputs. Change them on the Inputs tab of the properties. The English display name and the input name in the code are shown together.
InpBandsPeriodInpDeviationInpBandSourceInpOutputInpSmoothingPeriodInpAveragePeriodInpAverageMethodInpAlertCrossInpAlertTurnWith Close and the same smoothing conditions, Z-Score = 2×multiplier×(%B−0.5). Do not apply this formula to High/Low. It is also not the position within the band of EMA Deviation Envelope.
%B uses 0, 0.25, 0.5, 0.75 and 1; Z-Score uses −multiplier, −multiplier/2, 0, multiplier/2 and multiplier. The vertical axis is automatic, so all 5 lines are not always visible. If the period is shorter than multiplier²+1, then with Close, %B does not reach 0 or 1, and Z-Score does not reach ±multiplier.
EMA and SMMA calculate by carrying over the first value. If the history starts at a different point, past average lines also differ, and the difference gradually shrinks. There is no guarantee of an exact match after a certain number of bars. The main line and SMA/LWMA can be calculated under the same conditions if the required window is the same.
On the first price update of the next bar, it evaluates the 1 closed bar just before. The first calculation only records. If several bars advance on reconnection, events in between are not notified retroactively. If both conditions are met on the same bar, 2 lines appear in the order crossing → reversal.
The value of the latest bar changes with price updates. If past prices or the start of the history change, values after recalculation may also change. This is not a guarantee of no repainting.
Even when a line is not drawn because the required history is insufficient, the header may show 0 at the display precision. Check whether the line exists together with the number of bars required. %B is shown with 3 decimal places and the other 3 products with 2 decimal places.
Check the input values and their combinations. If it cannot start, a 1-line reason in English appears in the MT5 Experts tab.
This manual describes adding 1 instance of this product to 1 chart. To compare different settings, use separate charts.
Displays, marks and notifications are records of calculation results. They do not direct trading decisions and do not guarantee future price movements.
Both are OFF by default. Set the average period to 1 or more. The first calculation does not notify, and there is no function that reports past events in bulk. Notifications are pop-ups; there are no separate email or sound settings of its own.
Values are shown in the order main line → average line. 0.000 can be shown both as an actual value and when there are not enough bars, so check the line and the bar count together.
In this example, 2 scale labels overlap. The image can be used to compare the blue and orange lines, but do not read the overlapping text as 1 number.
Check where drawing starts in Chapter 3 and the input ranges in Chapter 7. Distinguish a line hidden by an input from a line that does not yet have the bars its calculation needs.
Check the reason in the MT5 Experts tab and set the inputs back within the allowed range.
Open "View the screen in detail at actual size". Also check the vertical scale and the screen zoom level.
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.
The population standard deviation is the square root of the mean of squared deviations. %B=(close−lower band)/(upper band−lower band), Z-Score=(close−mean)/population standard deviation. The main line is their simple average. The EMA of the average line is calculated internally from the first value of the main line, and display waits for the specified period. SMMA uses the first simple average as its seed.
On a bar where the main line equals the average, the previous side is kept; moving to the other side is a crossover. An upward reversal is when the main line is at or below the average, the bar two back ≥ the previous bar, and the previous bar < the closed bar. Downward is symmetric. The decision is made when the bar after the trough or peak closes, and the time in the notification is the start of the bar after that.
%B with Close and no smoothing (period 20, multiplier 2) and Z-Score (period 13) have the same definitions as calculations built from the standard Bands and StdDev. Including the handling of a calculation window with constant closes and rounding, we do not claim they always give the same values as the standard.