I wasn't completely clear:
EMA requires integers.
AMA requires a smoothing factor between
0 and 1.
You are now using integers in AMA, see red below. This won't
work. (Before your value was 2 / (1 + .213) = 1.6488). Use SmoothingFactor1 in
your AMA formula with the FastLength = integer value as you have it. This will
provide the required value 0-1. If you simply need the values you show (0.108)
you don't need to compute a smoothing factor, just use it in the AMA formula.
However, given the formula you found, I
believe you will need to build a loop to compute this bar by bar as EMA and AMA
are both array formulas that compute all bars at once.
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Tony Lei
Sent: Tuesday, March 28, 2006
15:19
To: [email protected]
Subject: Re: [amibroker] Dinapoli
MACD
It
still does not work.
These are the settings :
fast= .108, slow = .213, average = .199
Formula:
EMA1current = EMA1previous + SF1 ( Close -
EMA1previous )
EMA2current = EMA2previous + SF2 ( Close -
EMA2previous )
MACDcurrent = EMA1current - EMA2current
Signal Line = MACD previous + SLSF ( MACDcurrent -
MACDprevious )
SF=2/(N+1)
//Dinapoli MACD
FastLength
= Param("FastLength",8,0,36,2);
SlowLength = Param("SlowLength",17,0,52,2);
MACMA = Param("MACMA",9,0,15,1);
SmoothingFactor1 = 2 / ( fastlength + 1 ) ;
SmoothingFactor2 = 2 / ( slowlength + 1 ) ;
SmoothingFactor3 = 2 / ( MACMA + 1 ) ;
EMA1 = AMA (Close,fastlength) ;
EMAfast = EMA1 + ( SmoothingFactor1 * (Close-EMA1)
) ;
EMA2 = AMA (Close,slowlength) ;
EMAslow = EMA2 + ( SmoothingFactor2 * (Close -
EMA2) ) ;
MACD1 = EMAfast-EMAslow ;
Plot( MACD1,
StrFormat(_SECTION_NAME()+"(%g,%g)", fastlength,slowlength),
ParamColor("MACD color", colorRed ), ParamStyle("MACD style")
);
On
3/28/06, Terry <[EMAIL PROTECTED]> wrote:
EMA requires bars (or
days) as integers. You are using a formula that converts number of bars (as
integers) into a fractional smoothing factor. This smoothing factor works with
AMA and should be between 0 and 1.00. Change your two EMA() to AMA() and your
Param statements must use integers if you're going to use smoothing. The param
statement should be something like this:
FastLength = Param("FastLength",8,2,200,1);
-----Original Message-----
From: [email protected]
[mailto: [email protected]
] On Behalf Of Tony Lei
Sent: Tuesday, March 28, 2006 13:22
To: [email protected]
Subject: [amibroker] Dinapoli MACD
There is something wrong with this formula and I can't
figure it out.
FastLength = Param("FastLength",.213,0,36,2);
SlowLength =
Param("SlowLength",.108,0,52,2);
MACMA = Param("MACMA",.199,0,15,1);
SmoothingFactor1 = 2 / ( fastlength + 1 ) ;
SmoothingFactor2 = 2 / ( slowlength + 1 ) ;
SmoothingFactor3 = 2 / ( MACMA + 1 ) ;
EMA1 = EMA (Close, fastlength) ;
EMAfast = EMA1 + ( SmoothingFactor1 * (Close-EMA1)
) ;
EMA2 = EMA (Close, slowlength );
EMAslow = EMA2 + ( SmoothingFactor2 * (Close -
EMA2) ) ;
MACD1 = EMAfast-EMAslow ;
Plot (MACD1, "", 5, 4 ) ;
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 other support material please check also:
http://www.amibroker.com/support.html
YAHOO! GROUPS LINKS
§
Visit your group "amibroker" on
the web.
§
To unsubscribe from
this group, send an email to:
[EMAIL PROTECTED]
§
Your use of Yahoo!
Groups is subject to the Yahoo!
Terms of Service.
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 other support material please check also:
http://www.amibroker.com/support.html
SPONSORED LINKS
YAHOO! GROUPS LINKS