Heikin Ashi Supertrend is a Volatility based trend following indicator which uses Heinkin Ashi + Supertrend method to plot the indicator. Heikin means “average” and “ashi” means “pace”. Heikin-Ashi represents the average-pace of prices. Heikin-Ashi candlesticks is a japanese technique and quite different from the traditional candlesticks. Instead of using the open-high-low-close (OHLC) bars like standard candlestick charts, the Heikin-Ashi technique uses a modified formula:
[wp_ad_camp_5]
Close = (Open+High+Low+Close)/4
Open = [Open (previous bar) + Close (previous bar)]/2
High = Max (High,Open,Close)
Low = Min (Low,Open, Close)
Traditional supertrend uses a moving (statistical) median of the arithmetic mean (High + Low)/2 of the bars instead of a moving average. The (statistical) median is known to be more robust than any average. whereas Heinkin Ashi Supertrend uses a moving (statistical) median of the arithmetic mean (HaHigh + HaLow)/2 of the bars. Sample Heinkin ashi supertrend charts are shown below.
Nifty May Futures 5min Charts
10 things you need to know about HA Supertrend
1)HA Supertrend is a carry forward strategy which involves overnight gapup/gapdown risk and also weekend carry forward risk. It is not a pure intraday strategy. And Heinkin Candlesticks are different from Normal Candlesticks.
2)HA Supertrend normally makes more profit when the volatility increases and makes lesser losses/lesser profits when the market shows compressed volatility.
3)Most of the profits are made in gap up and gap down openings compared to the losses made in gapup/gapdown
4)Should works good with High Beta Stocks and BankNifty scrip.
5)HA Supertrend has two input factors Multiplier and ATR. default value is 6 and 6. Increasing the multiplier will increase the per trade risk and decrease the profits. (Tested across all the timeframes). And lower multiplier values will results in more number of trades which means more commissions and more slippages.to pay.
6)Heinkin Ashi Trailing Stop Loss levels displayed in the Dashboard is not a real trade stop loss as Heinkin Ashi Candles are different from normal Candlestick. So One should Buy only if there is a Buy Signal and Sell only if there is a sell signal.
7)Winning ratio is more or less between 42-50% across all the timeframes. (doesn’t includes brokerages and slippages). However most of the times higher time frame involves high risk in trading supertrend indicator.
8)HA Supertrend Strategy results will be equally comparable with normal Supertrend Strategy and in very few cases HA supertrend outperform Normal Supertrend in terms of profits and risk.
9)HA Supertrend V2.0 Strategy works only with amibroker version 5.4 and higher. If you are using older version of Amibroker consider upgrading to New Version.
10)It is advisable to trade one or two symbols at a time. Avoid jumping from one stock to another which could sometimes lead to consecutive losses and even missing most profitable signals.
BankNifty May Futures 5min Charts
How to Install the HA Supertrend Indicator
1)Download HA Supertrend AFL code.
2)Unzip HA Supertrend to local folder
3)Copy HA Supertrend AFL code ver2.afl code to c:\program files\amibroker\formulas\basic folder
5)Open Amibroker and Open a New Blank Chart
6)Goto Charts->Basic Charts and apply/drag-and-drop the HA Supertrend AFL code code into the blank chart
7)Bingo you are done. Now you will be able to see the HA Supertrend indicator with Buy and Sell signals.
Nifty and BankNifty HA Supertrend Backtest Results since March 2009
Tested with Initial Captial of Rs2,00,000 with 2 lots of Nifty and BankNifty(given seperately) and Broker Commission of Rs100 per trade leg( i.e Rs200 per Buy and Sell Transaction).
Nifty HA Supertrend backtest results
BankNifty HA Supertrend backtest results
You can Explore your own ideas with HA supertrend and Feeback invited.
Dear sir , Can I have for mt4 if so send it to my mail i d
Hi,
Iam planning to release HA Supertrend in MT4. Will take quite some time. Stay tuned!
Hi Rajandran
This code is producing error when code testing is done.. it starts from line 334 to 442 ..
please check ASAP.
regards
SK
make sure you are using the recent version of Amibroker.
I am using 5.64 .,Is that ok??
Then it should work and couple of people who tested are able to see the charts. What error you are getting?
ln334 Clr = IIf(sig == “BUY”, colorLime, colorRed);
variable sig used without having being initialized
Clr = IIf(sig == “BUY”, colorLime, colorRed);
operation not allowed.operand mistmatch
ln 336 ssl = IIf(bars == BarCount-1, TrendSL[BarCount-1], Ref(TrendSL, -1));
variable bars used without being initialised
similarly all the cariables, tar, tar1,tar2,tar3, bar, bar1 are used without being initialized..
one thing..you can see the chart and you can see the buy and sell…but when I have to do backtest , it doesnt and points the errors
Hi,,
waiting for your kind reply..
I would like to download the HA supertrend AFL code on my meta trader platform.
Thank.
Fernand
Hi,
The code done here is for Amibroker and you can expect Metatrader codes in the upcoming post. Stay tuned!
Sir
Which is better ? Super trend indicator with normal candle or Heiken ashi Candle ?
Rajandran sir does this repaint ….. also which is better Normal or HS
I prefer normal. Some parameters in Heikin Ashi outperforms. However there is no drastic change in performance compared to normal supertrend.
Hi Rajendran,
I am curious if choosing Heiken Ashi over Moving Average adds any benefit to your indicator? More winners, less drawdown etc. What is your experience.
Thanks again for all your hard work
John
Sir,
this code is producing errors as SK has said above. I am using 5.60 version of Amibroker. Please help.
Regards
Works best for me on H1, the target code gets errors during optimization of Factor and ATR period, so I had to remove it, aside from that great job!
While performing Optimization Low Level Graphic elements will create error. It is better to remove.
can we have a scanner for HA super trend in amibroker platform
Rajendran Sir,
How to do Backtest to check the Past performance.
In my Amibroker, when I do the Back Test, it shows 0 rows and no Trades.
Kindly help and guide the required settings to do the Back Testing.
Hi,
Make sure you are familiar with testing future mode. As it is different from traditional backtesting.
Rajendran Sir,
Kindly guide as how to test the future mode.
Thanks & Regards
please provide heiken ashi super trend code for mt4
thanks
Hello Sir,
Getting the following error ” Variable ‘sig’ used without being initialised”
Ple let me know how to correct this syntax.
thanks, Vivek
Hi try to use amibroker 5.5 above and also make sure that you have enough back fill
for 5min charts min backfill should be atleast 10-15 days of backfill and for hourly you need atleast 2 month of backfill data if you are missing
out anything it results in error
Rajandran R
Rajendran,
Just wanted to say thanks for all the time and effort you are taking to educate the viewers. I have been reading your website and it takes a heart of gold for a man to disclose such trading systems.
I have one small clarification regarding the Heikein Ashi AFL. I kindly request you to answer:
According to HA Super Trend, the trailing S/L is mere display and one should only buy when there is buy signal and sell when there is sell signal.
This is what i understand:
Say, we took a position, example: Long and market went against us and when signal reverts to sell, we close the positions and shift to sell.
For profit booking, do we book one lot at 1st target line and second lot at subsequent signal (or) both the lots at the subsequent signal?
Thanks Rajendran for the HA Supertrend AFL.
This indicator is a nice way of confirming whether we are trading the direction of major trend.
Thanks once again.
i want to install mt4,of indian stocks.would u please help me to do so. Thanks.
Hi Rajendran,
I am trying to automate the HA Supertrend to buy/sell on signal. Please can you advise on in which section of the code should the order placing code should be written.
I need Heiken Ashi indicator on my Deshboard bullish or bearish in diff time frame is it possible to devlop amibroker afl or mt4 indicator.
Hello,
Code has many errors from line 334 to 442.. It all starts with Variable Sig being not initialised… Many people have requested correction on the same.. I am using latest version of Amibroker…still the issues is persistent
Respected Rajendran Sir,
iam using amibroker 6.4
version , iam getting error code as mentioned below while applying on the chart , please rectify
“Cl-“+C+” “+ “Vol= “+ WriteVal(V)+”\n”+
Warning 506. You have specified precision that exceeds IEEE standard. Numbers are only accurate upto the 7th significant digit.