A Great Nifty Trading System Using Heikin-Ashi Candles Oscillator
In This Post We Will Try To Build A Nifty Trading System Using HACO
Various approaches can be found for technical analysis oriented buy or sell signals, all of them are categorized into 3 methods. The 1st is the one Sylvain Vervoort used in his book Capturing Profit With Technical Analysis, a method called LOCKIT. It uses all methods of technical analysis techniques to come up with robust buy or sell signals. This is not the easiest method because you need a broad knowledge of all the basic techniques and the idea to apply them.
The 2nd method applies artificial intelligence, feeding the data and technologies out of the 1st method into neural networks, automatically capturing price, volume, or any other pattern displayed by LOCKIT.
Then there’s the 3rd method. This one follows price movement, basing your buy and sell on the idea that breaking a short or medium-term up or down trend signals a trend reversal. Here, you have to find the best profitable balance between entering a trade quickly and avoiding false entries as much as possible, staying in as long as possible to let profits run. This is the method Sylvain Vervoort apply in different trading expert systems. However, once there is a buy or sell signal, you should look for methods from the 1st or 2nd method to avoid non-profitable trades.
The 3rd method can only be profitable if price moves are regular and large enough. Since Nifty are tracking NSE stocks that average a large number of underlying instruments, it is unusual to find larger moves with limited drawbacks on daily charts of Nifty. This makes it difficult to trade Nifty profitably with a trend-following Nifty trading system.
In the book “Long-Term Trading Using Exchange Traded Funds” in this issue, author Sylvain Vervoort describes the use of his heikin-ashi candles oscillator (HACO) with modifications for longer term trading (HACOLT). The indicator plots a 100 value for a long position, 50 for a long exit, and zero for short entry. and the same also applies well in our Nifty trading system.
A ready-to-use Amibroker formula implementing HACO in Nifty trading system is shown below. To use it, enter the formula in the AFL Editor, then press “Insert indicator” or go to the Tools→Backtest menu if you wish to test the system. Check the image below for more details. Click on the image for a larger view.
// Heikin-Ashi Candles Oscillator
Avgp = Param( “TEMA average”, 55, 1, 100 );
CandleSize = Param( “Candle Size factor”, 1.1, 0.01, 5, 0.01 );
LTAverage = Param( “Shorting LT Average”, 60, 1, 200 );
price = ( O + H + L + C ) / 4;
haOpen = AMA( Ref( price, -1 ), 0.5 );
haC = ( price + haOpen + Max( H, haOpen ) + Min( L, haOpen ) ) / 4;
ZlHa = TEMA( haC, Avgp ) + ( TEMA( haC, Avgp ) – ( TEMA( TEMA( haC, Avgp ), Avgp ) ) );
ZlCl = TEMA( ( H + L ) / 2, Avgp ) + ( TEMA( ( H + L ) / 2, Avgp ) – ( TEMA( TEMA( ( H + L ) / 2, Avgp ), Avgp ) ) );
keep1 = Hold( haC >= haOpen, 2 ) OR C >= haC OR ( H > Ref( H, -1 ) OR L > Ref( L, -1 ) );
keep2 = ( ZlCl – ZlHa ) >= 0;
keeping = ( keep1 OR keep2 );
keepall = keeping OR ( Ref( keeping, -1 ) AND C >= O OR C >= Ref( C, -1 ) );
keep3 = ( abs( C – O ) < ( H – L ) * CandleSize AND H >= Ref( L, -1 ) );
utr = Keepall OR ( Ref( keepall, -1 ) AND keep3 );
keep1 = Hold( haC < haOpen, 2 );
keep2 = ( ZlCl – ZlHa ) < 0;
keep3 = abs( C – O ) < ( H – L ) * CandleSize AND L <= Ref( H, -1 );
keeping = keep1 OR keep2;
keepall = keeping OR ( Ref( keeping, -1 ) AND C < O OR C < Ref( C, -1 ) );
dtr = Keepall OR ( Ref( keepall, -1 ) AND keep3 ) == 1;
upw = dtr == 0 AND Ref( dtr, -1 ) AND utr;
dnw = utr == 0 AND Ref( utr, -1 ) AND dtr;
Result = IIf( upw, 1, IIf( dnw, 0, ValueWhen( upw + dnw, upw ) ) );
LTSell = C < EMA( C, LTAverage );
LTResult = Flip( Result, Result == 0 AND LTSell );
Haco = IIf( Result, 100, IIf( LTResult, 50, 0 ) );
Plot( Haco , “HACO”+_PARAM_VALUES(), ParamColor(“Color”, colorRed));
pHaco = Ref( Haco, -1 );
Buy = Haco == 100 AND pHaco != 100;
Sell = ( Haco == 50 OR Haco == 0 ) AND pHaco == 100;
Short = Haco == 0 AND pHaco != 0;
Cover = Buy;
Want to check some more professional trading systems on Amibroker platform. Click here for Trend Blaster. If you like the post share it with the world using the social share icons below.