AB GfxSetTextColor Help Please

#1
Hi All,

With the following Code I would like to use different colors for Close And Open, For Example I would like to use red color for close "IF CLOSE LOWER THAN OPEN" and Green color "IF CLOSE HIGHER THAN OPEN".

PHP:
_SECTION_BEGIN( "Chart" );

		RequestTimedRefresh( 0 );
		SetChartBkColor(ColorRGB( 31, 52, 61 )); 
		Plot( C, "", colorLightYellow, styleBar );

		jj = c > O;

		UpColor = colorgreen;
		DownColor = colorred;

		GfxSelectFont( "Arial", 8, 700 ); 
		GfxSetBkMode( 1 );
		GfxSetTextColor( colorWhite ); 

//		GfxSetTextColor( iif(jj, UpColor, DownColor); This is the line I try to modify BUT I get an error..

		GfxSelectSolidBrush( ColorRGB( 31, 72, 61 ) );
		
		pxHeight = Status( "pxchartheight" ) ;

		//---------- HIGH ----------
		OP = "HIGH    :  " + H; 
		x = 20;
		//---------- OPEN ----------
		HI = "OPEN   :  " + O; 
		x2 = 20;
		//---------- CLOSE ---------
		LO = "CLOSE :  " + C; 
		x3 = 20;
		//---------- LOW -----------
		CL = "LOW     :  " + L; 
		x4 = 20;
		//--------------------------

		y = pxHeight;

		GfxSelectPen( colorBrightGreen, 0.5 );
		GfxRoundRect( 5, y - 93, 120, y , 7, 7 ) ;

		GfxTextOut( OP  , x , y -81) ;
		GfxTextOut( HI  , x2, y -63) ;
		GfxTextOut( LO  , x3, y -45) ;
		GfxTextOut( CL  , x4, y -27) ;

_SECTION_END();
hopefully I get some assistance from professional coder here...

Regards
 

KelvinHand

Well-Known Member
#2
Hi,

Try this:

_SECTION_BEGIN( "Chart" );

RequestTimedRefresh( 0 );
SetChartBkColor(ColorRGB( 31, 52, 61 ));
Plot( C, "", colorLightYellow, styleBar );

UpColor = colorGreen;
DownColor = colorRed;

GfxSelectFont( "Arial", 8, 700 );
GfxSetBkMode( 1 );
GfxSetTextColor( colorWhite );

// GfxSetTextColor( iif(jj, UpColor, DownColor); This is the line I try to modify BUT I get an error..

GfxSelectSolidBrush( ColorRGB( 31, 72, 61 ) );

pxHeight = Status( "pxchartheight" ) ;

//---------- HIGH ----------
OP = "HIGH : " + H;
x = 20;
//---------- OPEN ----------
HI = "OPEN : " + O;
x2 = 20;
//---------- CLOSE ---------
LO = "CLOSE : " + C;
x3 = 20;
//---------- LOW -----------
CL = "LOW : " + L;
x4 = 20;
//--------------------------

y = pxHeight;

GfxSelectPen( colorBrightGreen, 0.5 );
GfxRoundRect( 5, y - 93, 120, y , 7, 7 ) ;

GfxTextOut( OP , x , y -81) ;
GfxTextOut( HI , x2, y -63) ;
GfxTextOut( LO , x3, y -45) ;

//-- :p ----
bi = BarIndex();
ii = SelectedValue( bi ) - bi[ 0 ];
if (C[ii]>O[ii])
GfxSetTextColor(colorGreen);
else
GfxSetTextColor(colorRed);
//--:p ---------------

GfxTextOut( CL , x4, y -27) ;

_SECTION_END();
 

Similar threads