Count of Bars in ZagZag

 

Hi EveryOne.


I trid to write a CI ( Custom Indicator ) to Compute and find amount of Bars that made any wave of zigzag !!! unfortunately i didn't.

I used iCustom to Find the Upper or Lower Wave.

//-----Variable

double LowerZigzag = iCustom ( Symbol (), Period (), "ZigZag", MODE_LOWER, 1 ) ;
double UpperZigzag = iCustom ( Symbol (), Period (), "ZigZag", MODE_UPPER, 1 ) ;

//----Source Code

if ( LowerCounter != -1 && bLower && ! bUpper && UpperZigzag != 0 )
{
WaveBar= Bars - LowerCounter + 2 ;
LowerCounter = -1 ;
UpperCounter = Bars ;
bUpper = True ;
bLower = False ;
} // end of if

if ( UpperCounter != -1 && bUpper && ! bLower && LowerZigzag != 0 )
{
WaveBar = Bars - UpperCounter + 2 ;
LowerCounter = Bars ;
UpperCounter = -1 ;
bUpper = False ;
bLower = True ;
} // end of if


So what do you think /?


Best Regards and Thanx about your attention.

 

Hello, No one.


i think no one can Help me, HAH ?


Ok . Thanks a lot.