Code: Select all
// "Smoothed Heiken Ashi Candles"
Inputs:
len(10),
len2(10);
Variables:
openc(o),
closec(0),
highc(0),
lowc(0),
haclose(0),
haopen(0),
hahigh(0),
halow(0),
o2(0),
c2(0),
h2(0),
l2(0);
openc = XAverage(open,len);
closec = XAverage(close,len);
highc = XAverage(high,len);
lowc = XAverage(low,len);
haclose = (o+h+l+c)/4;
haopen = iff (haopen[1])
(o + c)/2 else (haopen[1] + haclose[1]) / 2;
hahigh = max (h, max(haopen,haclose));
halow = min (l, min(haopen,haclose));
o2 = XAverage(haopen, len2);
c2 = XAverage(haclose, len2);
h2 = XAverage(hahigh, len2);
l2 = XAverage(halow, len2);
//col=o2>c2 ? red : lime
//plotcandle(o2, h2, l2, c2);
plot1(o2, h2, l2, c2, "Smoothed Candles");