Heikin Ashi calculations... how do I get the high/low/close/open
Well, it seems this was best handled through the actual indicator itself. I apparently don't understand how and where to use the index buffer features, but I was able to get the needed values by doing the following...:
int start() {
double HAOpen, HAClose, HAHigh, HALow;
HAHigh = NormalizeDouble(iCustom(NULL, 0, "Heiken Ashi", 0, 0), Digits);
HALow = NormalizeDouble(iCustom(NULL, 0, "Heiken Ashi", 1, 0), Digits);
HAOpen = NormalizeDouble(iCustom(NULL, 0, "Heiken Ashi", 2, 0), Digits);
HAClose = NormalizeDouble(iCustom(NULL, 0, "Heiken Ashi", 3, 0), Digits);
Comment("Testing HA Candles...\n\n" +
"Close: " + HAClose + "\n" +
"Open : " + HAOpen + "\n" +
"High : " + HAHigh + "\n" +
"Low : " + HALow + "\n");
return(0);
}
double HAOpen, HAClose, HAHigh, HALow;
HAHigh = NormalizeDouble(iCustom(NULL, 0, "Heiken Ashi", 0, 0), Digits);
HALow = NormalizeDouble(iCustom(NULL, 0, "Heiken Ashi", 1, 0), Digits);
HAOpen = NormalizeDouble(iCustom(NULL, 0, "Heiken Ashi", 2, 0), Digits);
HAClose = NormalizeDouble(iCustom(NULL, 0, "Heiken Ashi", 3, 0), Digits);
Comment("Testing HA Candles...\n\n" +
"Close: " + HAClose + "\n" +
"Open : " + HAOpen + "\n" +
"High : " + HAHigh + "\n" +
"Low : " + HALow + "\n");
return(0);
}
Hello,
Is there anything out there that can get me the current Heikin Ashi candles high/low/close/open?
I wrote the following script, but I am getting a stack over flow, most likely due to the recursive calls of the candles. Any thoughts or ideas on how I can tackle this one?
int start() {
Print("Testing HA Candles...\n\n" +
"Close: " + HAClose() + "\n" +
"Open : " + HAOpen() + "\n" +
"High : " + HAHigh() + "\n" +
"Low : " + HALow() + "\n");
return(0);
}
double HAClose(int period = 0)
{
double close;
close = (Open[period] + High[period] + Low[period] + Close[period])/4;
return(close);
}
double HAOpen(int period = 0)
{
double open;
open = (HAOpen(period+1) + Close[period+1])/2;
return(open);
}
double HAHigh(int period = 0)
{
double high;
high = MathMax(High[period], HAOpen(period));
high = MathMax(high, HAClose(period));
return(high);
}
double HALow(int period = 0)
{
double low;
low = MathMin(Low[period], HAOpen(period));
low = MathMin(low, HAClose(period));
return(low);
}