_maPeriod = input(21, title="Moving average period") _sma = sma(close, _maPeriod) _rate = close / _sma * 100 - 100 _stdCenter = sma(_rate, _maPeriod * 2) devUp = _stdCenter>_stdCenter[1]