Search for EAs that are using it - there is practically nothing that does not exist for MT4/5
- Bullish is when the close is above the open.
- You should encapsulate your
iCustom calls to make your code self-documenting.
Detailed explanation of iCustom - MQL4 and MetaTrader 4 - MQL4 programming forum#define PRICE double // A PRICE #define INDEX uint // Zero based. #define COUNT uint // One based. #define MONEY double #define SYMBOL string //+------------------------------------------------------------------+ //| Heiken Ashi iCustom function | //+------------------------------------------------------------------+ enum HAbuffer{ HA_LOW_HIGH, HA_HIGH_LOW, HA_OPEN, HA_CLOSE, HA_BOTTOM, HA_TOP }; PRICE Heiken_Ashi(HAbuffer buf, INDEX iBar){ return Heiken_Ashi(_Symbol, ENUM_TIMEFRAMES(_Period), buf, iBar); } PRICE Heiken_Ashi(ENUM_TIMEFRAMES tf, HAbuffer buf, INDEX iBar){ return Heiken_Ashi(_Symbol, tf, buf, iBar); } PRICE Heiken_Ashi(SYMBOL sym, ENUM_TIMEFRAMES tf, HAbuffer buf, INDEX iBar){ #define HA "Heiken Ashi" if(buf < HA_BOTTOM) return iCustom(sym, tf, HA, // All four parameters are just colors buf, iBar); PRICE lh = iCustom(sym, tf, HA, HA_LOW_HIGH, iBar); PRICE hl = iCustom(sym, tf, HA, HA_HIGH_LOW, iBar); return HA_BOTTOM == buf ? MathMin(lh, hl) : MathMax(lh, hl); }
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hey guys,
I am trying to implement Heiken Ashi candles in my EA and I can't seem to make the iCustom function work properly... From what I understood, I should use these lines from the indicator code in order to select the mode I am looking forward to use in my EA...
I would like to write a specific function that would detect if the body of the candle is Bullish or Bearish. I tried a couple of different things and I cannot make the EA properly identify what the type/color of current candle (Bullish vs Bearish)...
Any ideas?
Thank you very much!