how to color a specific candle given certain criteria?

 

In my ea, i need to color a specific candle should it meet certain criteria. I have basic understanding of mql5.

I have written the following and feel like i'm either not understanding something here or making a mistake. 

In the OnTick() section...

double close[];
ArraySetAsSeries(close,true);
CopyClose(_Symbol,_Period,0,3,close);

if((close[1] > close[2]) && (/*other criteria*/))
{
//color a specific candle
  PlotIndexSetInteger(0,PLOT_LINE_COLOR,0,clrBlack); //not sure if this is right to color a candle
}
 
Hishal Vallabh :

In my ea, i need to color a specific candle should it meet certain criteria. I have basic understanding of mql5.

I have written the following and feel like i'm either not understanding something here or making a mistake. 

In the OnTick() section...

To color candles - you must use an indicator, not an advisor.

 
Vladimir Karputov #:

To color candles - you must use an indicator, not an advisor.

ok. thought as much. thanks
 
Hishal Vallabh # :
ok. thought as much. thanks

I recommend using the DRAW_COLOR_CANDLES  style.

Documentation on MQL5: Custom Indicators / Indicator Styles in Examples / DRAW_COLOR_CANDLES
Documentation on MQL5: Custom Indicators / Indicator Styles in Examples / DRAW_COLOR_CANDLES
  • www.mql5.com
DRAW_COLOR_CANDLES - Indicator Styles in Examples - Custom Indicators - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Vladimir Karputov #:

I recommend using the DRAW_COLOR_CANDLES  style.

Appreciate the link to the docs. Will read through it. Thank you 
Reason: