Rather than handing you the answer, I'd like you to learn how to do this. Everything you need to know is in the following code from that indicator:
//--- indicator buffers mapping SetIndexBuffer(0,ExtOBuffer,INDICATOR_DATA); SetIndexBuffer(1,ExtHBuffer,INDICATOR_DATA); SetIndexBuffer(2,ExtLBuffer,INDICATOR_DATA); SetIndexBuffer(3,ExtCBuffer,INDICATOR_DATA);
and.....
//--- set first candle ExtLBuffer[0]=Low[0]; ExtHBuffer[0]=High[0]; ExtOBuffer[0]=Open[0]; ExtCBuffer[0]=Close[0];
:)
Rather than handing you the answer, I'd like you to learn how to do this. Everything you need to know is in the following code from that indicator:
and.....
:)
Thanks for your helpful reply . After checking your answer against the Heiken Ashi indicator mq4 code, i confirmed that
buffer 2 represents open ,while buffer 3 represents close. but i am still confused about buffers 0 and 1 , the Heiken Ashi indicator code
says 0 = Low/High ,and 1 = High/Low ,
SetIndexBuffer(0,ExtLowHighBuffer);
SetIndexBuffer(1,ExtHighLowBuffer);
looking further down the code , i understand that the buffers for High and Low values can inter-change depending on the color of the candle.
if(haOpen<haClose)
{
ExtLowHighBuffer[i]=haLow;
ExtHighLowBuffer[i]=haHigh;
}
else
{
ExtLowHighBuffer[i]=haHigh;
ExtHighLowBuffer[i]=haLow;
Why is that so ?
Because buffers 0 and 1, only important to describe the high and low Heiken Ashi candlestick indicator bar itself.
Heiken Ashi using Open price (haOpen) based Open [i-1]+Close [i-1] (Open plus Close of the 2 bar before) divided by 2.
Meanwhile Close price (haClose) based PRICE_WEIGHTED previous bar (bar i). HA using pos=1 (for i=pos; etc).
In the normal price quotes, PRICE_WEIGHTED previous bar is equal to the Open[0].
The logic of the Heiken Ashi is if haOpen smaller than haClose, then the price goes up, and vice versa.
Easiest way to determine indicator buffer meaning is to drop indicator on the chart, then open "Data Window" and examine values. Data window can be opened from View menu or by pressing "ctrl-D".
This is Data Window with only Heikin Ashi indicator:
Last four values are Heikin Ashi values. They are ordered by the buffer index number - from 0 to 3.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi guys ,
Please i need help with contents for my Heiken Ashi candles EA .
I have the functions below,
I want to know the one that represents Open , Close , High and Low.
Expecting your helpful reply .
Thanks.