Codinf for bollinger bandwidth

code required to set alerts

buy : bollinger bandwidth less than 6

sell : bollinger bandwidth great than 15

code required :

buy : ema 9 cuts 20

sell : within 3 percent up or 4 percent stop loss ( i don’t need a simultaneous short trade either )

last question :during backtest when we buy and sell automatically another short selling trade is commenced

how do we a back test only a short and short covering trade

tried using short and exit short trade it says there should be a buy and sell

for setting alerts as per your condition

Buy Script:

BBT(CLOSE, 20, 2, EXPONENTIAL) < 6

Sell Script:

BBB(CLOSE, 20, 2, EXPONENTIAL) > 15

for ema crossover

Buy Script:

CROSSOVER(EMA(CLOSE,9),EMA(CLOSE,20))

it is not possible to code based on percentage

for back testing you require atleast one buy and sell

Is this correct code for Bollinger Bandwidth?

Aren’t BBT and BBB for top and bottom of Bollinger bands? Not for bandwidth?

I think it’s for Bollinger bands not bandwidth

yes ,you are right. shouldn’t rely fully on Pi’s tradescript.must use some other programming language or software