PureBytes Links
Trading Reference Links
|
i see what you're doing. initializing the EMA with the first close price in the array. it's still slightly different than what yahoo and quote.com are doing. but that seems to be because they are starting from a common date in the past that is different than mine.
Your code matches exactly the built-in EMA fromAB. I also tried to implement a TEMA(14) based on your code but I can't get it to match AB's TEMA. I'm using this code. any suggestions??
Length = 9; factor = 2 /(Length + 1);
Length2 = 14; factor2 = 2 /(Length2 + 1);
expe[ 0 ] = Close[ 0 ]; expe2[ 0 ] = Close[ 0 ];
for ( i = 1; i < BarCount; i++) { expe[ i ] = factor * Close[ i ] + ( 1 - factor) * expe[ i - 1 ]; expe2[ i ] = factor2 * Close[ i ] + ( 1 - factor2) * expe2[ i - 1 ];
ema1 = expe2[i]; ema2 = factor2 * Close[i] + (1 - factor2) * ema1; ema3 = factor2 * Close[i] + (1 - factor2) * ema2; mytema[i] = 3 * ema1 - 3 * ema2 + ema3; }
Filter = Open < 50;
AddColumn(Open, "Open"); AddColumn(Close, "Close"); AddColumn(expe, "EMA"); AddColumn(mytema, "TEMA");
--- In amibroker@xxxxxxxxxxxxxxx, "Erik D. Skyba" <eskyba@xxx> wrote: > > > I write all my own filters so most of the time I use loops. > > Length = param("Length", 1, 1, 100, 1); > > factor = 2 /(Length + 1); > > Exp[ 0 ] = Close[ 0 ]; > > for ( i = 1; i < barcount; i++) > > { > Exp[ i ] = factor * Close[ i ] + ( 1 - factor) * Exp[ i - 1 ]; > } > > Erik Skyba, CMT > > > > bigitop wrote: > > > > Yes, i notice that the initial value used for EMA is the 8 day simple > > moving average. > > > > I would like to match EMA to yahoo.com and quote.com. Does anyone know > > the formula to initialize the EMA? > > > > --- In amibroker@xxxxxxxxxxxxxxx <mailto:amibroker%40yahoogroups.com>, > > "Mike" sfclimbers@ wrote: > > > > > > There is a comment in the user guide referring you to the DEMA where > > it is indicated that the AmiBroker EMA is started from an MA rather than > > the first value. > > > > > > http://www.amibroker.com/guide/afl/afl_view.php?id=44 > > <http://www.amibroker.com/guide/afl/afl_view.php?id=44> > > > http://www.amibroker.com/guide/afl/afl_view.php?id=42 > > <http://www.amibroker.com/guide/afl/afl_view.php?id=42> > > > > > > Mike > > > > > > --- In amibroker@xxxxxxxxxxxxxxx > > <mailto:amibroker%40yahoogroups.com>, "bigitop" doctormuniz@ wrote: > > > > > > > > how does amibroker calculate the EMA?? it is giving me different > > values than yahoo's EMA... anyone knows? > > > > > > > > > > > >
__._,_.___
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
__,_._,___
|