I wanted to back text a strategy can someone help me code this

hey!

Can someone help me code this for back test

BUY

when EMA 13 crossesover EMA 48 from below go LONG

ONLY

if CCI is more than 160

SELL

when ema 13 crosseover ema 48 from above go short

only

if cci is more than -160 i.e(-170…-180…etc)

//////////////Neotrade Analytics/////////////////////////////////
//////////www.neotradeanalytics.com//////////////////////////////
_SECTION_BEGIN("EMA_CCI");
x = EMA(Close,13);
y = EMA(Close,48);
z = CCI(14);

Buy = Cross(x,y) AND (z > 160);
Sell = Cross(y,z) AND (z < -160);

Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);

PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorred, 0,L); 
        
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorgreen, 0,H);

Plot( EMA( close, 13 ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") ); 
Plot( EMA( close, 48 ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") ); 

Plot(C,"",colorBlack,styleBar);

_SECTION_END();

Regards

Vivith

www.neotradeanalytics.com

(Authorized vendor of NSE supporting realtime data feeds to Amibroker, metastock and Ninjatrader)

As per your above condition

Buy Script:

CROSSOVER(EMA(CLOSE,48),EMA(CLOSE,13)) AND CCI(12, SIMPLE) > 160

Sell Script:

CROSSOVER(EMA(CLOSE,13),EMA(CLOSE,48)) AND CCI(12, SIMPLE) > -160