# Pinescript to AFL

#### AKKIIK

##### New Member
Hi Friends,

I am learning amibroker, and trying to convert the below pine script code into afl but not getting the correct result

Can anybody help me to convert this to amibroker

// INPUTS //
st_mult = input.float(3, title='SuperTrend Multiplier', minval=0, maxval=100, step=0.01)
st_period = input.int(10, title='SuperTrend Period', minval=1)

// CALCULATIONS //
up_lev = (high+low)/2 + st_mult * ta.atr(st_period)
dn_lev = (high+low)/2 - st_mult * ta.atr(st_period)

up_trend = 0.0
up_trend := c[1] > up_trend[1] ? math.max(up_lev, up_trend[1]) : up_lev

down_trend = 0.0
down_trend := c[1] < down_trend[1] ? math.min(dn_lev, down_trend[1]) : dn_lev

// Calculate trend var
trend = 0
trend := c > down_trend[1] ? 1 : c < up_trend[1] ? -1 : nz(trend[1], 1)

// Calculate SuperTrend Line
st_line = trend == 1 ? up_trend : down_trend

// Plotting

sell = ta.crossunder(c, st_line)
signal = input(false)

/////////////// Plotting ///////////////
plotshape(signal and buy, style=shape.triangleup, size=size.normal, location=location.belowbar, color=color.new(color.lime, 0))
plotshape(signal and sell, style=shape.triangledown, size=size.normal, location=location.abovebar, color=color.new(color.red, 0))