|
发表于 2008-12-14 08:05 PM
|
显示全部楼层
回复 40# biorjin 的帖子
#function fModHAKahuna
Inputs:
CompBars(numericsimple),
oOpenVal(numericref), {Output: HA Open Price}
oCloseVal(numericref) {Output: HA Close Price}
;
Vars:
haClose(0),
haOpen(0),
haHigh(0),
haLow(0),
Index(0),
UpVal(1), {Constant: Up haDir value}
DownVal(2), {Constant: Down haDir value}
Return(0);
if BarNumber = 1 then
begin
haOpen = open;
haClose = (O+H+L+C)/4;
haHigh = MaxList( high, haOpen, haClose);
haLow = MinList( low, haOpen, haClose);
end
else {BarNumber > 1 }
begin
haClose = (O+H+L+C)/4;
haOpen = (haOpen[1] + haClose[1])/2 ;
haHigh = MaxList(High, haOpen, haClose) ;
haLow = MinList(Low, haOpen, haClose) ;
if haClose > haOpen then
Return = UpVal
else
Return = DownVal;
for Index = 1 to CompBars
begin
if haOpen <= MaxList(haOpen[Index],haClose[Index]) and
haOpen >= MinList(haOpen[Index],haClose[Index]) and
haClose <= MaxList(haOpen[Index],haClose[Index]) and
haClose >= MinList(haOpen[Index],haClose[Index]) then
Return = Return[Index];
end;
end;
{Load Output Values}
oOpenVal = haOpen;
oCloseVal = haClose;
fModHAKahuna = Return; |
|