{
suri.HACandles
Original Code posted by SOLIDUS
Nov. 05, 07:
Heikin-Ashi Method of Candles by deMicron (Suri Duddella)
http://www.surinotes.com
}
inputs: UPcolor(green), DNcolor(red), WICKcolor(black), WICKwidth(1), BODYwidth(3);
variables:
color(0),
BodySize(iff(bodywidth=2, 1, iff(bodywidth>4, 4, bodywidth) )),
Outline(iff(bodysize=0, 2, iff(bodysize=1, 3, iff(bodysize=3, 4, 5))) ),
colorU(UPcolor),
colorD(DNcolor),
colorW(WICKcolor) ;
vars: haClose(0),haOpen(0),haHigh(0),haLow(0), CandleColor(0), CompBars(3);
Var: DateC(0), TimeC(0),
bOpen(0),bClose(0),bHigh(0),bLow(0);
{ Outlined Candles by Solidus
pixel sizes of plot widths
0 - 1px
1 - 2
2 - 3
3 - 4
4 - 6
5 - 8
6 - 14
}
{ ------------------------- Revision 1 Aug 15 07 ------------------------------
- Simplified coloring code for efficiency.
- Removed Once command to permit use with pre-8.2 Tradestation.
- Added efficiency fix so RGB color values as inputs need only calculate once on startup.
}
// Heikin-Ashi Candles by Suri Duddella (deMicron)
if BarNumber = 1 then
begin
haOpen = open;
haClose = (O+H+L+C)/4;
haHigh = MaxList( high, haOpen, haClose);
haLow = MinList( low, haOpen,haClose);
end;
if BarNumber > 1 then
begin
haClose = (O+H+L+C)/4;
// haClose = (H+L+C)/3;
haOpen = (haOpen [1] + haClose [1])/2 ;
haHigh = MaxList(High, haOpen, haClose) ;
haLow = MinList(Low, haOpen, haClose) ;
if haClose > haOpen then
Candlecolor = ColorU
else
Candlecolor = ColorD;
for value1 = 1 to CompBars
begin
if haOpen <= MaxList(haOpen[value1],haClose[value1]) and
haOpen >= MinList(haOpen[value1],haClose[value1]) and
haClose <= MaxList(haOpen[value1],haClose[value1]) and
haClose >= MinList(haOpen[value1],haClose[value1]) then
Candlecolor = Candlecolor[value1];
end;
bOpen = haOpen;
bClose = haClose;
bHigh = haHigh;
bLow = haLow;
end;
if bClose>bOpen then color=colorU else color=colorD;
plot1(bClose,"c outline a",colorW,0,outline);
plot2(bClose,"c outline b");
plot3(bOpen,"o outline a",colorW,0,outline);
plot4(bOpen,"o outline b");
Plot5(bClose,"C",color,0,bodysize);
Plot6(bOpen,"O");
Plot7(bClose,"C outline",colorW,0,outline);
Plot8(bOpen,"O outline");
plot9(bHigh,"H",colorW,0,WICKwidth);
plot10(bLow,"L");
|