AFL For RSI Trigger Line Strategy

MarketSecrets - Learn To Trade Like a Pro

AFL For RSI Trigger Line Strategy

The moving average of RSI indicates the average momentum, while RSI indicates current momentum. So we are trying to buy when RSI crosses above its moving average.The short RSI period of 7 is used to generate sufficient signals. The Moving Average period used is 15, arbitrarily the double of RSI period.

Buy: When RSI crosses above its trigger line and RSI>60
Sell:  When RSI goes below trigger line and RSI<40

Script:

_SECTION_BEGIN( “RSI Trigger Line Strategy” );

SetChartOptions( 0, chartShowArrows | chartShowDates );
Plot( C, “Close”, ParamColor( “Color”, colorBlack ), styleNoTitle | ParamStyle( “Style” ) | GetPriceStyle() );

SetBarsRequired( 100000, 0 );
SetPositionSize(1, spsShares);

per1= Param(“RSI Period”, 7, 5, 100, 1);
per2= Param(“Trigger Line Period”,15, 15, 100, 1);

RSI1= RSI(per1);
MA1= MA(RSI1,per2);

Buy=Cross(RSI1,MA1) AND RSI1>60;
Sell=Cross(MA1,RSI1) AND RSI1<40;
Buy = ExRem( Buy, Sell );
Sell = ExRem( Sell, Buy );

Short = Cross(MA1,RSI1) AND RSI1<40;
Cover = Cross(RSI1,MA1) AND RSI1>60;
Short = ExRem( Short, Cover );
Cover = ExRem( Cover, Short );

Title = NumToStr( DateTime(), formatDateTime ) + ” O ” + O + ” H ” + H + ” L ” + L + ” C ” + C ;

PlotShapes( IIf( Buy, shapeSquare, shapeNone ), colorGreen, 0, L, Offset = -40 );
PlotShapes( IIf( Buy, shapeSquare, shapeNone ), colorLime, 0, L, Offset = -50 );
PlotShapes( IIf( Buy, shapeUpArrow, shapeNone ), colorWhite, 0, L, Offset = -45 );
PlotShapes( IIf( Sell, shapeDownArrow, shapeNone ), colorRed, 0, H, Offset = -45 );
PlotShapes( IIf( Short, shapeSquare, shapeNone ), colorRed, 0, H, Offset = 40 );
PlotShapes( IIf( Short, shapeSquare, shapeNone ), colorOrange, 0, H, Offset = 50 );
PlotShapes( IIf( Short, shapeDownArrow, shapeNone ), colorWhite, 0, H, Offset = -45 );
PlotShapes( IIf( Cover, shapeUpArrow, shapeNone ), colorBlue, 0, L, Offset = -45 );

_SECTION_END();

 

Download AFL

error: Content is protected !!