Hello
I tried to make dashboard to display daily %change.
I wanted in the below code to change of current price to either red or green depends on its current value to yesterday closing price.
Problem is it does not change its color for every symbol.
There is a easy way to do it?
Thanks.
SetForeign("XXXXX");
TimeFrameExpand(inDaily,-1);
XXXXX= Prec((C-Ref(C,-1))*100/Ref(C,-1),2);
RestorePriceArrays();
SetForeign("YYYYY");
TimeFrameExpand(inDaily,-1);
YYYYY= Prec((C-Ref(C,-1))*100/Ref(C,-1),2);
RestorePriceArrays();
_SECTION_BEGIN("Dashboard");
procedure DrawData (Text, x1, y1, x2, y2, boxcolor, FontSize)
{
GfxSetOverlayMode(0);
GfxSelectFont("Segoe UI", FontSize, 600);
GfxSetBkMode(1);
GfxSelectSolidBrush( Boxcolor);
GfxRoundRect( x1, y1, x2, y2, 7, 7 );
GfxDrawText(Text, x1, y1, x2, y2, 32|0|4|16);
}
Rise=LASTValue(XXXXX>0);
Fall=LASTValue(XXXXX<0);
Color=IIf(rise,colorGreen,IIf(Fall,colorRed,colorTan));
GfxSetTextColor(colorWhite);
Rise1=LASTValue(YYYYY>0);
Fall1=LASTValue(YYYYY<0);
Color1=IIf(rise1,colorGreen,IIf(Fall1,colorRed,colorTan));
X0 = 10;
Y0 = 100;
DrawData ("XXXXX" +"", X0, Y0, X0+150, Y0+50, color, 24);
DrawData (" ("+XXXXX+"%) ", X0+155, Y0, X0+300, Y0+50, color, 24);
X0 = 10;
Y0 = 160;
DrawData ("YYYYY" +"", X0, Y0, X0+150, Y0+50, color1, 24);
DrawData (" ("+YYYYY+"%) ", X0+155, Y0, X0+300, Y0+50, color1, 24);