Australian (ASX) Stock Market Forum

Heiken-Ashi system: Anyone use them? 6000% profit

Joined
13 August 2011
Posts
15
Reactions
0
Hey all,

I'm new to ASF and amibroker but not new to trading. I've recently purchased a full version of amibroker and am seriously addicted. I sit on the couch with my iPad and VNC client and constantly nut out all of my ideas to AFL code!

Do any other users of amibroker incorporate heiken ashi indicators into their code? I have recently written a few strategies using them and have had good success. I only have trial data of premium data data but the following code below returned 6000% profit (70% winners) for all bars of data in the all ordinaries. It returned about 70% profit (same 70% winners) for the last 700 days.

Backtesting code is posted below. Any feedback would be much appreciated if anyone could run it against 10 years of data in the full all ordinaries and ASX300.

I'd also love to see anyone elses heiken ashi strategy.

I love heineken and asahi so feel like I have a deep connection with this indicator lol.

SetOption("InitialEquity", 10000 );
*
//buy the day after condition is met, allow intraday selling
SetTradeDelays(1,0,1,1);
*
//other conditions
RoundLotSize = 1;
dollars = 10000;
BuyPrice = Open;
MAlong = 150;
SetOption("MaxOpenPositions", 3);
*
*
/*Make sure that my equity is 2% of weekly traded volume of stock = liquidity */
Equityvar = dollars/Close < 0.02 * Sum(Volume,maLong)/(maLong/5);
*
//heiken ashi code
HaClose = (O + H + L + C)/4;*
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );*
HaHigh = Max( H, Max( HaClose, HaOpen ) );*
HaLow = Min( L, Min( HaClose, HaOpen ) );*
xDiff = (HaHigh - Halow) * 10000;
*
//3 green heiken ashi candles
Cond1 = Sum(HaClose >= HaOpen,3)==3;
*
//heiken ashi close above 30 day ma
Cond2 = Haclose >=MA(Close,30);
*
//todays 30 day MA is greater than 2 weeks ago
Cond3 = MA(Close,30) > Ref(MA(Close,30),-14);
*
//stocks greater than $0.50
Cond4 = Close > .5;
*
//clse > 5 day MA
Cond5 = Close >= MA(Close,5);
*
//buy criteria
Buy = Cond1 AND Cond2 AND Equityvar AND Cond3 AND Cond4;
*
//sell when 50 day MA is breached
Sell = Close <= MA(Close,50);
*
//sell on 4% profit
ApplyStop(stopTypeProfit,stopModePercent,4,1,False,0);
*
 
Re: Heiken ashi system. Anyone use them? 6000% profit.

Been there done that. No such thing. ;) Might have to get me some Premium Data to get better results. (not)
 

Attachments

  • untitled.jpg
    untitled.jpg
    76 KB · Views: 196
Re: Heiken ashi system. Anyone use them? 6000% profit.

Wow, thanks for the constructive feedback....
I am cynical for good reason and it is because I have been down that path and backtested results are not what happens in real time trading. I have hundreds of coded "ideas" that I have backtested then promising ones real time tested and it just isn't real. Backtesting is over rated and hyped to sell.

The only skills I developed backtesting is reading charts and understanding the market.

I will tell you why the results are very inaccurate later.
 
It's a bit late in the day so I haven't looked at your code at all. But just to quickly give you an idea I ran your code a few times. This is premium data on the all ords from 01-01-2001 through to today (couple days ago actually, haven't updated data this week). The list is sorted by CAR - compounded annual return.

On face value it has potential for some fantastic results. However, once in a while it destroys your account. See the Max system drawdown of 99.88% in the first row. If you can find out why this happens and fix it, you might be onto something.

Nicktech Heiken result.jpg
 
hey guys,

cheers for the feedback. wysiwyg, i appreciate that someone with as many posts as you has probably seen it all and i can definately appreciate that there is no such thing as a "perfect system" for mechanical trading BUT i do like runing these Amibroker formulas against the ASX, purely just to see how many winners vs losers it creates.

for instance, if amibroker proves that 3 green heiken ashi candles, high liquidity and a positive trending 30 day MA for the last 2 weeks (or any other strategy) creates a winner 3 out of 4 times over the last 10 years then i wouldn't use that purely as my strategy but i would pay serious attention to what those indicators were saying when i was going to enter a trade.

Lonewolf, The code is definately really really rough. i wrote it out, ran 5 tests, got excited when i saw 5 good results and then posted it to ASF! i haven't given much consideration to stop losses or other exits. It was sloppy on my behalf and i should have done a bit more work on it before wasting peoples time on it but thanks for your input and if i feel like i've made it bulletproof, i'll let you know.

cheers,

Nick
 
Heiken Ashi candles aren't real candles. You can't buy or sell a H-A candle. Read up on how they are calculated. The system is useless.

H-A is useful as a visual guide, as it smooths out the noise. I use it on the intra-day XAO.
 
Heiken Ashi candles aren't real candles. You can't buy or sell a H-A candle. Read up on how they are calculated. The system is useless.

H-A is useful as a visual guide, as it smooths out the noise. I use it on the intra-day XAO.

This is such an agressive forum IMO.

why is it useless? the system doesn't buy off the Heiken ashi price it buys on the next days open using HA candles as an indicator.

BuyPrice = Open;

if i'm annoying people with noob questions, then dont respond. if you're willing to help, then thankyou. but i dont see the sense in any comment that just highlights the problem with out any hint of how to approach the solution.

I beleive that the systen does work on the ASX 300. i posted it primarily for anyone to copy and paste and play around with not as the holy grail solution to making it rich.
 
i thought you couldn't write sarcasm.... but it seems you can tech! haha. i'll sell you the exclusive rights to it tech and we can go on a road show around australia like "safety in the market" and make squillions.

Perhaps i got off to the wrong start with this thread.

all i want to know is, if amibroker code can backtest strategies (albeit, not that it truly reflects real world trading), what would any of you gurus look for in a strategy in order to pay full attention to it? do you have a minimum win/loss ratio, minimum %pa gained, maximum drawdown etc.

most of the code i write ends up netting about 10-15% per year with about 80% win/loss ratio but like 100+ trades a year. i never bother putting it in to practice because i think that for all of that effort i may as well just sit it on 1 blue chip or in a high yield debenture and be done wth it.

When this 35% per annum one popped up (6000% for a test on all my data) i though that this might be a worth my while trading to this strategy.

i know the code is not perfect, i was just putting it out there for people to have aplay with who might want to see how 1 person is using heiken ashi as a strategy.
 
This is such an agressive forum IMO.

why is it useless? the system doesn't buy off the Heiken ashi price it buys on the next days open using HA candles as an indicator.

BuyPrice = Open;

if i'm annoying people with noob questions, then dont respond. if you're willing to help, then thankyou. but i dont see the sense in any comment that just highlights the problem with out any hint of how to approach the solution.

I beleive that the systen does work on the ASX 300. i posted it primarily for anyone to copy and paste and play around with not as the holy grail solution to making it rich.

Sorry about the tone. You're correct about it buying the normal candle.

I backtested it on stocks 2007-2011, open-close with turnover of 1mill and 10 mill and got a very sloppy looking equity curve with a return of approx +13 and -17%pa.
I've also played with H-a systems before and got nowhere.

For that sort of return I'd rather be in a managed fund, or decent performing blue chip.
 
Cheers GB.

I first heard about heiken ashi when reading about forex trading and I guess all it is really is a modified candlestick that just colours the candle green on a positive trend.

That code will be filed in folder "theory_26" to revisit one day and remind me that they're not that good.

Do you trade strictly to a mechanical system for your entries and exits or do you just use the software to filter for strong stocks and then use your own judgement to pick the best?

The more I look in to it, the better off I think I'd be if I just screened for upward trending moving averages, high liquidity, volume spikes and then used my own judgement to do the rest. Rather than trying to make a bullet proof automatic strategy.

Cheers,

Nick
 
Cheers GB.

I first heard about heiken ashi when reading about forex trading and I guess all it is really is a modified candlestick that just colours the candle green on a positive trend.

That code will be filed in folder "theory_26" to revisit one day and remind me that they're not that good.

Do you trade strictly to a mechanical system for your entries and exits or do you just use the software to filter for strong stocks and then use your own judgement to pick the best?

The more I look in to it, the better off I think I'd be if I just screened for upward trending moving averages, high liquidity, volume spikes and then used my own judgement to do the rest. Rather than trying to make a bullet proof automatic strategy.

Cheers,

Nick

Hi Nick,

You obviously have the ability to code, so are way ahead of most here for a start.

I would disregard all the negative sentiment and stick with your plan;).

The Heiken is as good as any indicator to use because it is also visual .....

If you use it in tandem with previous support and resistance areas of the Instrument you are trading, and filter that with Volume and Range, I think you will do quite well:cool:

Cheers.

PS. I am talking FX/Futs ...... Its usefuleness with Stocks I am unsure about.
 
Thanks Barney,

I've been coding php and C++ for 10 years so the amibroker language wasn't hard to pick up.

If you (or anyone else reading this post) wants me to put any of your ideas to AFL code just swing me a PM with what you're after and I'd be happy to help.

Ive almost finished an AFL script that anyone can attach to their AFL code so when the criteria is met for a buy condition it automatically posts to their iPhone app for checking on the go, with a chart. Because it's managed by a central server, the server can collate what everyones scans are saying to buy and find the most popular stock. Like a social app for stock recommendations.

Might make it free if I can find the time to finish it!
 
Hi Nicktech and please excuse my abruptness first post.
The more I look in to it, the better off I think I'd be if I just screened for upward trending moving averages, high liquidity, volume spikes and then used my own judgement to do the rest. Rather than trying to make a bullet proof automatic strategy.
Now that makes a whole lot of sense I reckon. Not discounting the value in backtesting to get a ball park idea of what might have occurred but actual experience of market conditions and circumstances 'eventually' amounts to reasonable probability of a trade going as expected.

With backtesting you have to know that the backtested buy/sell price is actually the open/close price and the number of shares available at that price (opening/closing auction) is not known. Volume quoted is for the whole day. In reality you may or may not have your number filled at the volume available and prices do move off open price quickly. Backtest buys and sells assume the order is filled completely at your price every time.

As lone wolf noted, the account drawdown isn't realistic either.

Happy to help with what I have learned but by no means am I a guru or expert. Far from it. :)
 
The more I look in to it, the better off I think I'd be if I just screened for upward trending moving averages, high liquidity, volume spikes and then used my own judgement to do the rest. Rather than trying to make a bullet proof automatic strategy

Well there's your entry now all you need is an exit.
Code it up and see how it goes.
 
Cheers GB.

I first heard about heiken ashi when reading about forex trading and I guess all it is really is a modified candlestick that just colours the candle green on a positive trend.

That code will be filed in folder "theory_26" to revisit one day and remind me that they're not that good.

Do you trade strictly to a mechanical system for your entries and exits or do you just use the software to filter for strong stocks and then use your own judgement to pick the best?

The more I look in to it, the better off I think I'd be if I just screened for upward trending moving averages, high liquidity, volume spikes and then used my own judgement to do the rest. Rather than trying to make a bullet proof automatic strategy.

Cheers,

Nick

I don't trade a system at all, despite having spent a lot of time developing them. I still tinker with them a bit for fun. The only criteria I ever look at are %annual return and smoothness of equity curve. If it's smooth and steep, it's good. Everything else is statistical hoo-haa in my mind.

For the best systems I ever developed, slippage was the biggest problem. Trading small caps on a short time frame (even those with high turnover) will cause this time and again.

Being in a good frame of mind seems to have a massive effect on one's ability to make winning trades. When you're feeling pumped up, getting in sych with the market is easy... and vice versa.
 
Top