Help pls

#1
can anyone convert this code to AMI afl ,thnks a lots.

nputs:VL(20);
vars: intrabarpersist TUVol(0), intrabarpersist TDVol(0),
intrabarpersist TUpTicks(0), intrabarpersist TDownTicks(0),
intrabarpersist TPreTime_s(0), intrabarpersist TTime_s(0),
TColor(0);

if LastBarOnChart_s then begin
TPreTime_s = TTime_s;
TTime_s = BarNumber;

if TPreTime_s <>TTime_s then begin
TUVol = 0;
TDVol = 0;

end;
//==============================

if UpTicks-TUpTicks >= VL then TUVol =TUVol+ UpTicks-TUpTicks ;
if DownTicks-TDownTicks >= VL then TDVol =TDVol +DownTicks-TDownTicks ;
if TUVol>TDVol then TColor = red else TColor = green;
TUpTicks = UpTicks;
TDownTicks = DownTicks;