Coloring a portion of a candle

 

Hi 

Can anyone tell me how I can color (or highlight) a portion of the current candle on a chart?

I have code I wrote that checks for a possible run-away candle that is based on a certain number of pips

The code works except I don't know how to draw attention to that specific candle other than a message box.

Any suggestions anyone?

Thanks

Bono L

void OnTick()
{
      // check real-time candle growth based on preset pip count (maxRun)
      countPips = countPips +1;
      if (countPips > (priceOpen + maxRun)) {
         if (Total > 0) { // check for open orders
            MessageBox("This candle may be a run-away.\n\nPlease keep a close watch on it and"+
                                  "\naconsider manually closing the open position\nto minimize losses.",
                                  "POSSIBLY RUN-AWAY CANDLE",MB_ICONSTOP);
         }   
         countPips=0;                      
      }
}
 
Lode Loyens:

Hi 

Can anyone tell me how I can color (or highlight) a portion of the current candle on a chart?

I have code I wrote that checks for a possible run-away candle that is based on a certain number of pips

The code works except I don't know how to draw attention to that specific candle other than a message box.

Any suggestions anyone?

Thanks

Bono L

You can draw a OBJ_RECTANGLE on the specific area.

But creating a separate indicator is a better solution using DRAW_COLOR_CANDLE.

 
Yashar Seyyedin #:

You can draw a OBJ_RECTANGLE on the specific area.

But creating a separate indicator is a better solution using DRAW_COLOR_CANDLE.

Wow! nice idea with the drawing an object rectangle. But what do you mean by creating a separate indicator using DRAW_COLOUR_CANDLE?
 
Chioma Obunadike #:
Wow! nice idea with the drawing an object rectangle. But what do you mean by creating a separate indicator using DRAW_COLOUR_CANDLE?

https://www.mql5.com/en/docs/customind/indicators_examples/draw_color_candles

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