HELP with Heiken ash candle

 

Hi,

 My void on  tick HA function looks like this

   

//heiken ashi function

double haOPEN = iCustom(NULL,0,"Heiken Ashi",Red,White,Red,White,2,0);

double haCLOSE = iCustom(NULL,0,"Heiken Ashi",Red,White,Red,White,3,0);

I want the ea to sell when the HA candle is red and buy when the HA candle is white.

 

I've used this statement: 

  if( haOPEN < haCLOSE) then buy

 if ( haOPEN > haCLOSE) then sell.

 

But the ea seems to open only buy orders is there something wrong?

 

Is there another way to select red or white HA candles?

 

Thanks. 

 

Forum on trading, automated trading systems and testing trading strategies


Hello,

Please use the SRC button when you post code. Thank you.


This time, I edited it for you.


 
prweza:

Hi,

 My void on  tick HA function looks like this

   

//heiken ashi function

double haOPEN = iCustom(NULL,0,"Heiken Ashi",Red,White,Red,White,2,0);

double haCLOSE = iCustom(NULL,0,"Heiken Ashi",Red,White,Red,White,3,0);

I want the ea to sell when the HA candle is red and buy when the HA candle is white.

 

I've used this statement: 

  if( haOPEN < haCLOSE) then buy

 if ( haOPEN > haCLOSE) then sell.

 

But the ea seems to open only buy orders is there something wrong?

 

Is there another way to select red or white HA candles?

 

Thanks. 

Which ha indicator are you using? Check the buffers values of it (are you checking the correct buffers numbers)
 
You should write a self documenting function instead of calling iCustom directly, see Detailed explanation of iCustom - MQL4 forum
Reason: