# take candle color hekin ashi

118

Good evening to everyone, I'm desperate. I need to take the color of the candle (heikin ashi), how can I do?
20228

Detailed explanation of iCustom - MQL4 and MetaTrader 4 - MQL4 programming forum

```#define  PRICE double            // A PRICE
//+------------------------------------------------------------------+
//| 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 haOpen  = Heiken_Ashi(HA_OPEN, 1);
PRICE haClose = Heiken_Ashi(HA_CLOSE, 1);
bool  upCandle  = haClose > haOpen;```
118

whroeder1:
Detailed explanation of iCustom - MQL4 and MetaTrader 4 - MQL4 programming forum

with this code the color of the candle where it is stored?

20228

There is no color. Only up and down candles.
38701

Alessandro Iovine:
118

okok thank you very much. so if I want to open an order when after a red candle there is a green candle, I can not do it?
20228

There is no red candle or green candle. The colors can be changed to whatever you want. Stop thinking color. Think up or down. You've been answered three times.
160313

Alessandro Iovine:
okok thank you very much. so if I want to open an order when after a red candle there is a green candle, I can not do it?

HA close > HA open -> "green"

HA close < HA open -> "red"