frechet (vars Data, int TimeFrame, var Scale, var* Pattern) : var

Compares the recent part of a price series with a predefined curve section, and returns the similarity between the two curves. This function is used for detecting cups, zigzags or similar wave patterns in the price curve.

Parameters:

Data The series to be compared.
TimeFrame The number of bars in the series to be compared, or 0 for using the length of the pattern. Determines the horizontal size of the pattern.
Scale The vertical size of the pattern (f.i. 10*PIP for detecting a 10 pips tall pattern). Use a negative scale for inverting the pattern.
Pattern The pattern shape to be detected in the series, given by an array of positive values that starts with the oldest value and ends with 0 as an end mark.

Returns

Similarity between Data and Pattern in percent, normally in the 20..80 range.

Remarks:

Example:

//detect 10-pip 10-bar cup formations in the price curve
function run()
{
  vars Price = series(price());
  static var cup[10] = { 6,3,2,1,1,1,2,3,6,0 };
  plot("Cup Similarity",frechet(Price, 0, 10*PIP, cup),NEW,RED);
}

See also:

predict, advise, polyfit

► latest version online