MT5 indicators← Deviation Band %B 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

Deviation Band %B

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.

Indicator name: Deviation Band %BMetaTrader 5Separate window

Read position and scale separately

Read the same position on different scalesClose: 0 = lower band / 0.5 = mean / 1 = upper bandZ-Score: how many standard deviations from the meanSmoothing → average of the main line → notifications if needed
Schematic diagram of how to read it. This is not an actual terminal screen.
1

Blue: main line%B is the position within the bands; Z-Score is the distance from the mean divided by the standard deviation.

2

Orange: average lineA dashed line that averages the main line. It is not a moving average of price.

3

Silver: level linesScale marks for checking the position of the value. They do not indicate trading decisions.

%B: 0, 0.5, 1Z-Score: number of standard deviationsNotifications OFF by default
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
Standard deviation multiplier
InpDeviation
2 → 2.5
Output scale
InpOutput
%B → Z-Score
Main line smoothing period
InpSmoothingPeriod
1 → 3
Average line period
InpAveragePeriod
50 → 10
Average line method
InpAverageMethod
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 settingsInpDeviation = 2 / InpOutput = %B / InpSmoothingPeriod = 1 / InpAveragePeriod = 50 / InpAverageMethod = EMA
Deviation Band %B default settings
Blue is %B and the orange dashed line is EMA 50. The main line can go below 0 or above 1 in some parts.
View the screen in detail at full size
Deviation Band %B default settings (actual size)
Settings change exampleInpDeviation = 2.5 / InpOutput = Z-Score / InpSmoothingPeriod = 3 / InpAveragePeriod = 10 / InpAverageMethod = SMA
Deviation Band %B settings change example
An example changed to Z-Score, with the main line smoothed over 3 bars and the average line set to SMA 10. At the lower right, the −2.500 and −2.842 scale labels overlap. Check the values with the heading and the scale explanation in Chapter 3.
View the screen in detail at full size
Deviation Band %B settings change example (actual size)

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.

2

How to read it in 30 seconds

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.

Next, how the bands are built

Close centers the bands on the average of closes. High/Low builds the upper and lower bands separately from highs and lows.

Finally, the position relative to the average line

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.

3

What it measures

Measures the position relative to the band width. A large value is not the same as a large price move.

%B: position within the bands

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.

Z-Score: distance from the mean

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.

0.5 with High/Low

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.

Where drawing starts

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.

Flat price action

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.

Scale limits and small changes

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.

4

Situations for reading the display

The main line went above 1

Indicator
The blue %B line
Cross-check
Check Band Source and the multiplier
Check
Read it as the close being outside the upper band
Caution
It does not indicate the size of the price move or future prices.

The display name changed

Indicator
Deviation Band Z-Score
Cross-check
Check Output
Check
Re-read Z-Score with 0 as the center
Caution
Notifications and startup error messages still begin with Deviation Band %B.

The average line looks different

Indicator
The orange dashed line
Cross-check
Compare the period, method and start of history
Check
Compare under the same conditions
Caution
With EMA and SMMA, values can change depending on where the history starts.
5

Steps for checking the display

1

View the position with the defaults

Check how 0, 0.5 and 1 of %B relate to the blue line.

2

Change one item at a time

Changing Output, Band Source, smoothing and averaging separately makes it easier to track what changed.

3

Only the notifications you need

Set Average Period to 1 or more, then turn crossover and reversal notifications ON individually.

4

Separate the forming bar from closed bars

The latest bar's value moves. Notifications evaluate the bar that has just closed when the next bar's price updates.

6

Installation and checking the package contents

Included filePurpose / location
TRI_Deviation_Band_Percent_B.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 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.

Band period

Name shown on screen
Bands Period
Input name
InpBandsPeriod
Default
20
Allowed range
2〜1000
Description
The number of bars used for the band's simple average and population standard deviation.

Standard deviation multiplier

Name shown on screen
Deviation Multiplier
Input name
InpDeviation
Default
2
Allowed range
0.1〜10
Description
With %B, it acts on the band width. With Z-Score, it changes only the level lines, not the value of the main line.

Band source

Name shown on screen
Band Source
Input name
InpBandSource
Default
Close
Allowed range
Close / High/Low
Description
Close builds the bands from closes; High/Low builds the upper and lower bands separately from highs and lows.

Output scale

Name shown on screen
Output
Input name
InpOutput
Default
%B
Allowed range
%B / Z-Score
Description
Z-Score can be used only when Band Source=Close.

Main line smoothing period

Name shown on screen
Smoothing Period (1 = off)
Input name
InpSmoothingPeriod
Default
1
Allowed range
1〜1000
Description
A simple average of the main line. 1 means no smoothing.

Average line period

Name shown on screen
Average Period (0 = off)
Input name
InpAveragePeriod
Default
50
Allowed range
0〜1000
Description
0 hides the average line. To use notifications, 1 or more is required.

Average line method

Name shown on screen
Average Method
Input name
InpAverageMethod
Default
EMA
Allowed range
SMA / EMA / SMMA / LWMA
Description
SMA is a simple average, EMA exponential, SMMA smoothed, and LWMA an average that weights newer values more heavily.

Closed-bar crossover notification

Name shown on screen
Alert on Closed-Bar Average Cross
Input name
InpAlertCross
Default
false
Allowed range
false / true
Description
Notifies when the main line moves to the other side of the average line.

Closed-bar reversal notification

Name shown on screen
Alert on Closed-Bar Turn
Input name
InpAlertTurn
Default
false
Allowed range
false / true
Description
Notifies when the main line turns up while at or below the average line, or turns down while at or above the average line.
8

Usage specifications

The same information on a different scale

With 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.

Level lines not visible

%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.

Differences from the start of the average

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.

Notification timing and order

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 forming bar changes

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.

Do not judge by the 0 in the header alone

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.

It does not start with out-of-range inputs

Check the input values and their combinations. If it cannot start, a 1-line reason in English appears in the MT5 Experts tab.

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

Displays, marks and notifications are records of calculation results. They do not direct trading decisions and do not guarantee future price movements.

9

Troubleshooting and usage notes

No notification appears

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.

It shows 0.000

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.

The lower right of the changed image is hard to read

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.

No lines appear

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.

The settings are not accepted

Check the reason in the MT5 Experts tab and set the inputs back within the allowed range.

Details are hard to read

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.

10

Technical information and specification details

Formulas and averaging methods

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.

Crossover and reversal detection

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.

Relation to the MT5 standard

%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.