# i can't find the logic behind that pattern

61

could any one tell me please the logic behind that pattern , how to program it ,,, just the idea not the code

15934

hakona: could any one tell me please the logic behind that pattern , how to program it ,,, just the idea not the code
The hard part is splitting the chart into the 3 parts (a, b, and c)
Not compiled, not tested.
```int iHi = LocalExtremeBar(LE_Window, 0, +1),
iLo = LocalExtremeBar(LE_Window, 0, -1);
if(iHi > iLo){ // As pictured
int iC = iHi;
int iB = LocalExtremeBar(LE_Window, iC, -1); // End of A/Start of B
int iA = LocalExtremeBar(LE_Window, iB, -1); // Start of A
if(High[iA] >  High[iC]
&&  Low[0]  > (High[iB] + Low[iB])/2.0 ){    // Pattern confirmed
:
```
Not compiled, not tested.
Pre Build 600
```int     LocalExtremeBar(int length, int start, double d){
if (d > 0.0) return LocalExtremeArray(High, length, start, d);
return LocalExtremeArray( Low, length, start, d);
}
int     LocalExtremeArray(double arr[], int length, int iStart, double d){
while(true){
int iPrev = iStart;     iStart = ArrayExtrema(arr, length, iStart, d);
if (iStart == iPrev)    break;
}
return(iStart);
}
int     ArrayExtrema(double arr[], int length, int iStart, double d){
// Like ArrayMaximum but with direction and duplicate control.
int iExtreme = iStart;  double value = arr[iExtreme];
int iLimit = MathMin(iStart + length, ArraySize(arr));
for(iStart++; iStart<iLimit; iStart++)  if( (arr[iStart]-value) *d >= 0.){
iExtreme = iStart;  value = arr[iExtreme];  }   // largest index (>=)
return iExtreme;
}```
Pre Build 600
61

thank u