You can just use the calculation itself.
It's in the indicator.
pekele4u: how can i get the color of Heiken Ashi, that is if it is white(buy) or red(sell) using iCustom function.
- There are no colors in iCustom, only values. If the close is above the open it's white, otherwise it's not. Was that so hard? When in doubt, think.
- Just get the value(s) of the indicator(s) into the EA (using iCustom) and do what you want with it.
You should encapsulate your iCustom calls to make your code self-documenting.
Detailed explanation of iCustom - MQL4 and MetaTrader 4 - MQL4 programming forum - Example
//{ Typedefs #define PRICE double // A PRICE #define PRICE_MAX (PRICE)EMPTY_VALUE #define PRICE_MIN (PRICE)0 #define CHANGE PRICE // Difference of two prices. #define INDEX uint // Zero based. #define INV_INDEX UINT_MAX #define COUNT uint // One based. #define INV_COUNT UINT_MAX #define MONEY double #define SYMBOL string //} Typedefs //+------------------------------------------------------------------+ //| 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); } //+------------------------------------------------------------------+ ⋮ PRICE ho = Heiken_Ashi(HA_OPEN, 1), hc = Heiken_Ashi(HA_CLOSE, 1); bool isWhite = hc > ho;
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
Please how can i get the color of Heiken Ashi, that is if it is white(buy) or red(sell) using iCustom function.
Thanks in advance.