Need help in converting AFL to trade script

Hi,
I came across this AFL script created by Mr. Kamalesh Langote [http://www.vfmdirect.com/kplswing/index.html] , which is based price crossing on 20 days high/low.

_SECTION_BEGIN(“KPL Swing”);
//Save indicator as “kplswing.afl” in C: program files > Amibroker > Formulas > Custom folder and then drag and drop indicator on price window.
//Copyright Kamalesh Langote. Email:[email protected]. Visit http://www.vfmdirect.com/kplswing for latest code and updates
//You can use in indicator mode (chart) or scanner (generate buy/ sell signals).
//Risk management: do not risk more than 1% of your capital on any trade.
//Avoid trading in futures unless you are well capitalised.

no=Param( “Swing”, 20, 1, 100,1 );

res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
tsl=IIf(avn==1,sup,res);

Plot(tsl, _DEFAULT_NAME(), colorTan, styleStaircase);
arrows=Cross(C,Ref(res,-1))*shapeUpArrow + Cross(Ref(sup,-1),C)*shapeDownArrow;
PlotShapes(arrows,IIf(C>tsl,colorGreen,colorIndigo),0,IIf(Cross(C,Ref(res,-1)),Low,High));

//Scanner mode
Buy=Cross(C,Ref(res,-1));
Sell=Cross(Ref(sup,-1),C);
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);

_SECTION_END();

Can someone please help in converting this script to trade script so that I can use it with Zerodha PI.

Regards
Umesh

even i am interested in getting the corresponding script which can used in PI or Algo trading