Standard Deviation is a common statistical calculation that measures volatility. Supertrend is a trend following indicator which can be used to identify upward or downward trends.
BUY : when current SD is greater than maximum EMA on SD for previous 40 period.
SELL: when Supertrend crossed above Current close.
BUY{ SET sd = SDV(CLOSE,21,2,SIMPLE); SET st = SUPERTREND(200,5,SIMPLE); SET av = EMA(sd,50); SET hv = MAX(av,40); sd > hv and CLOSE > st;}
SELL{ set sd = SDV(CLOSE,21,2,SIMPLE); set st = SUPERTREND(200,5,SIMPLE); CROSSOVER(st,CLOSE);}