Can I change individual candle colors from the EA ?

 
Can the individual candle colors be changed or only for the entire chart ? 

My attempt here:
void bullish_engulfing_candle()
   {
   for (int i=1; i<=50 ; i++)
      {
      if(Close[i+1] >= Open[i+1] && Close[i] < Open[i] && Close[i+1]-Open[i+1] < Open[i]-Close[i]) 
      ChartSetInteger(NULL,CHART_COLOR_CANDLE_BULL,clrGreen);
      else ChartSetInteger(NULL,CHART_COLOR_CANDLE_BULL,clrBlack);;
      }
    }
Please advise, thanks

https://docs.mql4.com/constants/chartconstants/charts_samples#chart_color_candle_bull
Examples of Working with the Chart - Chart Constants - Constants, Enumerations and Structures - MQL4 Reference
Examples of Working with the Chart - Chart Constants - Constants, Enumerations and Structures - MQL4 Reference
  • docs.mql4.com
Examples of Working with the Chart - Chart Constants - Constants, Enumerations and Structures - MQL4 Reference
 
Agent86: Can the individual candle colors be changed or only for the entire chart ?

https://docs.mql4.com/constants/chartconstants/charts_samples#chart_color_candle_bull

The functionality you are using in your code will affect the entire chart, both on MT4 and MT5. Neither on MT4 nor MT5 can you control candle's individual colours.

You can however, "draw" over a candle with your own colour scheme, using Graphical Objects, or "Histogram" indicator plot, and on MT5 only, you can also use the "Candle" indicator plot.

 
Fernando Carreiro #:

The functionality you are using in your code will affect the entire chart, both on MT4 and MT5. Neither on MT4 nor MT5 can you control candle's individual colours.

You can however, "draw" over a candle with your own colour scheme, using Graphical Objects, or "Histogram" indicator plot, and on MT5 only, you can also use the "Candle" indicator plot.

Thanks, 

I didn't consider overlaying a Graphical Object over top of the chart candle. That's a good idea thanks

If I understand your response, I assume this cannot be achieve by creating an indicator to paint individual candles either except as you described above ?

Please confirm
Thanks 

 
Agent86 #: If I understand your response, I assume this cannot be achieve by creating an indicator to paint individual candles either except as you described above ?

You can in a way. It depends on how "creative" you can be with your coding. That is how most Heikin Ashi indicators work.

The following code uses "DRAW_HISTOGRAM" on MT4, and "DRAW_COLOR_CANDLES" on MT5, to do just that ...

Code Base

Dōteki Heikin Ashi (Dynamic Average Foot/Bar)

Fernando Carreiro, 2018.10.15 17:08

A dynamic version of the standard Heikin Ashi indicator (code compatible with both MQL4 or MQL5).