Averaging range
With Length=15, the latest 73 bars are used. It does not average over the Length number of bars itself.
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.
Averaging rangeWith Length=15, the latest 73 bars are used. It does not average over the Length number of bars itself.
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.
Reading flat segmentsA horizontal line is the result of the hold condition being met. It does not mean that the price itself was flat.
Compares the default settings and a settings change example on a screen with only this product applied.
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.
With Length=15, the latest 73 bars are used. It does not average over the Length number of bars itself.
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.
A horizontal line is the result of the hold condition being met. It does not mean that the price itself was flat.
Combines an average that includes negative weights with a hold process that uses the difference from the previous line.
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.
Because roughly half of the weights are negative, the line can go above the highest or below the lowest of the prices used.
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.
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.
| Length | Average start | Hold start |
|---|---|---|
| 15 (default) | Bar 73 | Bar 102 |
| 24 (changed example) | Bar 118 | Bar 165 |
| 400 (maximum) | Bar 1,998 | Bar 2,797 |
First, load the needed history with the defaults, and check the price bars and the orange line.
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.
Align the timeframe and the display range, and compare the shape of the line. Read differences in shape as differences in inputs and calculation.
| Included file | Purpose / location |
|---|---|
| TRI_Damped_Cosine_MA.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 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.
InpLengthInpFilterMultiplierInpPriceThe 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.
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.
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.
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.
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.
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.
A history of 5×Length−2 bars is needed. If the multiplier is positive, further preparation is needed before holding starts.
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.
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.
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.
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.
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.
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.
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.
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.