I need help to code a strategy for generating Buying alert when Bollinger bands start expanding

The strategy is for scanning and generating alert for buying only.

Strategy: Buy when Bollinger band starts expanding

Set Up: 1 min chart, for one day

Method/ Logic:

When current Upper Bollinger band value is more than previous value AND previous value is more than immediately preceding value

AND 

When current Lower Bollinger band value is less than previous value AND previous value is less than immediately preceding value

Generate a buy signal 

hElLO tRaDeR,

BUY SIGNAL:

BBT(CLOSE, 20, 2, EXPONENTIAL) > REF(BBT(CLOSE, 20, 2, EXPONENTIAL),1) AND 
REF(BBT(CLOSE, 20, 2, EXPONENTIAL),1) > REF(BBT(CLOSE, 20, 2, EXPONENTIAL),2) AND 
BBB(CLOSE, 20, 2, EXPONENTIAL) < REF(BBB(CLOSE, 20, 2, EXPONENTIAL),1) AND 
REF(BBB(CLOSE, 20, 2, EXPONENTIAL),1) < REF(BBB(CLOSE, 20, 2, EXPONENTIAL),2)