eSignal RealTime , Abletrend, Orderflows Trader , MotiveWave Ultimate, AmiBroker Trading System

Best Trading Software's free download, MotiveWave Ultimate 6.6 Free Download, ELWAVE 10h free download, MZPack 3 Pro NinjaTrader 8, TAS Market Profile for NinjaTrader 8, AmiBroker Licence Error Solution, eSignal Realtime, MTPredictor 8.1, ATM RMO 3 for MetaStock, ElliotWave Software, Apps for Stock Market, MTPredictor 8.1 NinjaTrader Add-on Free download, SharkIndicators (BlackBlood + BloodHound), Fin-Alg, GomiProPack, Hawkeye Professional Package, TradeGuider, BuySide Global, Timing Soultions

Recent Posts

LightBlog
Contact at : brokeyforamibroker@gmail.com

Sunday, 25 December 2016

Trading NR7 setup : Low Risk High Reward

Narrow Range trading strategy or NR7 Trading strategy is a breakout based method which assumes that the price of a security trends up or down after a brief consolidation in a narrow range. The default look back period of this strategy is 7 days which means that if the price range of any particular days is lowest as compared to last 7 days, then that day is termed as NR7 day. Here the range is calculated as the difference between High and Low of the particular day. The day following NR7 day acts as a confirming factor on where the price will move further. Breakout of the High of NR7 candle with high volumes indicates bullishness, while breakout of Low of NR7 candle indicates bearishness. The philosophy behind the pattern is similar to the Bollinger Band Squeeze: a volatility contraction is often followed by a volatility expansion. Narrow range days mark price contractions that often precede price expansions. See the below chart for visual explanation:


Further in this article we’ll go through an Amibroker trading system based on NR7 strategy. This strategy seems to work very well in indexes especially Nifty and Banknifty. It takes very few trades in the year, but still happens to catch big moves. This is the reason we named it low risk high reward strategy

NR7 Trading Strategy Overview
ParamterValue
Preferred TimeframeDaily
Indicators UsedNone
Buy ConditionPrevious candle is NR7 candle, and current candle has a Gap-Up opening.
Short ConditionPrevious candle is NR7 candle, and current candle has a Gap-Down opening.
Sell ConditionBased on Target and Stop Loss
Cover ConditionBased on Target and Stop Loss
Stop Loss1% (fixed)
Targets4% (fixed)
Position Size50% of Equity
Initial Equity200000
Brokerage100 per order
Margin10%

AFL Code

//------------------------------------------------------
//
//  Formula Name:    NR7 Trading Strategy
//  Author/Uploader: BrokeyForAmiBroker
//  E-mail:          brokeyforamibroker@gmail.com
//  Website:         brokeyforamibroker.blogspot.in
//------------------------------------------------------

_SECTION_BEGIN("NR7 Trading Strategy");

SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C ));

//Initial Parameters
SetTradeDelays( 0,0,0, 0 );
SetOption( "InitialEquity", 200000);
SetOption("FuturesMode" ,True);
SetOption("MinShares",1);
SetOption("CommissionMode",2);
SetOption("CommissionAmount",100);
SetOption("AccountMargin",10);
SetOption("RefreshWhenCompleted",True);
SetPositionSize(50,spsPercentOfEquity);
//SetPositionSize(150,spsShares);
SetOption( "AllowPositionShrinking", True );

Plot( Close, "Price", colorWhite, styleCandle );

//==================================================================================
//NR7 RANGE IDENTIFICATION
 
range = H-L;
Condition0 = range<Ref(range,-1) AND range<Ref(range,-2) AND range<Ref(range,-3)AND range<Ref(range,-4)AND range<Ref(range,-5)AND range<Ref(range,-6);
NR7 = IIf(Condition0,True, False);

printf("\nNR7 : " + NR7 );  

BuyPrice=Open;
SellPrice=Open;
ShortPrice=Open;
CoverPrice=Open;

TGT= Param("Target Percent",4,1,20,1);
SL= Param("SL Percent",1,1,5,1);

Buy=Ref(NR7,-1) AND GapUp();
Short=Ref(NR7,-1) AND GapDown();

BuyTgt=ValueWhen(Buy,BuyPrice,1)*(1+TGT/100);
BuySL=ValueWhen(Buy,BuyPrice,1)*(1-SL/100);
Sell= H>=BuyTgt OR L<=BuySL;


ShortTgt=ValueWhen(Short,ShortPrice,1)*(1-TGT/100);
ShortSL=ValueWhen(Short,ShortPrice,1)*(1+SL/100);
Cover=  L<=ShortTgt OR H>=ShortSL;


SellPrice = IIf(Sell, IIf(H>=BuyTgt, BuyTgt, BuySL), Null);  
CoverPrice = IIf(Cover, IIf(L<=ShortTgt, ShortTgt, ShortSL), Null);  

Buy = ExRem(Buy,Sell);
Sell =ExRem(Sell,Buy);
Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Short);


printf("\nBuy : " + Buy );   
printf("\nSell : " + Sell );  
printf("\nShort : " + Short );  
printf("\nCover : " + Cover );  
printf("\nBuyPrice : " + BuyPrice );
printf("\nShortPrice : " + ShortPrice ); 
printf("\nSellPrice : " + SellPrice ); 
printf("\nCoverPrice : " + CoverPrice ); 
printf("\nBuyTgt : " + BuyTgt );  
printf("\nBuySL : " + BuySL ); 
printf("\nShortTgt : " + ShortTgt );  
printf("\nShortSL : " + ShortSL ); 


/* 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(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(Sell, shapeStar, shapeNone),colorWhite, 0, H, Offset=25);
PlotShapes(IIf(Cover, shapeStar, shapeNone),colorWhite, 0,L, Offset=-25);

_SECTION_END();

NR7 Trading Strategy: AFL Screenshot

NR7 Trading Strategy

Backtest Report

See the backtest report of NR7 Trading strategy on two major Indices listed in NSE.
ParamterValue
NiftyBank Nifty
Initial Capital200000200000
Final Capital1482002.221691748.00
Backtest Period01-Jan-2010 to 30-Sep-201601-Jan-2012 to 30-Sep-2016
Net Profit %641.00%745.87%
Annual Return %34.59%56.79%
Number of Trades3328
Winning Trade %54.55%53.57%
Average holding Period8.24 periods4.96 periods
Max consecutive losses43
Max system % drawdown-25.83%-18.52%
Max Trade % drawdown-34.61%-31.09%

Equity Curve

The NR7 Trading strategy has a close to linear equity curve.

Nifty:

nr7-nifty-equity-curve

Bank Nifty:

nr7-bnf-equity-curve

Additional Amibroker settings for backtesting

Goto Symbol–>Information, and specify the lot size and margin requirement. The below screenshot shows lot size of 30 and margin requirement of 10% for Bank Nifty:
Symbol Info

Disclaimer:

All the AFL’s posted in this section are for learning purpose. BrokeyForAmiBroker does not necessarily own these AFL’s and we don’t have any intellectual property 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 brokeyforamibroker@gmail.com

No comments:

Post a Comment