Supertrend algo code for back testing and expert advisor

Dear sir, I h’ve opened chart & added indicator of super trend, in zerodha pi I need to apply expert adivsor on chart with supertrend indicator, what’s the code of supertrend & how to create alert of supertrend indicator?(period,factor) how to set for backtest? I h’ve searched algo code of supertrend but didn’t found. pl. help me. nitin