Skip to main content

UMG Methodology

ALGORITHM II

Full migrated text of the second UMG algorithm, including EAM logic, presupposition handling and final model selection.

Section UMG Methodology
Updated 16.05.2026

Article State#

This article is not finished.

For an accurate understanding of the algorithm, you should get acquainted with UMG General Concepts.

Step I. Search For Point 3 of the External Attraction Model (EAM) and the Starting Point of the Previous Trend.#

1.1. The program looks for the first possible extreme satisfying Single Bar Rule. Such an extreme is a candidate for potential point 3, potential t.3.

1.2. Next, the program checks the bars from right to left, that is, in the past, from the bar containing the extreme candidate for point 3 to one of the following events:

  • 1.2.1. The last intersection point by the price level of the candidate for point 3 is found. In this case the report displays PREVdata: FullDataPrev and the program proceeds to sub-step 1.3.
  • 1.2.2. The program reaches the starting point of the chart. In this case the report displays PREVdata: NoFullDataPrev and the program proceeds to sub-step 1.3.
  • 1.2.3. The price checked 300 bars preceding point 3, but the level of step 3 did not intersect at this segment. The program looks for an absolute extreme opposite to step 3 on the segment from the 300th bar before point 3 to point 3 and proceeds to sub-step 1.3.

1.3. The program looks for an absolute extreme opposite to point 3 on the segment from the last intersection by the price level of the candidate for point 3, from the starting point of the chart, or from 300 bars before point 3, depending on the branch, up to point 3 excluding.

1.3.1. If an absolute extreme is found, the candidate for point 3 is confirmed, and the found confirming extreme is the assumed starting point of the preceding trend when the branch came from 1.2.2 or 1.2.3. The program then checks for the absence of extremes equal to point 3 between the assumed starting point of the previous trend and point 3.

1.3.1.1. If such an extreme is found, this candidate for point 3 is discarded.

1.3.1.2. If such an extreme is not found, the program proceeds to step 2.

1.3.2. If an absolute extreme is not found, this point 3 is discarded.

Simultaneously with step 1, the program launches the search for the next potential point 3.

Step II. Search For Potential Points 5 and 4#

The Orientation rule (N1 requirement) for Algorithm II is as follows:

If point 3 is low, then the level of point 5 should be higher than point 3.

If point 3 is high, then the level of point 5 should be lower than point 3.

Search for Point 5. The bar following the bar of Point 3, and in repeated applications of this step the bar specified in the algorithm, is checked for not overcoming the level of point 3, since the N1 requirement for Algorithm II must be observed.

2.1. If the price has overcome the level of point 3, the program discards the considered step 3 due to the N1 requirement.

2.2. If the N1 requirement is met for the analyzed bar, it is checked for compliance with the N1 requirement as a potential point 5.

2.2.1. If the analyzed bar is not an extreme according to the N1 requirement as a potential point 5, the program checks the next bar from the beginning of step 2.

2.2.2. If the analyzed bar is determined as an extreme according to the N1 requirement as a potential point 5, then this bar is checked for reaching, but not necessarily overcoming, the level of point 3.

2.2.2.1. If the level of point 3 is reached, the program analyzes the next bar according to this step.

2.2.2.2. If the level of point 3 is not reached, the analyzed bar is a potential point 5, and the program moves to sub-step 2.3.

2.3. Search for Point 4. The program searches for the last bar that crossed the level of the considered potential point 5, denotes it as lcb5, and then searches for a bar with the maximum or minimum price in the interval from lcb5 to potential point 5. This bar is checked for being an extreme according to N1 as potential point 4.

2.3.1. If the bar is an absolute extreme as potential point 4, then potential point 4 is found. If step 2 has already been determined during the search for an alternative model, the program checks the line chart for extra points in the section from step 2 to step 4. If extra points are found, the program processes the next bar after potential point 5 according to step 2. If not, it moves to sub-step 2.4.

2.3.2. If the bar is not an absolute extreme as a potential point 4, the program looks for another candidate for point 5 according to step 2.

If the program has processed 50 bars in a row according to step 2 and has not moved to another step of the algorithm, this potential point 3 is discarded. If there are 150 or more bars between potential point 3 and the analyzed bar, and potential points 4 and 5 are not found, then this potential point 3 is discarded.

2.4. Real-Time Verification of t.5. The potential t.5 bar is checked for the presence of bars between the analyzed bar and the potential t.4 bar which contain price values more distant, or equally distant, from the potential t.4 than the most distant from t.4 value of the analyzed bar. This checks whether the potential t.5 is a potential absolute extreme.

2.4.1. If the extreme is potentially absolute, the program proceeds to step 3.

2.4.2. If the extreme is not potentially absolute, the program checks the next bar starting from step 2.

Step III. Confirmation of Point 4. Searching for Alternative t.5 and t.5"#

The program checks whether the bar of potential t.5 has reached the level of t.4.

3.1. If the bar of potential t.5 has reached t.4, then the model is built through absolute t.5, the t.5 bar confirms t.4, point 4 is confirmed, point 5 is confirmed, and the program proceeds to sub-step 3.3.

3.2. If the bar of potential t.5 has not reached t.4, the program checks the next bar for reaching the level of t.4.

3.2.1. If the considered bar reaches the level of potential t.4, then the model is built through absolute t.5, the considered bar confirms t.4, points 4 and 5 are confirmed, and the program proceeds to sub-step 3.3.ext after first going through sub-step 3.3.

3.2.2. If the considered bar does not reach the level of t.4, then the program checks the next bar for overcoming the level of potential t.5. If t.5 is overcome, the analyzed bar is considered as a new potential t.5 and is processed according to step 2. If not, the analyzed bar is again checked for reaching the level of t.4 according to sub-step 3.2. In parallel the program also proceeds to sub-step 3.3 and this model branch receives a draw_flag label.

3.3. Construction of the Trend Line (TL). A Trend Line is constructed from t.3 to t.5. Each bar between t.3 and t.5 is checked for breaking TL.

3.3.1. If the price crosses TL, the program searches for a candidate for point 3', hereafter t.3', selected so that TL' from t.3' to t.5 is not crossed by price in the 3-5 segment. Rule No.1 for t.3' is not applied and t.3' cannot belong to the same bar as t.4.

3.3.1.1. If t.3' is found, this model is classified as built through t.3' and the program proceeds to step 4 or to sub-step 3.3.extended if coming from 3.2.

3.3.1.2. If t.3' is not found, the program searches for new potential t.5 and t.4 according to step 2.

3.3.2. If the price does not break TL, then the model is classified as built through t.3 absolute extreme and the program proceeds to step 4 or to sub-step 3.3.ext if the current algorithm line is coming from 3.2.

3.3.ext. Additional Trend Line Construction Through t.5". If the t.5 bar does not exceed the range of t.4 and the level of t.4 is confirmed at the time of calculation, the model is checked for the possibility of constructing an additional Trend Line through t.5".

Definition: Point 5". Point 5" can lie in the segment between t.5 and the point confirming t.4. On this segment a point is searched that meets the rules for selecting a 5" high or low: to the left of the bar containing t.5" the nearest extreme should go beyond the level of t.5, while to the right at least one nearest extreme should stay on the opposite side or equal to t.5 until at least one bar is strictly beyond it.

Special cases for point 5" include that it may belong to a bar that has broken the level of t.4, but only the first of such bars. If the bar of potential t.5" breaks the level of calculated t.6 from t.5, then it is impossible to construct a TL through t.5" for this model.

3.3.ext.1. If a bar is found that fits the rule for selecting 5", an additional TL is calculated for potential t.5", hereafter TL". This line is checked for the absence of breaks in the segment from t.3 or t.3" to potential t.5". The most suitable candidate is retained.

3.3.ext.1.1. If the analyzed model is built through t.3', then a candidate for t.3" is sought in the segment t.3-t.3' through which a line to t.5" can be built without price intersections in the segment t.3-t.3". Depending on whether intersections occur after t.5" and whether such a t.3" exists, the algorithm either keeps searching for another t.5" or moves to step 13.2 of the original branch.

3.3.ext.1.2. If the analyzed model is built through t.3, then TL" is checked by the bar following t.5". If there are intersections, t.5" is cancelled and the next one is sought. If there are no intersections, the algorithm moves to step 13.2.

3.3.ext.2. TL" is checked for price intersections in the segment between t.5 inclusive and potential t.5". If there is an intersection, this 5" is filtered out and a re-search is carried out with a new candidate further from t.4 in time. If there are no intersections, then t.5" is found, the report displays EAM5" EAM5", and the program moves to step 4. If t.5" is not found, the program still moves to step 4.

Step IV. Searching for Potential Foundation Blocks.#

Initial Check. First it is necessary to check for the presence of a fixed t.2. If it exists, it means the algorithm is already in a branch for searching for alternative models.

4.0.1. If t.2 is defined in the model, proceed to step 6.

4.0.2. If t.2 is not defined, the program moves to step 4.1.

Examination of Extremes. On the preceding trend, extremes are checked sequentially from right to left from t.3, or from another analyzed bar in repeated applications, according to the N1 bar rule as a candidate for t.2. Each found candidate for t.2 is checked for the presence of a confirming extreme which also serves as t.1.

4.1.0. An extreme candidate for t.2 is found.

4.1.1. The point of the last intersection of the candidate's level with the price is found. The program then looks for the absolute maximum, if t.2 is low, or the absolute minimum, if t.2 is high, in the segment from the last intersection of the t.2 level with price to t.2.

4.1.1.1. If the maximum or minimum is not found, the program discards this candidate for t.2.

4.1.1.2. If the maximum or minimum is found, the potential t.2 is confirmed.

4.1.2. Another branch occurs when the program reaches the starting point of the chart.

4.1.3. Another branch occurs when the check reaches the boundary of the Depth of Search for t.1 for the model and none of the above events occurred.

4.2. The search for Foundation Blocks, that is points 1 and 2, continues until one of these events occurs: the check reaches the bar containing the presumed starting point of the preceding trend, the check reaches the bar that intersects the level of presumed point 4, or it reaches a bar at a distance from t.3 greater than or equal to the configured time-ratio multiplier of the distance from t.3 to t.4.

Results. If one or more pairs of potential t.2 and t.1 are found, the program moves to step 5. If no potential Foundation Blocks are found, the program looks for the next potential t.5 according to step 2.

Step V. Search for Presupposition#

Presupposition is an optional part of the EAM. The program attempts to construct Presuppositions from all available candidates for t.2.

Presupposition Search Algorithm. The program takes each potential t.2 of the EAM, as part of a potential FB, as t.1 of Presupposition, hereinafter t.1p. Initially the most recent, rightmost, potential t.2 in the EAM is taken as a potential t.1p. If there are no more unconfirmed t.1p, the algorithm proceeds to Step 6.

5.1. The program sequentially checks bars from left to right, into the future, from potential t.1p to t.3 of the EAM model excluding t.3, for being an extreme according to the N1 rule as point 3 of the Presupposition, hereinafter t.3p.

N1 rule for the Presupposition points. If t.1p is low, t.3p must be below t.1p. If t.1p is high, t.3p must be above t.1p.

5.1.1. If the potential t.3p is not found, the program considers the next potential t.2 of the EAM as t.1p. If there are no more potential FBs, the algorithm proceeds to Step 6.

5.1.2. Once potential t.3p is found, the program searches for point 2 of the Presupposition, hereinafter t.2p, as an extreme with the maximum or minimum price on the segment from t.1p to t.3p. If a suitable extreme is not found, the algorithm looks for the next potential t.3p for the previously found t.1p. If a maximum or minimum is found, it is checked for being an extreme as t.2p.

5.1.2.1. If the bar is an absolute extreme, a potential t.2p is found and the program proceeds to step 5.2.

5.1.2.2. If the bar is not an extreme, the program looks for another candidate for t.3p for the previously found t.1p following step 5.1.

5.2. The program constructs a line from t.1p to t.3p and checks it for price crossings on the segment from t.1p to t.3 of the EAM including t.3.

5.2.1. If price crossings are found, the program looks for a new candidate for t.3p for the previously found t.1p.

5.2.2. If there are no price crossings, the program proceeds to sub-step 5.3.

5.3. The program searches for a potential point 4 of the Presupposition, t.4p, according to the N1 rule on the segment from t.3p to t.3 in the VMP including t.3.

If t.1p is low, t.4p must be below t.2p and each subsequent candidate for t.4p must be below the previous candidate. If t.1p is high, t.4p must be above t.2p and each subsequent candidate must be above the previous one.

If the potential t.4p coincides with t.3 in the EAM, t.4p is confirmed and the program proceeds to sub-step 5.3.1. If it does not coincide, the program looks for an opposite-direction potential t.4p extreme on the relevant segment. If such an opposite-direction extreme is found, t.4p is confirmed and the program proceeds to sub-step 5.3.1. Otherwise it looks for a new potential t.4p.

5.3.1. If t.4p is found, the program constructs a line from t.2p to t.4p and checks it for price crossings on the segment from t.1p excluding it to t.3 in the VMP including t.3. If unnecessary intersections are found, the program looks for the next potential t.4p. If no unnecessary intersections are found, the algorithm proceeds to sub-step 5.4.

5.3.2. The program checks the bar of the potential t.3p for absoluteness. The level of t.3p should not be exceeded by the price on the segment between t.3p and potential t.4p excluding it. If the level is exceeded, the potential t.3p is discarded and the program looks for a new t.3p. If the level is not exceeded, t.3p and t.4p are confirmed and the algorithm proceeds to sub-step 5.4.

5.4. Presupposition Verification. Presuppositions undergo the following checks: bars t.1p, t.2p and t.3p must follow each other, and the distance in levels between t.1 and t.2, rank 12, must be at least the configured minimum share of the distance between t.4 and t.5 levels of the EAM model, rank 45.

If all checks are successful, the Presupposition is found. If there are no unchecked t.1p left, the algorithm proceeds to Step 6.

Step VI. Check for AL price crossings#

6 alfa. First it is necessary to check for the presence of a fixed t.2. If it exists, it means the algorithm is in a branch of searching for alternative models. The potential Aims Line from t.2 to t.4, hereinafter AL, is calculated.

6 alfa.1. If there are no AL price crossings, the algorithm proceeds to step 6 alfa.2. If AL is crossed, the next potential t.5 is determined according to Step 2 starting from bar t.5+2.

6.2 alfa. If TL and AL of the model do not intersect on the right, that is in the future, or the ratio of the distance in bars between t.2 and t.4 to the distance between t.4 and the calculated point 6 is less than the configured minimum ratio for EAM, then the search for alternative models is terminated. Otherwise, the program proceeds to Step 9.

In the general case, no previously fixed t.2. The program performs the following checks for each of the potential FBs:

6.1. AL Price Crossing Check. If AL intersects with the price on the segment between t.2 and t.4, this pair of candidates for t.1 and t.2, this FB, is rejected.

6.1.A. If FBs are found that give AL without intersections, the algorithm proceeds to step 6.2.

6.1.B. If there are no suitable FBs, the algorithm looks for a new t.5 according to Step 2.

6.2. The program checks for intersection of AL and TL, hereinafter calculated point 6, with each other on the right along the time axis. If the ratio of the distance in bars between t.2 and t.4 to the distance between t.4 and the calculated t.6 is less than the configured minimum ratio for VMP, then these candidates for t.1 and t.2 are rejected.

If one or several potential FBs remain, the program proceeds to Step 7. If there are no potential FBs left, the program looks for a new potential t.5 starting from Step 2.

Step VII. Determination of FB's with and without 2X5#

The program checks for the intersection of the bodies of candles at t.2 and t.5, hereinafter 2x5. If there is only one potential FB, determining FB with 2x5 is not required and the program proceeds to Step 8.

7.1. If there are multiple potential FBs, some of which have 2x5 and some do not, those potential FBs that have 2x5 are filtered out and the program proceeds to Step 8.

7.2. If all potential FBs have 2x5, then all are filtered out except the one whose t.2 level is closer to the t.3 level.

Step VIII. Filtering Based on Presupposition#

The algorithm checks whether Presuppositions have been found for the analyzed model.

8.0. If no Presuppositions are found, the program proceeds to Step 9.

8.1. If the model has one or more Presuppositions, then for each Presupposition the program checks if the available candidates for t.2 belong to the interval between the last price level intersection of t.1p and t.1p itself. If such candidates exist, the Presupposition is retained. If not, such a Presupposition is discarded.

8.2. If after checking all Presuppositions there are one or more Presuppositions with candidates in t.2 within the specified interval, then among them only the one with t.1p occurring later on the time axis is considered further, and only those t.2 candidates that belong to the interval are retained.

8.2.1. If only one potential FB remains, the model is confirmed.

8.2.2. If more than one potential FB remains, the program proceeds to Step 9.

Step IX. Search for Embedded Models in EAM#

9.1. If EAM is constructed through t.3', then the interval from EAM's t.3 is checked for the presence of models according to Algorithm I for which several conditions are simultaneously satisfied: their t.5, if present, should precede or coincide with the t.5 of the analyzed EAM; t.4 must not lie beyond t.4 of the analyzed EAM; and t.1 must lie before t.3' of the analyzed model. If there are more than 5 models, those with the greatest time distance from t.1 to t.4 are considered embedded models.

If such models are not found, the EAM does not have an embedded primary model. If they are found, EAM is given the status of models described near the Primary model.

If EAM has one or more embedded models, then among them the algorithm searches for models built from EAM's t.3 that satisfy one of the following criteria: a trendline breakthrough in the interval before t.3' of the analyzed model, an intersection of candle bodies at points 2 and 5, or a rank 45 greater than ranks 12 and 25 of the same model.

In the presence of one of these criteria, the model is Specific based on the 1st criterion. In the absence of the specified criteria, the model is Normal based on the 1st criterion.

If there is a model according to Algorithm I on the interval from t.3 to t.3' of the EAM, aligned with the preceding EAM trend, and with points t.1-t.4 lying on the interval 3-3' EAM inclusive, then this EAM is Specific based on the 2nd criterion. In the absence of the specified criteria, the model is Normal based on the 2nd criterion.

Upon completion of all checks in step 9.1, the program proceeds to step 10.

9.2. If EAM is constructed through t.3, the program proceeds directly to step 10.

Step X. Search for Preceding Models#

The program identifies all possible models in accordance with Algorithm I, starting from the initial point of the preceding trend or from the presumed initial point of the preceding trend as described in step 1.3.

In these models, the actual t.6 is determined, and if there was no intersection of TL, the Presumed t.6, P6supp, is used. The algorithm for finding actual or presumed t.6 is described in the branch of Algorithm I, see sub-step 5.3.

Models on the preceding trend with TL coinciding with t.3 of the EAM are directly preceding for the given TL.

Models on the preceding trend are considered preceding corrective for the given EAM when actual or presumed t.6 precedes or equals t.3 of the EAM, t.6 is aligned with t.4 of the EAM, and the level of t.6 lies between the levels of t.3 and t.4 of the EAM.

From models with the same t.4 and the same t.1, the model with the later t.1 is selected as priority for choosing t.2. From the remaining models with the same t.4, only the very last model is considered as both preceding and preceding corrective. If there are more than 10 preceding and preceding corrective models, only the last ones are selected.

Step XI. Final Selection of t.2 - Checking the Convergence of LT and LC#

11.0. If t.2 is known, for example in the case when the algorithm is searching for an alternative model, proceed directly to sub-step 11.3.

11.0.1. The program finds the closest linked model on the preceding trend in terms of time distance from t.1 of those models to t.3 of EAM.

If the closest preceding model is from the beginning of the trend and t.2 of the analyzed model is before or coincides with t.1 of the preceding model, the considered t.2 is rejected and this branch of the algorithm is terminated. If the closest preceding model is a trend model and t.2 of the analyzed model is before t.1 of the preceding model, the considered t.2 is also rejected.

If EAM contains a Presupposition, the program proceeds to sub-item 11.2. If the model does not contain a Presupposition, the program proceeds to sub-item 11.1.

11.1. The program again finds the closest linked model on the preceding trend. If there are no preceding models, it proceeds to sub-step 11.2. If the nearest found linked model is from the beginning of the trend, all potential t.2 that coincide with or lie before t.1 of that model are rejected. If the nearest found linked model is a trend model, then all t.2 located before t.1 of the preceding model are rejected. In the presence of a preceding corrective trend model, the program looks for another linked model and analyzes it again as a reference for this sub-step.

11.2.1. For specific models, the program selects the most distant t.2 in terms of time from t.3.

11.2.2. For simple models, the program selects t.2 that is as close as possible in time to t.3.

11.3. The algorithm calculates the level of intersection of TL and AL of EAM, hereinafter the calculated t.6. The position of t.5 in relation to the level of calculated t.6 is checked.

11.3.1. If the bar of t.5 does not penetrate the level of the calculated t.6, the program checks if t.5'' has been found. If t.5'' has been found, then the program checks convergence of TL'' and AL and verifies the extent of convergence using the configured minimum ratio. If TL'' and AL diverge, or the convergence ratio is not sufficient, then t.5'' is rejected. At the end of sub-step 11.3.1.1 the program records the model. If t.5'' is absent, the program also records the model.

11.3.2. If the bar of t.5 penetrates the level of the calculated t.6, then this EAM cannot be built, and the program looks for a new t.5 by processing the bar following the bar of t.5 according to sub-step 2 and further according to the algorithm.

Step XII. Search for Alternative Models#

A new model is sought, but the points t.3, t.2, and Presupposition, if any, are retained. This is the final step of Algorithm II.

Continue Reading

Related Articles