Friday, March 23, 2012

MACD Amibroker AFL Code

MACD Indicator is a very popular indicator and is extensively used in the technical analysis in the financial markets.

Those who use Amibroker mostly apply this indicator . However it may happen accidentally that the AFL used for MACD-Moving Average Convergence Divergence is deleted from the software. This brings in a lot of trouble for those who might not be very much familiar with the coding process.

To overcome this problem I am posting the AFL for the indicator here which can be copied from here then applied in the Amibroker software through the Formula Editor .

===========================Copy The Code From Below=======================

_SECTION_BEGIN("MACD");
r1 = Param( "Fast avg", 12, 2, 200, 1 );
r2 = Param( "Slow avg", 26, 2, 200, 1 );
r3 = Param( "Signal avg", 9, 2, 200, 1 );
Plot( ml = MACD(r1, r2), StrFormat(_SECTION_NAME()+"(%g,%g)", r1, r2), ParamColor("MACD color", colorRed ), ParamStyle("MACD style") );
Plot( sl = Signal(r1,r2,r3), "Signal" + _PARAM_VALUES(), ParamColor("Signal color", colorBlue ), ParamStyle("Signal style") );
Plot( ml-sl, "MACD Histogram", ParamColor("Histogram color", colorBlack ), styleNoTitle | ParamStyle("Histogram style", styleHistogram | styleNoLabel, maskHistogram ) );
_SECTION_END();


=======================================================================

For More Amibroker Indicator AFL Codes   CLICK HERE

No comments:

Post a Comment

Risk Disclaimer

Commodity Futures Trading ,Stock & Index Futures and Options trading have large potential rewards, but also large potential risk. You must be aware of the risks and be willing to accept them in order to invest in the futures and options markets. Don’t trade with money you can’t afford to lose. This is neither a solicitation nor an offer to Buy/Sell futures options, or stocks. No representation is being made that any account will or is likely to achieve profits or losses similar to those discussed on this blog. The past performance of any trading system or methodology is not necessarily indicative of future results.

The decision to buy or sell any security that may be selected using information on this blog is done purely at the buyers own risk. Under no circumstances will the owner of the blog be held liable for any losses incurred by the use of information contained on this blog. The risk factor is high in stock trading and only “Risk Capital” should be used in such trading. A person who does not have extra Risk Capital that they can afford to lose, should not trade in the market.