Distinguish the 2 lines
Orange is a line calculated from price. Blue is a line connecting the confirmed tops and bottoms.
When the orange line changes direction by more than a threshold based on the range of change, the top or bottom of the segment is confirmed. The height of the mark is the extreme price, and the horizontal position is the confirming bar.
Orange is the calculated lineA line of a weighted average of price that keeps the previous value for small changes. Its role differs from the blue zigzag.
Red is a top, green is a bottomDrawn on the bar where the line's direction changes, after confirming the high or low of the segment. Blue connects those confirmed points.
Separate height and horizontal positionThe mark is not drawn back on the past bar that set its price. The horizontal position is the bar on which the condition was confirmed.
Compares the default settings and a settings change example on a screen with only this product applied.
Example shown: M1. This is an example for explaining the display. The published images are screens from before the brand display was added. The calculation and drawing conditions are the same, and the packaged version has display settings for the brand text and the QR code. 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.
Orange is a line calculated from price. Blue is a line connecting the confirmed tops and bottoms.
A bar with red or green is the bar on which the reversal was confirmed from the line's direction. It is not necessarily the bar that reached that price.
Length also affects the number of history bars needed for preparation. Filter is not in points; it is a multiplier applied to the calculated dispersion.
Using the turns of a line that smooths price, it confirms the extremes of segments afterward. The name "NonLag" does not mean that there is zero lag or that future tops and bottoms can be predicted.
It uses the latest 5×Length−2 bars. Because the weights include positive and negative values, unlike a normal simple average, the line can go outside the price range of that segment.
It uses the distance between the current weighted average and the previous held line. On a bar where that distance is smaller than Filter × dispersion, the previous line value is kept.
If the rise of the held line from 1 bar earlier exceeds the threshold, the direction is up; if the fall exceeds it, down. Within the threshold, the earlier direction is kept.
When the direction turns up, the lowest low from the bar after the bar with the previously adopted top extreme up to now becomes the bottom. The down direction is the reverse. The search does not start from the bar where the previous mark was shown.
For the same price, the older bar within the range is chosen. Because the bar of that extreme is also used for the next search range, the way equal values are chosen also matters.
The extreme price is placed on the confirming bar. A bottom is given even on the first check that turns up, and a top even on the first check that turns down. Candidate points on the forming bar are not extended.
Check Length 100, Filter 2, Close, Closed Bars Only true.
The default line needs 498 bars, and the direction check needs the 697th bar or later, counting the oldest as bar 1. With closed bars only, that check bar must also be closed.
Read the height of red and green as the extreme price and the horizontal position as the confirming bar, and match them with the turns of the orange line.
Distinguish the change of the line on the forming bar, the confirmed points, and the blue line segment added with the next point.
| Included file | Purpose / location |
|---|---|
| TRI_NonLag_Trend_ZigZag.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. When comparing different settings, using separate charts makes checking easier.
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 8 inputs. Change them on the Inputs tab of the properties. The English item names and input names defined in the source are shown together.
InpLengthInpFilterInpPriceInpClosedBarsOnlyInpTriBrandShowInpTriBrandCornerInpTriBrandXInpTriBrandYWhen closed bars are added with the same history and settings, confirmed dots are not moved to the bar of a past extreme. Settings changes, adding older history or corrections may change recalculated results.
A dot is connected to the previous one only after the next confirmation point appears. The completed diagonal line as a whole cannot be read as having been visible from intermediate times.
Even with Closed Bars Only true, the latest value of the orange line updates. This setting limits dots to closed bars; it does not freeze all drawing.
A mark may appear at a price away from the range of the confirming bar where the mark is. It is not a price at which a trade could have been made on that bar, nor a record of execution.
There is no notification, no order function and no limiting of the calculation range by time-specified objects. Account authentication and a license file are also not required.
The display is a record of calculation results. It does not direct trading decisions and does not guarantee future price movements.
This is because it waits until the line changes direction. The default is Length 100, Filter 2. Check that the line is drawn and that history and a price feed are available.
The preparation of the line and the start of the point check happen at different times. Also, 2 confirmed points are needed to connect a blue line segment.
Applied Price is used to calculate the orange line. The price of a mark is always chosen from the High and Low of the segment.
A point appears only when the line changes direction. On an equal value the direction is kept, and a change in the same direction does not give a new reversal point either.
Length is an integer from 3 to 400, Filter a finite value from 0 to 10, and Applied Price is chosen from 7 types.
Adjust the chart's vertical scale and display range. The published example also has marks near the top and bottom edges, so you can check it together with the full-size view.
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.
N=5L−2. It uses cosine-shaped weights that decay with distance from the newest bar, and divides the weighted sum by the sum of the weights. Because negative weights are included, there is no guarantee that the line stays within the range of the input prices.
D[t]=|current weighted average − previous held line|, A[t]=average of the latest L values of D. S[t] is the root mean square of (D[k]−A[k]) for each of the latest L bars. It uses each bar's own average A[k], which differs from the normal standard deviation that subtracts the current average A[t] from all bars. F=Filter×S.
Only when D<F is the previous line kept; otherwise the current weighted average is adopted. On the other hand, the direction changes only when the change of the line strictly exceeds F. When D=F, the direction may not change even if the line moves.
Counting the oldest as 0, the line is calculated from 5L−3 and the direction from 7L−4. By default, the line starts at the 498th bar and the direction at the 697th bar. The first extreme search also starts from the direction start bar and does not use older highs and lows. After that, it searches from the bar after the bar with the previous opposite-side extreme, including the confirming bar.
It is calculated on the price series of each chart, and there is no input to select a higher timeframe. Differences in the initial history affect the held line, direction and search range, so an exact match with a different history start position is not guaranteed.
M1 is the timeframe shown when the display example was created, and the price series is mainly at 30-minute intervals. It is not an example of the frequency of actual 1-minute bars. The published images are screens before the brand display was added; the screen display on the product with the brand display has not been checked yet.