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);
*
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);
*