Try this:
while (n<f){
if (haOpen[i] <= Max(haOpen[i-n],haClose[i-n]) AND
haOpen[i] >= Min(haOpen[i-n],haClose[i-n]) AND
haClose[i] <= Max(haOpen[i-n],haClose[i-n]) AND
haClose[i] >= Min(haOpen[i-n],haClose[i-n])){
temp[i] = n;
}else{
temp[i] = 0;
}
}
// Re-read help files regarding use of arrays inside of for, while, do,
etc. loops.
-- Keith
razepy wrote:
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 );
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
SPONSORED LINKS
YAHOO! GROUPS LINKS
|