MT4: A little problem with Heiken Ashi Ea I am trying to code..

 

Hi,

I am trying to create an EA based on Heiken Ashi bars. The logic is quite simple: To check the last HA bar, if a new bar opens as the same colour as the bar that just closed, then open a trade.. But I cannot get it working.. Any ideas folks..

void TechnicalAnalysis2()
{
    if (iCustom(NULL, NULL, "Heiken_Ashi",2,0) == iCustom(NULL, NULL, "Heiken_Ashi",2,1))
    {
        SellOrder4();
        
    }
}

Any help would be most appreciated.

Dave.

 
the Heiken Ashi is an MQ5
 

Hi davefx,

Try this :

void TechnicalAnalysis2()
{
 double a, b;

 a = iCustom(NULL, NULL, "Heiken_Ashi",2,0);
 Print ("a is ", DoubleToStr(a, Digits), " err ", GetLastError());
 b =  iCustom(NULL, NULL, "Heiken_Ashi",2,1);
 Print ("b is ", DoubleToStr(b, Digits), " err ", GetLastError());
 
 if (a == b)
    {
    SellOrder4();
    Print ("Sell");
    }
}

what the Print says ?!?!

And www.google.com/search?q=iCustom Heiken Ashi site:forum.mql4.com

pssstttt : Hope mod help too.