Mon06172013

Last update12:00:00 AM

BackHomeS&C MagazineDepartmentsTraders' Tips AMIBROKER: EIGHT-BAR SIMPLE MOVING AVERAGE

AMIBROKER: EIGHT-BAR SIMPLE MOVING AVERAGE

In “Trading High-Yield Bonds Using ETFs” in this issue, author Brooke Gardner presents a basic moving average crossover system. Implementation of the moving average (MA) crossover is straightforward and the AmiBroker formula is presented here. To use it, enter the formula into the AFL Editor, then press the “Send to analysis” button to backtest, and “Insert indicator” to see the chart.

Periods = Param("Periods", 8, 2, 100 ); 
movavg = MA( C, Periods ); 
Buy = Cross( C, movavg ); 
Sell = Cross( movavg , C ); 
Plot( C, "Price", colorBlack, styleCandle ); 
Plot( movavg, "MA"+_PARAM_VALUES(), colorBlue );

A sample chart is shown in Figure 6.

Traders' Tips chart

FIGURE 6: AMIBROKER, EIGHT-BAR SIMPLE MOVING AVERAGE. Here is a monthly chart of FAGIX with an eight-month simple moving average (upper window) and the backtest results (lower window).

—Tomasz Janeczko, AmiBroker.com
www.amibroker.com


To read the entire issue click here and subscribe today!

PTSK — The Professional Traders' Starter Kit
Home| Working Money Magazine | S&C Magazine | Traders.com Advantage | Online Store | Traders’ Resource
Add a Product to Traders’ Resource | Message Boards | Subscribe/Renew | Free Trial Issue | Article Code | Search

DEPARTMENTS: Advertising | Editorial | Circulation | Employment | Contact Us | BY PHONE: (206) 938-0570

Join us on Facebook     Follow us on Twitter     Follow Us on StockTwits

Bookmark and ShareCopyright © 1996-2013 Technical Analysis, Inc. All rights reserved. Read our disclaimer & privacy statement.

SUBSCRIBE TO OUR FREE
EMAIL NEWSLETTER!