Foreign function combine with low level grapic

Hello,

I try to make a rectangle using low level graphic, then the color of the rectangle should change if the index (DJI) is above ma200 its green, if below ma200 its red. Thats all I want to do, but the gfx wants to use boolean not array, so I change the code like below, but its still not working. Can somebody help? thanks

pxchartbottom = Status("pxchartbottom" );
pxchartleft = Status("pxchartleft" );

djiClose = Foreign( "dji", "C" );
MAdji=MA(djiClose,200);

minup=0;
IIf(djiclose>madji,minup==1,minup==0); 

GfxSetZOrder(1);

if
(minup==1)
GfxSelectSolidBrush( colorGreen )
+GfxRectangle ( pxchartleft+800, pxchartbottom, pxchartleft+900, pxchartbottom-25  ) 
+GfxTextOut( "MINI",pxchartleft+825,pxchartbottom-5);

else
{
GfxSelectSolidBrush( colorRed )
+GfxRectangle ( pxchartleft+800, pxchartbottom, pxchartleft+900, pxchartbottom-25  ) 
+GfxTextOut( "MINI",pxchartleft+825,pxchartbottom-5);
}

o yes, I tried to search the forum for example. but can not find one....
Capture%20index

You are doing couple of mistakes listed here:
http://www.amibroker.com/guide/a_mistakes.html

1 Like

Thanks Tomasz,

I can do it now, the logic is very messed up. but its done now