Breakout coding for tradescript

I need to work out two separate coding for break outs.

  • strategy 1 :

previous close>sma(close,10) ) and there should be squeeze on Bollinger where last 10 closes should be within 1 std deviation from 20 period SMA and opening should be above upper BB(20,2,close) with volume increase by atleast 20% of last 10 period volume average 

  • strategy 2:

close>sma(close,10) and it should go up with volume increase.. then stock should fall but not cross below the 10-period sma. It should be within 2% distance from 10-period sma. I want to capture these events which normally give 2-5% upsides from entry point..

Exit strategy:

entry point+2% or  close<ref(close,1) which ever comes 1st

As per the above query

Stratagy 1

REF(CLOSE,1)>SMA(CLOSE,10) AND SMA(CLOSE,20)>BBT(CLOSE, 20, 2, EXPONENTIAL) AND AVG(VOLUME, 10)

Stratagy 2 It is not possible to code in tradescript as per your codtion above give in Stratagy 2

THANKS FOR YOUR REPLY. I TRIED TO PASTE AND RUN THIS SCRIPT IN SCANNER BUT IT DID GIVE ME A CODING ERROR.