Могу предложить код модифицированного НА в формате Easy Language
Функция $ModHAValue
Inputs: CompBars(numericsimple), oOpenVal(numericref), oCloseVal(numericref);
Vars: haClose(0), haOpen(0), haHigh(0), haLow(0), Index(0), UpVal(1), DownVal(2), 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
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;
oOpenVal = haOpen;
oCloseVal = haClose;
$ModHAValue = Return;
И сам PaintBar
Inputs: UpColor(green), DnColor(red), WarnColor(yellow), MinCompBars(0), MaxCompBars(6);
Vars: haClose(0), haOpen(0), haMinDir(0), haMaxDir(0), Color(0);
haMinDir = $ModHAValue(MinCompBars, haOpen, haClose);
haMaxDir = $ModHAValue(MaxCompBars, haOpen, haClose);
if haMinDir = 1 and haMaxDir = 1 then
Color = UpColor
else if haMinDir = 2 and haMaxDir = 2 then
Color = DnColor
else
Color = WarnColor;
PlotPB(haOpen,haClose, "ModHA2", Color);
SetPlotWidth(1,1);
SetPlotColor(1,color);