can someone please add dates to each zig zag high and low points the
code is as follows
ZZPercent = Param("ZZPercent", 5 );
ATRPeriod = Param("ATRPeriod", 5 );
ATRFactor = Param("ATRFactor", 1.5, 0, 5 );
HLPivot = ZZPercent * 0.01 + ATRFactor * ATR( ATRPeriod )/Close;
Ll = Low[ 0 ];
Hh = High[ 0 ];
Llb = Lhb = 0;
if( High[ 1 ] >= Hh )
{
Hh = High[ 1 ];
Lhb = trend = 1;
}
else
{
Ll = Low[ 1 ];
Llb = 1;
trend = -1;
}
Line = Null;
for( i = 2; i < BarCount; i++ )
{
if( trend > 0 )
{
if( High[ i ] >= Hh )
{
Hh = High[ i ];
Lhb = i;
Curline = LineArray( Llb, Ll, Lhb, Hh );
Line = IIf( IsNull( CurLine ), Line, CurLine );
}
else
if( Low[ i ] < Hh - Hh * HLPivot[ i ] )
{
Ll = Low[ i ];
Llb = i;
trend = -1;
CurLine = LineArray( Lhb, Hh, Llb, Ll );
Line = IIf( IsNull( CurLine ), Line, CurLine );
}
}
else
{
if( Low[ i ] <= Ll )
{
Ll = Low[ i ];
Llb = i;
CurLine = LineArray( Lhb, Hh, Llb, Ll );
Line = IIf( IsNull( CurLine ), Line, CurLine );
}
else
if( High[ i ] > Ll + Ll * HLPivot[ i ] )
{
Hh = High[ i ];
lhb = i;
trend = 1;
CurLine = LineArray( Llb, Ll, Lhb, Hh );
Line = IIf( IsNull( CurLine ), Line, CurLine );
}
}
}
Plot( Line, "", colorBlueGrey, styleThick );
Plot( Close, Date()+ " Close", colorDefault, styleCandle );
code is as follows
ZZPercent = Param("ZZPercent", 5 );
ATRPeriod = Param("ATRPeriod", 5 );
ATRFactor = Param("ATRFactor", 1.5, 0, 5 );
HLPivot = ZZPercent * 0.01 + ATRFactor * ATR( ATRPeriod )/Close;
Ll = Low[ 0 ];
Hh = High[ 0 ];
Llb = Lhb = 0;
if( High[ 1 ] >= Hh )
{
Hh = High[ 1 ];
Lhb = trend = 1;
}
else
{
Ll = Low[ 1 ];
Llb = 1;
trend = -1;
}
Line = Null;
for( i = 2; i < BarCount; i++ )
{
if( trend > 0 )
{
if( High[ i ] >= Hh )
{
Hh = High[ i ];
Lhb = i;
Curline = LineArray( Llb, Ll, Lhb, Hh );
Line = IIf( IsNull( CurLine ), Line, CurLine );
}
else
if( Low[ i ] < Hh - Hh * HLPivot[ i ] )
{
Ll = Low[ i ];
Llb = i;
trend = -1;
CurLine = LineArray( Lhb, Hh, Llb, Ll );
Line = IIf( IsNull( CurLine ), Line, CurLine );
}
}
else
{
if( Low[ i ] <= Ll )
{
Ll = Low[ i ];
Llb = i;
CurLine = LineArray( Lhb, Hh, Llb, Ll );
Line = IIf( IsNull( CurLine ), Line, CurLine );
}
else
if( High[ i ] > Ll + Ll * HLPivot[ i ] )
{
Hh = High[ i ];
lhb = i;
trend = 1;
CurLine = LineArray( Llb, Ll, Lhb, Hh );
Line = IIf( IsNull( CurLine ), Line, CurLine );
}
}
}
Plot( Line, "", colorBlueGrey, styleThick );
Plot( Close, Date()+ " Close", colorDefault, styleCandle );