[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] MACD that uses SMAs



PureBytes Links

Trading Reference Links

Hi AD --

Here is afl code that computes the MACD --
first using exponential moving averages,
then using simple moving averages.

Change the 12, 26, and 9 to be whatever
you want them to be.

One of the reasons for using exponential moving averages
instead of simple moving averages is to reduce the lag.

------------------------------------------

// MACDExplanation.afl
//

Price = C;

// Traditional method of computing MACD using
// exponential moving averages
EMA1 = EMA(Price,12);
EMA2 = EMA(Price,26);

EDiff = EMA1-EMA2;
ESignal = EMA(EDiff,9);

// Using simple moving averages instead
SMA1 = MA(Price,12);
SMA2 = MA(Price,26);

SDiff = SMA1-SMA2;
SSignal = MA(SDiff,9);

Plot(C,"C",colorBlack,styleCandle);

Plot(EDiff,"EDiff",colorRed,styleLine|styleLeftAxisScale);
Plot(ESignal,"ESignal",colorBlack,styleLine|styleLeftAxisScale);

Plot(SDiff,"SDiff",colorPink,styleLine|styleLeftAxisScale);
Plot(SSignal,"SSignal",colorBrown,styleLine|styleLeftAxisScale);

Plot(0,"",colorBlack,styleLine|styleLeftAxisScale);

---------------------------

Thanks,
Howard
www.quantitativetradingsystems.com



On 9/30/07, ad198500328 <ad198500328@xxxxxxxxx> wrote:

Hello,

i am trying to figure out the amibroker language but it is tough to
say the least. Could someone give me the code to make an MACD
(3,10,16) that uses SMAs instead of EMAs?

Thanks


__._,_.___

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___