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

Condition MA

Checks the position of a moving average and the state of a separately calculated condition with 1 colored line.

Indicator name: Condition MAMetaTrader 5Shown on the price chart

Read the position and the color of the line separately

Position: moving average of the selected priceColor: state of the selected conditionOn bars where the condition has no state, the line is broken
Schematic diagram of how to read it. This is not an actual terminal screen.
1

Line positionDetermined by MA Period, MA Method and MA Price.

2

Line colorThe condition selected in Condition Source is calculated separately on each bar.

3

Sections without colorThese are different from the neutral color. Bars where the condition has no state are not drawn.

6 condition sources4 moving average methodsThe color records the calculated state
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
Color condition source / Condition Source
InpSource
CCI → Stochastic
Condition period / Source Period (CCI, RSI, Stochastic %K, Lagged Mean)
InpSourcePeriod
14 → 12
Upper level / Upper Level (CCI, RSI, Stochastic)
InpUpper
100 → 80
Lower level / Lower Level (CCI, RSI, Stochastic)
InpLower
-100 → 20

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 settingsInpSource = CCI / InpSourcePeriod = 14 / InpUpper = 100 / InpLower = -100
Condition MA default settings
Default settings in which the SMA 14 line is colored by CCI 14 and upper and lower levels.
View the screen in detail at full size
Condition MA default settings (actual size)
Example with changed settingsInpSource = Stochastic / InpSourcePeriod = 12 / InpUpper = 80 / InpLower = 20
Condition MA example with changed settings
An example in which the line calculation is unchanged and the condition is changed to Stochastic. There are 5 colors and sections where the line is broken.
View the screen in detail at full size
Condition MA 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

First check the line calculation

Check the line position with the MA period, method and price. Changing only the condition source does not change the calculation of the underlying moving average.

Check the condition and the levels together

The meaning of the colors differs for each condition source. Even if you switch from CCI to RSI or Stochastic, the levels do not change automatically.

Tell neutral apart from blank

Gold is the neutral state. Bars without a line are bars with insufficient history or bars where the selected condition has no state; they are not necessarily neutral.

3

What it measures

The line is an average of the price. The color does not show the slope of that line; it shows the result of the comparison in the selected condition.

Line position

The MA Price price is averaged with MA Method. SMA is a simple average, EMA is exponential smoothing, SMMA is a smoothed moving average, and LWMA is a weighted average that gives more weight to newer bars.

Common color notation

DodgerBlue is the upper side, LightSkyBlue is the upper side under another condition, Crimson is the lower side, Orange is the lower side under another condition, and Gold is neutral. Light blue and Orange appear only with Stochastic and MACD. The color names show the initial color scheme.

Smoothed Relation

An average F of Source Price is made and compared with G, which is F averaged in 2 further stages. If F is above G it is blue, if below it is red, and if equal the previous state is carried over. When the first comparison is equal, it is red.

Lagged Mean

Source Price, or the series of the moving average that is drawn, is compared with the simple average of the previous n bars, not including that bar. Above is blue, below is red, and equal is Gold.

Condition sourceRule that decides the color
CCI and RSIAt or above the upper level is blue, at or below the lower level is red, and in between is Gold. When the upper and lower levels are the same and the value equals them, blue takes priority.
StochasticWhen %K is above the upper level, it is blue if above %D and light blue if below. When it is below the lower level, it is red if below %D and Orange if above. Inside both levels it is Gold.
MACDWhen the main line is above 0, it is blue if above the signal line and light blue if below. When below 0, it is red if below the signal line and Orange if above. Gold is not used.

Level setting examples

CCI: Upper 100 / Lower −100. RSI: Upper 70 / Lower 30. Stochastic: Upper 80 / Lower 20. All are examples for reading and are not recommended values. MACD, Smoothed Relation and Lagged Mean do not use the upper and lower levels in the color calculation.

Conditions under which the line breaks with Stochastic

Bars where %K is exactly at a level, or where %K = %D outside both levels, have no state and the line is not drawn. Inside both levels it is Gold even when %K = %D. With MACD, bars where the main line is 0 or the main line = the signal line are not drawn.

4

Situations for reading the display

The line is blue but slopes downward

Indicator
The color is the upper-side state of the condition source.
Cross-check
Check the MA calculation and Condition Source.
Check
Read the color and the slope separately.
Caution
Do not judge the slope of the line or the future direction from the color alone.

The colors are skewed after changing the condition source

Indicator
The levels for CCI may still be set for RSI or Stochastic.
Cross-check
Check Upper Level and Lower Level.
Check
Set levels that fit the value range of the selected condition source.
Caution
Changing the condition does not change the levels automatically.

The line breaks partway

Indicator
With Stochastic and MACD, bars without a state occur.
Cross-check
Check equality with the levels, and equality between the main line and the comparison line.
Check
Tell blanks apart from the neutral color.
Caution
Insufficient history is also a reason for nothing being displayed.

The Relation values are equal

Indicator
The state of the previous bar is carried over.
Cross-check
Check the condition period and method.
Check
Do not read a continuing color as a new difference in size.
Caution
The first equal bar takes the lower-side color.

The Lagged Mean values are equal

Indicator
If the current value equals the average of the previous n bars, it is Gold.
Cross-check
Check whether it is Source Price or The Line.
Check
Make sure not to mix up the series being compared.
Caution
The current bar is not included in the average it is compared with.
5

Steps for checking the display

1

Decide the line

First check MA Period, MA Method and MA Price.

2

Choose the condition

Select Condition Source and adjust only the inputs used by that condition. Keep the unused inputs within the allowed range as well.

3

Check the upper and lower levels

When using CCI, RSI or Stochastic, check that Lower is less than or equal to Upper and that the levels fit the selected condition source.

4

Cross-check on closed bars

Check the line position, the color and the blank sections separately. The value and color of the latest bar change until the bar closes.

6

Installation and checking the package contents

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

Line period

English item name
MA Period
Input name
InpMaPeriod
Default
14
Allowed range
Integer 1–1000
Description
Used for the moving average of the price. It is separate from Source Period on the condition side.

Line averaging method

English item name
MA Method
Input name
InpMaMethod
Default
SMA
Allowed range
SMA / EMA / SMMA / LWMA
Description
The method used to calculate the line position. It is independent of the smoothing method on the condition side.

Price used for the line

English item name
MA Price
Input name
InpMaPrice
Default
CLOSE
Allowed range
Close / Open / High / Low / Median / Typical / Weighted
Description
Median is the average of the high and low, Typical is the average of the high, low and close, and Weighted is the average of the high, the low and the close counted 2 times.

Color condition source

English item name
Condition Source
Input name
InpSource
Default
CCI
Allowed range
CCI / RSI / Stochastic / MACD / Smoothed Relation / Lagged Mean
Description
Selects the calculation that decides the color. The condition values and comparison lines themselves are not drawn on screen.

Condition period

English item name
Source Period (CCI, RSI, Stochastic %K, Lagged Mean)
Input name
InpSourcePeriod
Default
14
Allowed range
Integer 2–1000
Description
The period for CCI and RSI, the %K period for Stochastic, and the number of previous bars for Lagged Mean. Not used by MACD or Smoothed Relation.

Price used for the condition

English item name
Source Price
Input name
InpSourcePrice
Default
CLOSE
Allowed range
Close / Open / High / Low / Median / Typical / Weighted
Description
Used by CCI, RSI, MACD, Smoothed Relation, and as the Source Price of Lagged Mean. It does not apply to Stochastic.

Upper level

English item name
Upper Level (CCI, RSI, Stochastic)
Input name
InpUpper
Default
100
Allowed range
Finite number from −100000 to 100000, not less than Lower
Description
Used by CCI, RSI and Stochastic. It is not changed automatically when the condition source changes. CCI and RSI include equality; Stochastic does not.

Lower level

English item name
Lower Level (CCI, RSI, Stochastic)
Input name
InpLower
Default
-100
Allowed range
Finite number from −100000 to 100000, not greater than Upper
Description
Combined with the upper level. CCI and RSI include equality; Stochastic does not.

%K smoothing bars

English item name
Stochastic Slowing
Input name
InpSlowing
Default
3
Allowed range
Integer 1–1000
Description
%K is calculated by summing, over this number of bars, the Stochastic range and the difference from the lowest low to the close.

%D period

English item name
Stochastic %D Period
Input name
InpDPeriod
Default
5
Allowed range
Integer 1–1000
Description
The period over which the Stochastic %K is averaged.

%D averaging method

English item name
Stochastic %D Method
Input name
InpDMethod
Default
SMA
Allowed range
SMA / EMA / SMMA / LWMA
Description
The method used to calculate %D from the Stochastic %K.

Stochastic price range

English item name
Stochastic Price Field
Input name
InpField
Default
Low/High
Allowed range
Low/High / Close/Close
Description
Low/High uses the highs and lows within the period; Close/Close uses the highest and lowest closes.

MACD shorter period

English item name
MACD Fast EMA
Input name
InpMacdFast
Default
12
Allowed range
Integer 1–1000
Description
Makes an EMA of Source Price. Being shorter than Slow is not enforced as an input condition.

MACD longer period

English item name
MACD Slow EMA
Input name
InpMacdSlow
Default
26
Allowed range
Integer 1–1000
Description
The period of the other EMA. The main line is the Fast EMA minus the Slow EMA.

MACD signal line period

English item name
MACD Signal SMA
Input name
InpMacdSignal
Default
9
Allowed range
Integer 1–1000
Description
Makes an SMA of the main line and compares it with the main line. With 1 it is the same as the main line, and no line appears under the MACD condition.

Relation first period

English item name
Relation Fast Period
Input name
InpRelFast
Default
5
Allowed range
Integer 1–1000
Description
The period used to make the average F from Source Price.

Relation averaging method

English item name
Relation Method
Input name
InpRelMethod
Default
LWMA
Allowed range
SMA / EMA / SMMA / LWMA
Description
The same method is used in all 3 stages: F, Stage 1 and Stage 2.

Relation 1st smoothing period

English item name
Relation Stage 1 Period
Input name
InpRelStage1
Default
10
Allowed range
Integer 1–1000
Description
Averages F further. There is no setting that skips it with 0.

Relation 2nd smoothing period

English item name
Relation Stage 2 Period
Input name
InpRelStage2
Default
20
Allowed range
Integer 1–1000
Description
Averages the Stage 1 result further to make G, which is compared with F.

Lagged Mean comparison series

English item name
Lagged Mean Series
Input name
InpLagSeries
Default
Source Price
Allowed range
Source Price / The Line
Description
Source Price is the price used for the condition; The Line is the moving average being drawn. Both compare the current value with the average of the previous Source Period bars.
8

Usage specifications

Forming bar

When the price of the latest bar updates, the line position and color also change. Do not treat the color before the bar closes as a closed record.

What it shows and does not show

It draws only the moving average line. It does not display or output the condition values, upper and lower level lines, arrows, notifications or sounds.

Set valid values even for unused inputs

Inputs not used by the condition source are also checked at loading. If the period, price, averaging method, upper and lower levels or similar inputs are outside the allowed range, it cannot be loaded.

The meaning of colors differs by condition

Blue and red are comparison results of each calculation. This product does not present color changes or the upper and lower levels as trading signals.

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

It cannot be loaded

Check the input ranges, the choices, and Lower ≤ Upper. In the MT5 Experts log, lines starting with "Condition Coloured MA:" show which type of problem it is: a choice, an averaging method or price, or a period or level.

Part or all of the line is not visible

Enough history is needed for both the line and the condition. After that, bars without a state are still blank. With MACD, if Fast = Slow or Signal SMA = 1, there is also no state to draw.

Only 3 colors appear

CCI, RSI and Lagged Mean use blue, red and Gold. Smoothed Relation uses blue and red. Even with Stochastic, not all colors necessarily appear, depending on the settings and prices.

Where to check the settings

Open the Inputs tab of this product's properties from the chart's Indicators List. The short name does not show all inputs.

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

Price average and start of history

SMA and LWMA are calculated once the required calculation window is filled. SMMA first makes an SMA and then carries over the previous value. EMA uses the first loaded price as the initial value. The point at which the condition is ready also varies with the method and period, and when the start of history changes, the smoothed values and carried-over states may change.

Exceptions for CCI and RSI

CCI is set to 0 when all Source Prices in the period are the same. The MT5 standard CCI may give a different value under this condition because of floating-point rounding. The color is decided by comparing this product's 0 with the upper and lower levels. RSI is 100 when the average decline is 0, and 50 when both the rise and decline are 0.

Stochastic calculation

From the highest high and lowest low within the period, close − lowest low and highest high − lowest low are calculated, and each is summed over Slowing bars. %K is their ratio × 100. If the sum of the ranges is 0, it is set to 100. %D is the average of %K using the specified method.

MACD calculation

The Fast and Slow EMAs are smoothed from the first price, and the difference is used from the bar where the longer period is complete. The signal line is the SMA of that difference. The main line and signal line themselves are not drawn; the result of their comparison is used to color the price moving average.

Handling of equality

CCI and RSI include the upper and lower levels, and when the upper and lower levels are the same, the upper takes priority. Stochastic does not draw the line exactly at a level. Inside the levels it is neutral even when %K = %D; outside, %K = %D has no state. Relation keeps the previous state on equality, and Lagged Mean becomes neutral on equality.