Code:
period2nd=18;
kltnerUB=EMA(Close,period2nd)+2*ATR(period2nd);
kltnerLB=EMA(Close,period2nd)-2*ATR(period2nd);
Plot(kltnerUB,"SKLTNER Upper Band",colorWhite, styleLine);
Plot(EMA(Close,period2nd),"SKLTNER Middle Band",colorGreen, styleLine);
Plot(kltnerLB,"SKLTNER Low Band",colorBlue, styleLine);
//MP = MarketPosition = 100 ;
Trend_ADX = ADX( ADXLength ) ;
//Plot(CCI(CCILen),"",colorWhite,styleLine,1);
iAvg = MA( Price, KeltnerLength ) ;
MyCCI=CCI(CCILen);
Shift = NumATRs * ATR( KeltnerLength ) ;
UpperBand = iAvg + Shift ;
LowerBand = iAvg - Shift ;
if (Cond1=Trend_ADX > Ref(Trend_ADX, -1)) {
//begin
if (Close > MA( Close, 8 )){ //then
TrendInd = 1;
else if (Close < MA( Close, 8)) //then
TrendInd = -1 ;
}//end }
else
TrendInd = 0 ;
}
cond2=IIf(Close > UpperBand AND (MyCCI>Ref(CCI(CCILen),-1)),0,1);
cond3=IIf(Close < LowerBand AND (MyCCI<Ref(CCI(CCILen),-1)),0,1);
//{ Entry }
//MyCCI=0;
if (Cond2==0)
PlotShapes( shapeStar ,colorGreen); //Buy ( "TMV LE" ) next bar market ;
if(Cond3==0)
PlotShapes(shapeStar ,colorRed); //SellShort ( "TMV SE" ) next bar market ;