Download MetaTrader 5

Heiken Ashi EA contents.

To add comments, please log in or register
All MQL5.community events are grouped together. Have a look at the Wall!
Asiwaju Williams Olayemi Mim
145
Asiwaju Williams Olayemi Mim 2015.02.23 21:24 

Hi guys ,

Please i need help with contents for my Heiken Ashi candles EA .

I have the functions below, 


HA1=iCustom(Symbol(),0,"Heiken Ashi",1,i);

 HA2=iCustom(Symbol(),0,"Heiken Ashi",2,i);

 HA3=iCustom(Symbol(),0,"Heiken Ashi",3,i);

 HA4=iCustom(Symbol(),0,"Heiken Ashi",4,i); 

I want to know the one that represents Open , Close , High and Low.

Expecting your  helpful reply .

Thanks.  

Stuart Browne
5819
Stuart Browne 2015.02.23 23:17  

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];

 

 :)

Asiwaju Williams Olayemi Mim
145
Asiwaju Williams Olayemi Mim 2015.02.24 02:51  
Filter:

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 ? 

Stuart Browne
5819
Stuart Browne 2015.02.24 08:40  
I never use Heiken Ashi so I can't say I'm familiar with the logic behind it sorry.
Roberto Jacobs
46476
Roberto Jacobs 2015.02.26 07:32  
In my opinion, the most important of the four buffers on Heiken Ashi indicator for EA is buffer 2 and 3 (Open and Close).
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.
Drazen Penic
2545
Drazen Penic 2015.02.27 13:31  

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.

To add comments, please log in or register