How does one code for a "bounce"?

 
 
What do you mean?
 
 
May be you can check a bounce by compare MA values in time series.
i.e
if iMA(NULL,0,period,0,ma_method,PRICE_CLOSE,0)>iMA(NULL,0,period,0,ma_method,PRICE_CLOSE,1) and
iMA(NULL,0,period,0,ma_method,PRICE_CLOSE,1)<iMA(NULL,0,period,0,ma_method,PRICE_CLOSE,2),
then can we consider that is a bounce.
Reason: