Open kenorb opened 11 months ago
Detects a harmonic pattern called the Gartley pattern.
Example code:
//+------------------------------------------------------------------+ //| Function to check if a Gartley pattern is present | //+------------------------------------------------------------------+ bool IsGartleyPattern(int index, const double &high[], const double &low[]) { double XA = high[index - 4] - low[index - 4]; double AB = high[index - 3] - low[index - 3]; double BC = high[index - 2] - low[index - 2]; double CD = high[index - 1] - low[index - 1]; double ABtoXA = AB / XA; double BCtoAB = BC / AB; double CDtoBC = CD / BC; bool isGartleyPattern = (ABtoXA >= 0.618 && ABtoXA <= 0.786) && (BCtoAB >= 0.382 && BCtoAB <= 0.886) && (CDtoBC >= 1.618 && CDtoBC <= 2.618); return isGartleyPattern; }
Detects a harmonic pattern called the Gartley pattern.
Example code: