Trying to convert Pinescript Indicator to AFL

Length = Param("Length", 14, 1, 100, 1);
Src = Param("Source", 1, 1, 5, 1);
Mult = Param("Mult", 2.0, 0.001, 50, 0.001);
MaLength = Param("MaLength", 7, 1, 100, 1);

Basis = MA(Src, Length);
Dev = Mult * ATR(Length);
Upper = Basis + Dev;
Lower = Basis - Dev;
BBR = (Src - Lower)/(Upper - Lower);
BBE = EMA(BBR, MaLength);
Up = IIf(Ref(BBE,-1)>BBE AND Ref(BBE,-2)<Ref(BBE,-1) , BBE , 0);
Bt = IIf(Ref(BBE,-1)<BBE AND Ref(BBE,-2)>Ref(BBE,-1) , BBE , 0);

TopH = HHV(H, 3);
BottomL = LLV(L, 3);

Tf = IIf(Up != 0 , TopH, Ref(TopH,-1));
Bf = IIf(Bt != 0 , BottomL , Ref(BottomL,-1));

Plot(Tf, "", colorRed, styleLine | styleThick);
Plot(Bf, "", colorGreen, styleLine | styleThick);

Buy = Cross(Close, Tf);
Sell = Cross(Bf, Close);

Link for original code: ATR_RSRL — Indicator by tongue1 — TradingView

When posting the formula, please make sure that you use Code Tags (using </> code button) as explained here: How to use this site.

Using code button

Code tags are required so formulas can be properly displayed and copied without errors.

Google for Support and Resistance AFL , I've seen many around.

Try https://forum.amibroker.com/t/support-resistance/32961/6 Its authored by Empotasch
Dont forget to say Thanks to him.

Thank you. Will definitely do