_SECTION_BEGIN("TSI");
r = Param( "TSI period 'R':", 7, 1, 100, 1 );
s = Param( "TSI period 'S':", 27, 1, 100, 1 );
u = Param( "TSI period 'U':", 1, 1, 100, 1 );
sig = Param( "Signal period:", 7, 1, 100, 1 );
Mtm = C - Ref ( C, -1 );
AbsMtm = abs ( Mtm );
Num_T = EMA ( EMA( EMA ( Mtm, r ), s ), u );
Den_T = EMA ( EMA( EMA ( AbsMtm, r ), s ), u);
TSI = 100 * Nz ( Num_T / Den_T );
TSIL = 100 * Nz ( Num_T / Den_T );
//Green TSIL Line=Rising; Red TSIL Line=Falling
col = IIf( TSIL > Ref( TSIL, -1 ), colorGreen, colorRed );
Plot( TSIL, "TSI("+r+","+s+","+u+")", col, styleLine | styleThick);
//Green EMA TSI,sig Line=Rising; Red EMA TSI,sig Line=Falling
col = IIf( EMA(TSI,sig) > Ref( EMA(TSI,sig), -1 ), colorGreen, colorRed );
Plot( EMA(TSI,sig), "", col, styleThick);
Histcol= IIf(TSI>0,colorLime,colorRed) ;
Plot( TSI, "", histcol, ParamStyle("Histogram style", styleThick |
styleHistogram | styleNoLabel, maskHistogram ) );
Plot(0,"",ParamColor( "ColorZero", colorBrown ),styleLine);
//Title = "TSI";
_SECTION_END();
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//FORMULE
Cuptop1= C>BBandTop( C,20,1 ) ;
top1up= BBandTop( C,20,1 )>=Ref(BBandTop( C,20,1 ),-1) ;
top2up= BBandTop( C,20,2 )>=Ref(BBandTop( C,20,2 ),-1) ;
MACDup= MACD()>Signal() ;
Hist= MACD()-Signal() ;
Histup= Hist>Ref(Hist,-1) ;
stochup= StochK()>StochD() ;
stoch80= StochK()<80 br="">MFIup= MFI()>EMA(MFI(),5) AND MFI()>20 ;
ma10up= MA(C,10)>=Ref(MA(C,10),-1) ;
ma20up= MA(C,20)>=Ref(MA(C,20),-1) ;
EMA50up= EMA(C,50)>=Ref(EMA(C,50),-1) ;
Cupma10= C>MA(C,10) ;
Cupma20= C>MA(C,20) ;80>
cupema50= C>EMA(C,50) ;
Vup50= V>50000 ;
CCIup0= CCI()>0 ;
Cupo= C>O ;
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
mybuy= TSIL > Ref( TSIL, -1 ) AND EMA(TSI,sig) > Ref( EMA(TSI,sig), -1 ) AND TSIL>EMA(TSI,sig) AND
macdup AND ema50up AND mfiup ;
mysell= TSIL < Ref( TSIL, -1 ) AND EMA(TSI,sig) < Ref( EMA(TSI,sig), -1 ) AND TSILBuy = ExRem(myBuy, mysell);
Sell = ExRem(mysell, myBuy);
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorBlue,0);
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0);