Saturday, 21 September 2013

Stockastic Momentum Index AFL

I have given below an indicator which can be of great use both for intraday traders and delivery based traders. this indicator will tell us the current strength of a given stock. When the indicator crosses 60 levels and takes a slight turn downwards, we can expect the stock to lose its value. one can short it or sell the stock if  already bought.Similarly when the indicator below the -60 levels and shows an upward trend, it is and indication  that the stock is gaining strength. one can buy it  on the long side.

It would be advisable to use this along with other indicators for confirmation, because relying on one indicator is not always good. 

I hope you will enjoy using the Stochastic Momentum Index AFL 


////////////////////////////////////// the code begins below this line/////////////////////////////////////////

SECTION_BEGIN("SMI - Stochastic Momentum Index");
SetChartBkColor( colorBlack ) ;
LookBack    = Optimize("LookBack",Param("Lookback", 10, 1, 100 ),1,30,1);
Smooth1     = Optimize("Smooth 1",Param("Smooth 1", 3, 1, 100 ),1,30,1);
Smooth2     = Param("Smooth 2", 3, 1, 20 );
Trigger     = Param("Signal", 3, 1, 10);
PP            = ParamField("Price field",-1);
SMILevel    = Param("Level", 60, 10, 60, 10);

HH = HHV( H, LookBack );
LL = LLV( L, LookBack );


StoMom = 100 * EMA( EMA( PP - 0.5 * ( HH + LL ), Smooth1 ), Smooth2 ) /
( 0.5 * EMA( EMA( HH - LL, Smooth1 ), Smooth2 ) );
StoSig = MA(StoMom,3);

Buy = Cover = Cross(StoMom,StoSig);
Short = Short = Cross(StoSig,StoMom);

Plot (StoMom,_DEFAULT_NAME(),IIf(StoMom> Ref(StoMom,-1),colorBrightGreen,colorRed), styleLine+styleThick);
Plot (StoSig,"",colorWhite,styleLine+styleNoLabel);
Plot(0,"",31,styleNoLabel);
Plot( SMILevel,"",colorOrange,styleDashed);
Plot(-SMILevel,"",colorOrange,styleDashed); 

No comments:

Post a Comment