MT5 indicators← Damped Cosine 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

Damped Cosine MA

A line that averages prices with weights that shrink while swinging between positive and negative. If Filter Multiplier is greater than 0, once enough history is available, it keeps the previous line value on bars where the difference is small.

Indicator name: Damped Cosine MAMetaTrader 5Main chart, price units, 1 line

Weighted average → compare the difference with a threshold → update or hold

① Weighted average5×Length−2 bars→② Hold conditionDifference < threshold→③ 1 lineUpdate / hold the previous valueHolding starts from bar 7×Length−3
Schematic diagram of how to read it. This is not an actual terminal screen.
1

Averaging rangeWith Length=15, the latest 73 bars are used. It does not average over the Length number of bars itself.

2

Holding strengthFilter Multiplier=0 does not hold. If it is greater than 0, the difference and the threshold decide whether to keep the previous line value.

3

Reading flat segmentsA horizontal line is the result of the hold condition being met. It does not mean that the price itself was flat.

MT5 onlyPrice unitsA record of display and calculation
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
Length / Length
InpLength
15 → 24
Hold multiplier / Filter Multiplier
InpFilterMultiplier
0 → 0.75
Price / Applied Price
InpPrice
Close → Typical

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 settingsInpLength = 15; InpFilterMultiplier = 0; InpPrice = Close
Damped Cosine MA default settings
The default is Filter Multiplier=0, a weighted average with no holding.
View the screen in detail at full size
Damped Cosine MA default settings (full size)
Example of changed settingsInpLength = 24; InpFilterMultiplier = 0.75; InpPrice = Typical
Damped Cosine MA example of changed settings
An example with Length=24, Filter Multiplier=0.75 and Typical. You can also see parts of the line continuing horizontally. It is not an image that recommends settings.
View the screen in detail at full size
Damped Cosine MA example of changed settings (full size)

Example shown: M1. This is an example to explain the display. The example of changed settings is not a recommended value. Details can be checked in the full-size view. Also check the price scale of the main chart and the position of the candlesticks.

2

How to read it in 30 seconds

Averaging range

With Length=15, the latest 73 bars are used. It does not average over the Length number of bars itself.

Holding strength

Filter Multiplier=0 does not hold. If it is greater than 0, the difference and the threshold decide whether to keep the previous line value.

Reading flat segments

A horizontal line is the result of the hold condition being met. It does not mean that the price itself was flat.

3

What it measures

Combines an average that includes negative weights with a hold process that uses the difference from the previous line.

Decaying weights

The weight of the latest price is 1. Going toward older prices, the weights shrink while swinging between positive and negative in a cosine shape. The result is divided by the sum of the weights, not by the number of bars.

Range of the line

Because roughly half of the weights are negative, the line can go above the highest or below the lowest of the prices used.

Hold decision

Let D be the absolute value of the difference between the bar's weighted average and the line 1 bar earlier. The previous value is kept only when D is smaller than Filter Multiplier × dispersion; when they are equal, it is not kept.

Preparation is needed

The average starts from bar 5×Length−2, and the hold decision from bar 7×Length−3. In the interval between them, the bar's weighted average is drawn even if Filter Multiplier is positive.

LengthAverage startHold start
15 (default)Bar 73Bar 102
24 (changed example)Bar 118Bar 165
400 (maximum)Bar 1,998Bar 2,797
4

Situations for reading the display

The line continues horizontally

Indicator
There are intervals where the previous value is being held.
Cross-check
Check whether Filter Multiplier is greater than 0.
Check
Read the price bars and the line separately.
Caution
Do not assume that the price stayed the same.

No holding at the left edge of the history

Indicator
There is a preparation period for holding.
Cross-check
Check whether bar 7×Length−3 has been reached.
Check
Distinguish the start of the average drawing from the start of holding.
Caution
Holding does not work from the very start of the line.
5

Steps for checking the display

1

Open with the defaults

First, load the needed history with the defaults, and check the price bars and the orange line.

2

Check the inputs

Cross-check the settings section of this manual against the Inputs tab of the properties. All inputs changed in the changed example are shown in the comparison box.

3

Compare over the same range

Align the timeframe and the display range, and compare the shape of the line. Read differences in shape as differences in inputs and calculation.

6

Installation and checking the package contents

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

Length

English item name
Length
Input name
InpLength
Default
15
Allowed range
Integer 3 to 400
Description
Default 15. The price window is 5×Length−2 bars, and the difference and the dispersion use Length bars.

Hold multiplier

English item name
Filter Multiplier
Input name
InpFilterMultiplier
Default
0
Allowed range
Finite number from 0 to 10
Description
Default 0. 0 means no holding. If positive, after preparation it compares the difference from the previous value with the dispersion multiplied by the multiplier.

Price

English item name
Applied Price
Input name
InpPrice
Default
Close
Allowed range
Close / Open / High / Low / Median / Typical / Weighted
Description
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+2×close)/4.
8

Usage specifications

Color and display

The default is an orange (DarkOrange) solid line with width 2. There are no level lines, marks, text or notifications. No value header like that of a separate window appears on the price chart.

Start of the history

With multiplier 0, the value of a bar for which the required price window is available does not depend on earlier history. With a positive multiplier, it keeps using the previous line, so the influence of the start may remain for a long time.

Large multipliers

With a large multiplier, the line may stay still for a long time. In a preliminary count on real 1-minute data, the holding share for Length=15 was about 2 in 10 at multiplier 0.5, about 5 in 10 at 1.36, about 9 in 10 at 3, and nearly all at 5 or more. The same shares do not necessarily apply to other data.

The latest bar changes

When Applied Price is not Open, the value of the forming bar changes. With Open, it does not change during the bar unless that bar's open changes.

When the line is not visible

The vertical range of the price chart is based on the candlesticks. It does not automatically expand to fit the indicator line, so the line is not visible if it goes outside the upper or lower display range.

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 takes long before it is displayed

A history of 5×Length−2 bars is needed. If the multiplier is positive, further preparation is needed before holding starts.

The line differs from what was seen before

If the multiplier is positive, when older history is added or the start changes, values up to later bars can change through the previous values.

Out-of-range input

With settings outside the allowed range, it does not start, and 1 line with the reason in English appears on the Experts tab. Return the input to within the range and apply it.

Checking the name and the inputs

The numbers in the display name are rounded or omitted. Check the actual values on the Inputs tab of the indicator's properties. The name alone does not confirm 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

Definition of the dispersion

For each bar's D, an average of the Length values of D up to and including that bar is made. The difference between each D and the average at that D's bar is squared, and the square root of the average over the latest Length bars is used. This differs from the usual variance, which subtracts 1 current average from all D values.

Guide to the start of the history

A preliminary count with the oldest 50 to 500 bars changed on real 1-minute data. The influence of the new start lasted 148 to 193 bars in the changed example (24, 0.75, Typical), with a maximum difference of 1.65×10⁻⁵. With Length=15, multiplier 10 and Close, it was 228 to 653 bars, with a maximum of 8.58×10⁻⁴. With Length=400, multiplier 10 and Weighted, the difference remained up to the last bar in 10 of 19 cases, and in the other 9 cases it lasted up to 9,724 to 13,067 bars, with a maximum of 8.23×10⁻³. This is a guide that changes greatly with the conditions, not a universal required number of bars.

Display name and load

The name includes Length, the multiplier and the price, with the multiplier shown to 6 significant digits. The line label shows Length only. Check the exact multiplier on the Inputs tab. The calculation per bar is proportional to Length, and at the maximum it handles up to 2,798 terms in total across the price window and the 2 difference windows. Even with multiplier 0 the calculation time is not zero, and processing time is not guaranteed.

Price formulas

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+2×close)/4.

Scope of use

The display is a record of the calculation. It is not a function that instructs actions based on the line's position or slope. MT5 only.