[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

heikin ashi problem



PureBytes Links

Trading Reference Links

modified Heikin-Ashi technique

compares current bar open to close range
with prior bars...if current is within on of the 6
prior bars then color remains the same

there is a problem with the while loop
thanks for help




f=7;
 
HaClose = (O+H+L+C)/4;

HaOpen[ 0 ] = O[ 0 ]; 
for( j = 1; j < BarCount; j++ ) 
{ HaOpen[ j ] = 0.5 * HaClose[ j-1 ] + 0.5 * HaOpen[  j - 1 ]; } 
color=IIf (haClose > haOpen, colorGreen,colorRed);

 for( i = f; i < BarCount; i++ ) 
{
n=0;
while (n<f)
{
 temp=   IIf (haOpen <= Max(haOpen[i-n],haClose[i-n]) AND
    haOpen >= Min(haOpen[i-n],haClose[i-n]) AND
    haClose <= Max(haOpen[i-n],haClose[i-n]) AND
    haClose >= Min(haOpen[i-n],haClose[i-n]),
    N
,0);	
n++;
	} 
} 
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) );
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "Modified " + Name(), temp,
styleCandle );