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

Heikin Ashi Trading System




Heikin-Ashi is a trend visualization technique based on Japanese candlestick charting. In-fact, Heikin-Ashi is also a type of candlestick, whose OHLC value differs from the traditional candlesticks. In Japanese, Heikin means “average” and “ashi” means “pace” . Taken together, Heikin-Ashi represents the average-pace of prices. Heikin-Ashi Candlesticks use the open-close data from the prior period and the open-high-low-close data from the current period to create a combo candlestick. In this post we would reveal a Heikin Ashi Trading System coded in Amibroker AFL. This system is optimized for NSE:Banknifty but should work well for other instruments too.
Analyzing price patterns in Heikin-Ashi charts is far more simpler and visually appealing as compared to traditional candlestick charts. See the below image:

Heikin-Ashi Chart


Calculating Heikin-Ashi prices
As discussed above, OHLC value for Heikin-Ashi charts differs from the traditional candlestick charts. It is calculated using the below formula:
  • HAClose = (Open+High+Low+Close)/4
    o Average price of the current bar
  • HAOpen = [HAOpen(Previous Bar) + HAClose(Previous Bar)]/2
    o Midpoint of the previous bar
  • HAHigh = Max(High, HAOpen, HAClose)
    o Highest value in the set
  • HALow = Min(Low, HAOpen, HAClose)
    o Lowest value in the set

Heikin-Ashi Trading rules

Below are the 5 important rules (from Investopedia) which should be followed while trading with Heikin-Ashi technique:
  • Green candles with no lower “shadows” indicate a strong uptrend: let your profits ride
  • Green candles signify an uptrend: you might want to add to your long position, and exit short positions.
  • One candle with a small body surrounded by upper and lower shadows indicates a trend change: risk-loving traders might buy or sell here, while others will wait for confirmation before going short or long.
  • Red candles indicate a downtrend: you might want to add to your short position, and exit long positions.
  • Red candles with no higher shadows identify a strong downtrend: stay short until there’s a change in trend.
In the next section,  we’ll go through an AFL and backtest report for this Heikin Ashi Trading System. 

Heikin Ashi Trading System – AFL Overview

ParameterValue
Preferred Time-frameDaily
Indicators UsedEMA
Buy ConditionFormation of Heikin-Ashi green candle with Open=Low, and Close>40 period EMA of Close
Short ConditionFormation of Heikin-Ashi red candle with Open=High, and Close<40 period EMA of Close
Sell Condition
  • Same as Short
  • Stop Loss Hit
  • Close<40 period EMA of Close
Cover Condition
  • Same as Buy
  • Stop Loss Hit
  • Close>40 period EMA of Close
Stop Loss1%
TargetsNo fixed target
Position Size120 Quantities
Initial Equity200000
Brokerage50 per order
Margin10%

Heikin Ashi Trading System – AFL Code

//------------------------------------------------------
//
//  Formula Name:    Heikin Ashi Trading System
//  Author/Uploader: BrokeyForAmiBroker
//  E-mail:          brokeyforamibroker@gmail.com
//  Website:         brokeyforamibroker.blogspot.in
//------------------------------------------------------


_SECTION_BEGIN("Heikin Ashi Trading System");

SetOption( "InitialEquity", 200000);
SetTradeDelays( 1, 1, 1, 1 );
SetOption("FuturesMode" ,True);
SetOption("MinShares",1);
SetOption("CommissionMode",2);
SetOption("CommissionAmount",50);
SetOption("AccountMargin",10);
SetOption("RefreshWhenCompleted",True);
SetPositionSize(120,spsShares);
SetOption( "AllowPositionShrinking", True );

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

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

barcolor = IIf(HaClose >= HaOpen,colorGreen,colorRed);

PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "", barcolor, styleCandle );

printf("\nHaOpen : " + HaOpen );  
printf("\nHaHigh : " + HaHigh );  
printf("\nHaLow : " + HaLow );  
printf("\nHaClose : " + HaClose );  

Candles=param("Candles",1,1,5,1);
periods=param("periods",40,10,200,10);

Buy = Sum(HaClose >= HaOpen,Candles)==Candles AND HaOpen==HaLow AND C>EMA(C,periods);
Short= Sum(HaClose <= HaOpen,Candles)==Candles AND HaOpen=HaHigh AND C<EMA(C,periods);
Sell=Short OR C<EMA(C,periods);
Cover=Buy OR C>EMA(C,periods);

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

Stoploss=param("SL",1,1,5,1);

ApplyStop(Type=0,Mode=1,Amount=StopLoss);


/* 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(Cover, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Cover, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Cover, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, 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);


_SECTION_END();

AFL Screenshot


Heikin Ashi AFL

Heikin Ashi Trading System – Backtest Report

ParamterValue
Fixed Position Size
Initial Capital200000
Final Capital1726506.44
Scrip NameNSE Banknifty
Backtest Period01-Mar-2000 to 09-Mar-2016
TimeframeDaily
Net Profit %763.25%
Annual Return %13.94%
Number of Trades276
Winning Trade %25.36%
Average holding Period11.88 periods
Max consecutive losses18
Max system % drawdown-75.62%
Max Trade % drawdown-32.42%
Clearly, drawdown is on a higher side. It could be overcome with proper Risk Management strategies

Equity Curve


Heikin Ashi 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 40 and margin requirement of 10% for NSE Banknifty:
Banknifty Symbol Information

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

heiken ashi trading system
heiken ashi trading system for amibroker (afl)
heiken ashi trading system pdf
heiken ashi trading system for amibroker
heikin ashi trading system amibroker
heikin ashi fibonacci trading system
heiken ashi smoothed trading system
heiken ashi forex trading system
heiken ashi stock trading system
modified heikin ashi fibonacci trading system
heiken ashi trading system afl
trading system con heikin ashi
the modified heikin ashi fibonacci trading system download
the modified heikin ashi fibonacci trading system ebook
the modified heikin ashi fibonacci trading system pdf
the modified heikin ashi fibonacci trading system

No comments:

Post a Comment