Read the basis of the ratio
In the upward direction, it is the price difference from the last confirmed bottom to the current high; in the downward direction, from the last confirmed top to the current low.
Confirms tops and bottoms on the bar where the pullback from the current extreme reaches 'a ratio to the leg and a minimum width' or 'a forced width'. However, a new extreme in the current direction takes priority, and the mark is placed on the confirming bar.
Blue line, red tops, green bottomsConfirmed vertices are connected with the blue line. The height is the held price, and the horizontal position is the bar that confirmed the condition.
Ratio and minimum width, or forced widthThe ratio alone is not enough; the minimum points are also needed. If the forced points are reached, the ratio is not needed, but the rule that new extremes take priority still applies.
Equal-value updates also take priorityIn the upward direction, if the high is at or above the current high, the leg is extended, and a reversal by that bar's low is not judged. The downward direction uses the reverse rule.
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.
In the upward direction, it is the price difference from the last confirmed bottom to the current high; in the downward direction, from the last confirmed top to the current low.
A reversal occurs with a pullback at or above the ratio and at or above the minimum points, or at or above the forced points.
If the bar reaches or exceeds the extreme on the same side, extension takes priority. Even a large outside bar does not always reverse.
Measures the pullback ratio relative to the leg in progress and the absolute price width. The ratio is not a future reversal probability or a profit rate.
In the upward direction, it checks whether current high − the low pulled back to is at or above the leg from the last confirmed bottom to the current high × Minimum Ratio. The downward direction is the reverse.
Even if the ratio is reached, no reversal occurs if the pullback width is less than Minimum Points. This distinguishes cases where only the ratio is met on a small leg.
If the pullback is at or above Force Points, the ratio does not need to be met. However, the decision is made only on bars without a new extreme in the current direction.
Closes Only=true changes the upper and lower prices to the close. Closed Bars Only is a separate setting that controls whether the forming bar is calculated.
Check ratio 0.33, minimum 200 points, forced 500 points, Closes Only=false and Closed Bars Only=true.
Input × the symbol's _Point is the price width. If _Point is 0.00001, 200 points is 0.00200 and 500 points is 0.00500.
Check that there is no update at or above the high in the upward direction, or at or below the low in the downward direction. Equal values also count as updates.
Check both the ratio and the minimum width, or the forced width. The horizontal position of a mark is the bar where the decision was made.
| Included file | Purpose / location |
|---|---|
| TRI_Leg_Ratio_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 9 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.
InpMinRatioInpMinPointsInpForcePointsInpByCloseInpClosedBarsOnlyInpTriBrandShowInpTriBrandCornerInpTriBrandXInpTriBrandYOn the bar where the difference between the high and low since the start becomes at least the minimum points, the direction is set to the side updated later. If both are on the same bar, it is upward. This first dot is separate from the normal retracement evaluation.
When closed bars are added with the same history and settings, confirmed dots are not moved to past extremes. When the next dot is confirmed, a segment is added. Do not read that segment as having been visible from earlier.
Results are recalculated on settings changes, history corrections and additional loading of older history. With Closed Bars Only=false, dots on the latest bar appear and disappear.
The height of a vertex is the held extreme price, and the horizontal position is the confirming bar. It may be away from the high/low of that bar, and it does not mean that a trade could have been made at that price.
If the two are the same, the force condition of reaching that width is in effect, so the ratio does not constrain reversals. The priority for updating extremes does not change.
The display is a record of calculation results. It does not direct trading decisions and does not guarantee future price movements.
No reversal decision is made on a bar with a new extreme in the current direction. This includes equal highs and equal lows.
The initial point is created when the minimum width is reached, and a later reversal is needed for the next point. With only 1 point, no line can be connected.
The forced width may take effect first, or the minimum width may be the constraint. In particular, with Force=Minimum, the ratio is not a constraint.
Closes Only and Closed Bars Only are different. To use closed bars only, set the latter to true.
Set the ratio to 0.01 to 1, the minimum width to 1 to 100000, and the forced width to at least the minimum width and no more than 100000.
Adjust the display range and the price scale, and also check the image in the actual-size display.
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.
In the upward direction, U is the high in progress and Dn is the last confirmed bottom. U−Dn is the leg currently extending, not a fixed length between the last 2 confirmed points. The downward direction is the reverse.
In the upward direction, upper price ≥ U is processed first, and the pullback is judged only on other bars. The boundaries for pullback width, ratio and forced width include equality. The downward direction is the reverse. Up to 1 point is output on 1 bar.
The high and low are initialized on bar 0, and from bar 1 the highest and lowest values and their update times are tracked. When the minimum width is reached, if the later time is on the high side, a bottom is drawn on that confirming bar; if on the low side, a top. If simultaneous, a bottom.
The blue line is a DRAW_SECTION that connects confirmed points only. There is no leg extending toward the unconfirmed current extreme. There are no notification or order functions.
M1 is the timeframe shown when the display example was made. The price data is mainly at 30-minute intervals, and the image does not show how often marks appear on actual 1-minute bars.
The published images are screens from before the brand display was added. The on-screen display of the product with the brand display has not yet been verified.