Download MetaTrader 5

Indicators: Harmonic Pattern Finder V2 - page 4

To add comments, please log in or register
Andre Enger
1444
Andre Enger  
davesarge1:

Hi André,


Another idea for improvement of the indicator (as well as the 1.618 AB=CD and click on Pattern to highlight) would be to show the price next to the point D levels.  For example: "D Projected Bullish Cypher 110.821" on the attached chart.  Just now I have to change from cursor to cross hair on MT5 in order to see what the projected price is.  I am checking patterns on all timeframes and it would be great to just see the price next to the projected point D.

Thanks,

David

Hello again,


as previously mentioned, there are many slight adaptations possible. What you are requesting can be done in a slight codechange. So open up the code editor and navigate to line number 1634, change the line which reads

...      
ObjectSetString(0,pointD,OBJPROP_TEXT," D "+prefix+_patternNames[k]);
...

into

...
ObjectSetString(0,pointD,OBJPROP_TEXT," D "+prefix+_patternNames[k] + " " + NormalizeDouble(D, _Digits));
...

by adding the yellow part. Then press compile and you will have the desired result on projected 5-point patterns. Do the same on line 1523 for 4-point patterns.


Principle behind this is captured in the following color coding:

+ " " + NormalizeDouble(D, _Digits)

corresponds to "D Projected Bullish Cypher 110.821". So if you instead would have "D Projected Bullish Cypher - 110.821" (adding a separator -) then the code would look like this:

...
ObjectSetString(0,pointD,OBJPROP_TEXT," D "+prefix+_patternNames[k] + " - " + NormalizeDouble(D, _Digits));
...
davesarge1
89
davesarge1  
Andre Enger:

Hello again,


as previously mentioned, there are many slight adaptations possible. What you are requesting can be done in a slight codechange. So open up the code editor and navigate to line number 1634, change the line which reads

into

by adding the yellow part. Then press compile and you will have the desired result on projected 5-point patterns. Do the same on line 1523 for 4-point patterns.


Principle behind this is captured in the following color coding:

corresponds to "D Projected Bullish Cypher 110.821". So if you instead would have "D Projected Bullish Cypher - 110.821" (adding a separator -) then the code would look like this:

Many thanks!  I get a warning message, "implicit conversion from 'number' to 'string'"  but it works fine. 
Andre Enger
1444
Andre Enger  
davesarge1:
Many thanks!  I get a warning message, "implicit conversion from 'number' to 'string'"  but it works fine. 

It should work fine yes.

The warning is not malicious in this case and can be safely ignored. Alternatively, to have warning-free compilation the conversion can be made explicit by wrapping the number (the projected price) inside a DoubleToString() call as such:

... + " " + DoubleToString(NormalizeDouble(D, _Digits),_Digits));

or, more simply, by an explicit cast

... + " " + (string)NormalizeDouble(D, _Digits);
Andre Enger
1444
Andre Enger  

If you would additionally like to see the PRZ end price on the projections in the text, like "D Projected Bullish Cypher 110.821 to 110.678", it can be done in three modifications:

  1. The two lines which we have changed on until now should instead be
    ObjectSetString(0,pointD,OBJPROP_TEXT," D "+prefix+_patternNames[k]+ " " + (string)NormalizeDouble(D, _Digits)+" to "+(string)NormalizeDouble(farD, _Digits));
  2. The method declarations (line 1537 and 1471) must get the new parameter
    datetime DDateTime,double D,double farD)
  3. The method calls (line 953 and 955) must send the parameter
    ...                     
       DisplayProjection(patternIndex,bullish,ADateTime,A,BDateTime,B,CDateTime,C,DDateTime,D,farD);
    else
       DisplayProjection(patternIndex,bullish,XDateTime,X,ADateTime,A,BDateTime,B,CDateTime,C,DDateTime,D,farD);
    ...

davesarge1
89
davesarge1  
Andre Enger:

If you would additionally like to see the PRZ end price on the projections in the text, like "D Projected Bullish Cypher 110.821 to 110.678", it can be done in three modifications:

  1. The two lines which we have changed on until now should instead be
  2. The method declarations (line 1537 and 1471) must get the new parameter
  3. The method calls (line 953 and 955) must send the parameter

OK, interesting.  So that would allow me to see the PRZ stop before point D is reached?  By the way, how is the PRZ stop calculated?  Is it a certain % points from point D, or the last level in the PRZ?
Andre Enger
1444
Andre Enger  
davesarge1:
OK, interesting.  So that would allow me to see the PRZ stop before point D is reached?  By the way, how is the PRZ stop calculated?  Is it a certain % points from point D, or the last level in the PRZ?

Yes it would allow to see the price of the PRZ stop in the projection text label.

Its calculated using the "intersection" method described earlier, applying specified slack. Taking the bullish Gartley example again assuming 0 interval slack, and you had the (0.786 + scalar slack) XA intersecting - i.e. coinciding with - the 1.272 BC ratio, the PRZ would end there and not extend all the way down to the 1.618 BC, BECAUSE the XA rule and ratio would not be satisfied there. This means that if the stop is reached, the pattern is invalid because not all of the ratios (even with added slack) are satisfied WHEN the price eventually reverses.

So a bit more simplistic, its the last "common" price permitted by each one of the ratios
davesarge1
89
davesarge1  
Andre Enger:

Yes it would allow to see the price of the PRZ stop in the projection text label.

Its calculated using the "intersection" method described earlier, applying specified slack. Taking the bullish Gartley example again assuming 0 interval slack, and you had the (0.786 + scalar slack) XA intersecting - i.e. coinciding with - the 1.272 BC ratio, the PRZ would end there and not extend all the way down to the 1.618 BC, BECAUSE the XA rule and ratio would not be satisfied there. This means that if the stop is reached, the pattern is invalid because not all of the ratios (even with added slack) are satisfied WHEN the price eventually reverses.

So a bit more simplistic, its the last "common" price permitted by each one of the ratios

Hi Andre,

I am still a little unsure about some of the projected patterns, and the PRZ levels it is choosing.  For example, I attach a chart with a projected Bearish Bat, with XAD 79 and CD 218.  However, on this occasion the XAD 88.6 and CD 2.618 were very close to each other just a little higher (at 111.3), yet the indicator did not choose this as projected point D.  Is there any reason for this?

Thanks,

David

Files:
Andre Enger
1444
Andre Enger  
davesarge1:

Hi Andre,

I am still a little unsure about some of the projected patterns, and the PRZ levels it is choosing.  For example, I attach a chart with a projected Bearish Bat, with XAD 79 and CD 218.  However, on this occasion the XAD 88.6 and CD 2.618 were very close to each other just a little higher (at 111.3), yet the indicator did not choose this as projected point D.  Is there any reason for this?

Thanks,

David

The Bat pattern has XAD ideally at 88.6, and CD in 161 to 261.

But the indicator applies slack of 10 on the single numbered ratios and 1 on the interval ratios. However these numbers can be changed in the settings as unary slack and range slack.

So it will search for a zone from 78.6 (88.6 - 10) to 98.6 (88.6 + 10) where it deems the XAD ratio satisfied. The projection will start on the first possible number, in this case 79. It would only choose a higher number if it was forced by some other ratio, like the CD.

For example if the CD was only 150 at that particular price, the projection start would be increased to CD 160 (161 - 1), which might have given an XAD closer to the ideal one, or even higher. If the price would need to be increased above XAD 98.6 in order to have a CD of 160, the indicator would determine that the pattern cannot be satisfied and remove the projection. 

On the other hand, if the projection is reached it will show the PRZ end line, either at XAD 98.6 or CD 262 (261 + 1), whichever comes first. So in a sense, from the XAD ratio zone it will choose the last possible number unless forced by the other ratio.

As such, whenever the price is in the PRZ zone the indicator does not care about where the ideal ratios are, all it considers is that the price is within each ratio plus/minus the slack.

davesarge1
89
davesarge1  
Andre Enger:

The Bat pattern has XAD ideally at 88.6, and CD in 161 to 261.

But the indicator applies slack of 10 on the single numbered ratios and 1 on the interval ratios. However these numbers can be changed in the settings as unary slack and range slack.

So it will search for a zone from 78.6 (88.6 - 10) to 98.6 (88.6 + 10) where it deems the XAD ratio satisfied. The projection will start on the first possible number, in this case 79. It would only choose a higher number if it was forced by some other ratio, like the CD.

For example if the CD was only 150 at that particular price, the projection start would be increased to CD 160 (161 - 1), which might have given an XAD closer to the ideal one, or even higher. If the price would need to be increased above XAD 98.6 in order to have a CD of 160, the indicator would determine that the pattern cannot be satisfied and remove the projection. 

OK, I see. So the projection point D is really the first price where both leg ratios are within the range of acceptable numbers according to the slack setting. In that case I should really be treating point D as the beginning of the PRZ and not necessarily an optimum or ideal price. 
Thanks!
Andre Enger
1444
Andre Enger  
davesarge1:
OK, I see. So the projection point D is really the first price where both leg ratios are within the range of acceptable numbers according to the slack setting. In that case I should really be treating point D as the beginning of the PRZ and not necessarily an optimum or ideal price. 
Thanks!

That is correct if you consider the ratios as "ideal numbers but can have some slack". For example the XAB ratio of Gartley, I do not need the B point to be at an exact 61.8 XA but it should be "close enough". Otherwise I would be sidelined all the time.

In a purist sense the projected point D is really a bound to the pure PRZ, a bound that can be either permissive or restrictive to the PRZ according to the slack the purist allows and the particular alignment of ratios. The exact ratios are either tightly packed below that indicated point (permissive bound), or one leg ratio has been reached already but the projected point shows where that ratio is "close enough" to the other (restrictive bound).

So point D can only be considered as the beginning of the PRZ for holists and purists with zero slack tolerance. Its where the whole pattern is "close enough" to specification but not necessarily at any exact ratio.

The worst case for the purist would be if the pure PRZ is restrictively bounded by point D, and the subsequent PRZ stop is where the already visited ratio ceases to be "close enough" to the other ratio, which is even further below. Then the PRZ shown by the indicator would be in between the two exact ratios but have no ratio itself. The holist would say that the pattern is there, it is after all "close enough" to every ratio - while the purist would say not since there is no PRZ. 

To add comments, please log in or register