Tradingtuitions.com AFL of the week: Intraday Trading Strategy for Nifty 2016-03-29 00:03:19 admin
This week we are going to share an excellent Intraday trading strategy for Nifty. This strategy uses RSI and ADX combination to find Buy/Sell opportunities. As a general rule, when RSI crosses an upper limit it indicates a Sell signal, while if it crosses lower limit it indicates Buy signal. But in this strategy, we are going to do the opposite i.e. Buy when RSI crosses upper limit and Sell when RSI crosses lower limit. ADX would be used as a trend identifier while taking Buy/Sell decisions. All the positions would be squared off at the end of day Read our article on AFL tutorial here here..
AFL Overview
Paramte r
Value
Preferred Timeframe Timeframe Intraday 1 minute Indicators Used
RSI(17), ADX(14)
Buy Condition
RSI(17)>=75 AND ADX(14)>25
Short Condition
RSI(17)<=25 AND ADX(14)>25
Sell Condition
Same as Short Condition OR Time>=03:15 PM
Cover Condition
Same as Cover Condition OR Time>=03:15 PM
Stop Loss
0.5%
Targets
No fixed target, Stop and reverse when AFL gives opposite signal
Position Size
150 (fixed) or 80% of equity (as per your risk appetite)
Initial Equity
200000
Brokerage
50 per order
Margin
10%
AFL Code //-----------------------------------------------------// // Formula Name: Nifty Intraday Strategy using RSI and ADX // Author/Uploader: Trading Tuitions // E-mail:
[email protected] // Website: www.tradingtuitions.com //-----------------------------------------------------_SECTION_BEGIN("Nifty _SECTION_BEGIN("Nifty Intraday Strategy"); Intraday Strategy"); SetTradeDelays( 1, 1, 1, 1 ); SetOption( "InitialEquity", 200000); SetOption("FuturesMode" ,True); SetOption("MinShares",1); SetOption("CommissionMode",2); SetOption("CommissionAmount",50); SetOption("AccountMargin",10); SetOption("RefreshWhenCompleted",True); SetPositionSize(150,spsShares); //Use this for fixed position size //SetPositionSize(80,spsPercentOfEquity); //Use this for position size as a percent of Equity SetOption( "AllowPositionShrinking", True ); BuyPrice=Open; SellPrice=Open; ShortPrice=Open; CoverPrice=Open; SetChartOptions(0,chartShowArrows|chartShowDates); _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C )); Plot( Close, "Price", colorWhite, styleCandle ); RSIPeriods=17; ADXPeriods=14; Buy=RSI(RSIPeriods)>=75 AND ADX(ADXPeriods)>25; Short=RSI(RSIPeriods)<=25 AND ADX(ADXPeriods)>25 ; Buy=ExRem(Buy,Short); Short=ExRem(Short,Buy); Sell=Short OR TimeNum()==151500; Cover=Buy OR TimeNum()==151500; StopLoss=0.5; ApplyStop(Type=0,Mode=1,Amount=StopLoss); Plot( RSI(RSIPeriods), "RSI", color=colorBlue, ParamStyle( "Style", styleOwnScale) ); Plot( ADX(ADXPeriods), "ADX", color=colorRed, ParamStyle( "Style", styleOwnScale) ); /* Plot Buy and Sell Signal Arrows */ 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(Cover, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40); PlotShapes(IIf(Cover, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Cover, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45); PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40); PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50); PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 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);
_SECTION_END();
AFL Screenshot
Backtest Report Below is the backtest report for two different variations of this strategy. One is using fixed position size of 150. Another is position size as a percentage of Equity. You can clearly see that the second one outperforms the first due to Power of Compounding. Compounding . Can you count Final capital for the second one? Just give it a try Moral of the Story: Your strategy need not to be complex and lengthy to be extremely profitable,
Paramter
Value Fixe xed d Pos osiiti tion on Si Size ze
Pos osiiti tion on Size= ze=80 80% % of Eq Equity
Initial Capital
200000
200000
Final Capital
1439280.45
11219716562.40
Bac ktest Pe Period
01-Jan-2008 to 22-03-2016
01-Jan-2008 to 22-03-2016
Timeframe
1 Minute
1 Minute
Net Profit %
619.64%
5609758.28%
Annua Annuall Return %
27.10% 27.10%
277.59% 277.59%
Number of Trades
1913
1913
W inning Trade %
43.49%
43.49%
Average Average holding holding Period Period
128.08 128.08 period periods s
128.08 128.08 periods periods
Max consec utive loss es
12
12
Max system % drawdown
-18.14%
-31.51%
Max Trade % drawdown
-31.51%
-44.43%
Download the detailed backtest report here here..
Equity Curve This strategy has a very smooth and linear equity curve with minimum drawdowns. Check it out.
Additional Amibroker settings for backtesting
Goto Symbol–>Information, and specify the lot size and margin requirement. The below screenshot shows lot size of 75 and margin requirement of 10% for NSE Nifty:
Disclaimer: All the the AFL AFL’s ’s posted in this section are for for learning learning purpose. purpose. Trading Trading Tuitio Tuitions ns does not necessarily necessarily own these AFL’s and we don’t have have any intell intellectual ectual property property rights rights on them. We might copy useful AFL’s from public forums and post it in this section in a presentable format. The intent is not to copy anybody’s work but to share knowledge. If you find any misleading or non-reproducible content then please inform us at
[email protected] Liked this article? Please spare few seconds to share it. Share on FacebookShare on Twitt erShare on Google+Share on Linkedin Related