Background Chart Colour

 

Hi

I have the attached indicator, but have been unable to get hold of the clever programmer.

The indicator will change your chart back ground colour based on the price to open of the

current candle.  I have played around with it, but have been unable to make it default to

the daily candle no matter what time frame you are trading.   If anyone can point me in

the right direction that would be great.

Regards

Kate

xx 

Files:
ChgBg.mq4  2 kb
 
kate682:

Hi

I have the attached indicator, but have been unable to get hold of the clever programmer.

The indicator will change your chart back ground colour based on the price to open of the

current candle.  I have played around with it, but have been unable to make it default to

the daily candle no matter what time frame you are trading.   If anyone can point me in

the right direction that would be great.

Regards

Kate

xx 

Hi

You can do so:

#property indicator_chart_window
                 
int start()
{
   color clr;

   if ( iClose( NULL, 1440, 0 ) > iOpen( NULL, 1440, 0 ) )        clr = LavenderBlush;
   else if ( iClose( NULL, 1440, 0 ) < iOpen( NULL, 1440, 0 ) )   clr = AliceBlue;
   else                                                           clr = White; 

   ChartSetInteger( 0, CHART_COLOR_BACKGROUND, clr );

   return (0);
}

or as:

#property indicator_chart_window

int deinit()
{
   ObjectDelete( "lblChgBg" );
   return(0);
}
                   
int start()
{
   color clr;

   if ( iClose( NULL, 1440, 0 ) > iOpen( NULL, 1440, 0 ) )        clr = LavenderBlush;
   else if ( iClose( NULL, 1440, 0 ) < iOpen( NULL, 1440, 0 ) )   clr = AliceBlue;
   else                                                           clr = White; 

   if ( ObjectFind( "lblChgBg" ) == -1 )   ObjectCreate( "lblChgBg", OBJ_LABEL, 0, 0, 0 );      
   ObjectSet      ( "lblChgBg", OBJPROP_XDISTANCE,        0 );
   ObjectSet      ( "lblChgBg", OBJPROP_YDISTANCE,        0 );  
   ObjectSet      ( "lblChgBg", OBJPROP_CORNER,           0 );    
   ObjectSet      ( "lblChgBg", OBJPROP_BACK,          true );    
   ObjectSetText  ( "lblChgBg", "ggg", 600, "Webdings", clr );

   return (0);
}

 OK?

 
Fillellin:

Hi

You can do so:

or as:

 OK?

Dear Fillellin

Many thanks for helping me out with this, it's perfect (have just changed the colours round, as my bias is long above open, and short below open.

If there is anything I can help you with, i'd be delighted.  

Thanks again

Kate

 

twitter  @kate682 

 
kate682:

Dear Fillellin

Many thanks for helping me out with this, it's perfect (have just changed the colours round, as my bias is long above open, and short below open.

If there is anything I can help you with, i'd be delighted.  

Thanks again

Kate

 

twitter  @kate682 

Forget it!

Don't mention it!