Please code for below in tradescript

I am using zerodha pi

Please code following strategy for me:

Buy if Close < Lower Bollinger AND RSI < 30

Exit long if RSI > 50 OR Touch Bolinger Avg.(Central MA)

Short Sell if Close > Upper Bolinger and RSI > 70

Cover Short if RSI < 50 OR Touch Bolinger Avg.(Central MA)
Stop Loss of 5%

Buy: 

CLOSE < BBB(CLOSE, 20, 2, EXPONENTIAL) AND RSI (CLOSE, 14) < 30

Exit long: 

RSI(CLOSE, 14) > 50 OR CLOSE > BBM(CLOSE, 20, 2, EXPONENTIAL) 


Short sell: 

CLOSE > BBT(CLOSE, 20, 2, EXPONENTIAL) AND RSI (CLOSE, 14) > 70


cover short: 

RSI(CLOSE, 14) < 50 OR CLOSE < BBM(CLOSE, 20, 2, EXPONENTIAL) 

stoploss can be entered in Alert Preference window by ticking the check box for Stop Loss Order and entering 5% in the Trigger% field

2 Likes