Whats wrong with this one line of code, anyone..

 

Hi,

I am trying to create an EA based on Heiken Ashi bars. The logic is quite simple: To check the last bar, if it is the same colour as the current(open) bar, then open 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. 

Heiken-Ashi
Heiken-Ashi
  • votes: 10
  • 2010.01.26
  • MetaQuotes Software Corp.
  • www.mql5.com
The Heiken-Ashi indicator is looks like the candlestick chart, but it has some difference.The advantage of the Heiken-Ashi charts is a simple trend determination, the upward trend candles are blue,the downward trend candles are red.
 
davefx:

Hi,

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

Any help would be most appreciated. 

Dave. 

Hi davefx,

Is this mql4 or mql5 ?. Click here for iCustom for mql4 and click here for iCustom for mql5. On both mql4 and mql5 the first 4 parameter is Symbol, Period, the name of indicator and its input parameters. Furthermore using iCustom in mql4, we need to specify buffer and bar index and you should ask this in mql4 forum, in mql5 we just use CopyBuffer() after calling iCustom.

If it is mql4, Heikin Ashi in MT4 has 4 extern input, and they are ...

extern color color1 = Red;
extern color color2 = White;
extern color color3 = Red;
extern color color4 = White;

 and so you have to write the value of those extern input as iCustom parameters, for example ...

iCustom(Symbol(), Period(), "Heiken_Ashi", Blue, Brown, Black, Beige, 2,0);

In mql5 Heikin Ashi does not have extern input. We initialize iCustom in OnInit() and use CopyBuffer() click that to get its data. See the example in here https://www.mql5.com/en/docs/indicators/icustom.

Ask again later if you have more Qs.

 

iCustom - MQL4 Documentation
  • docs.mql4.com
iCustom - MQL4 Documentation
Reason: