Rectangle GFXrectangle

Hy everyone, i need to draw a rectangle on the rigth of the chart from low or max of the day depends on my condition. The GFXRectangle works but don't permit the condition IIF so i must switch manually.
thi is my formula now

GfxSelectPen(colorgreen, 2, 1);
GfxSelectSolidBrush( ColorRGB(0, 0, 0 ) );
i = Barcount;
//GfxRectangle(i+20, phdoggi,i+25,phdoggi-rangeday);//if trend is down i switch this
GfxRectangle(i+23, pldoggi,i+25,pldoggi+rangeday);// if trend is up i switch this

gfx support only number , how i can? thnaks

For something to try, if trend is an array, LastValue() returns a number.

good job. very thanks