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

[amibroker] Re: AMA vs EMA, malfunctioning brain



PureBytes Links

Trading Reference Links

dave if you want an EMA with varperiod download indicators.dll and 
use scEMA(array, varperiod)

stephane
wrote:
> I need a poke in the head...
> 
> I wanted a version of the MACD histogram that can take arrays for 
its three
> parameters. I used the array-capable version of EMA provided by 
tomasz, but
> I'm not getting the same results as with the native EMA function, 
even with
> static numbers as parameters. (I said I was doing this to use 
arrays, but
> since even static numbers don't work right, I used them here for
> simplicity.) oddly enough, the results are the same using tomasz's 
EMAx the
> first two times, but using it the third time causes a difference. 
that's the
> one marked with '<<< HERE <<<' below.
> 
> what's wrong with this picture?
> 
> here's the code:
> 
> -----------------
> function EMAx(array, period) { // use for EMA when period is an 
array
> 	return AMA(array, 2 / (period + 1));
> }
> 
> function MACDHistogram() {
> 	if(using_arrays) {
> 		m = EMAx(c, 12) - EMAx(c, 26);// MACD line
> 		s = m - EMAx(m, 9);		// signal line; 
	<<< HERE <<<
> 	} else {
> 		m = EMA(c, 12) - EMA(c, 26);
> 		s = m - EMA(m, 9);
> 	}
> 	hist = m - s;				// histogram
> 	return hist;
> }
> -----------------
> 
> thanks,
> 
> dave


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/