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

[amibroker] QuickAFL question



PureBytes Links

Trading Reference Links

hello everybody,

I would like to have daily moving averages plot on intraday charts. because AB4.40 doesn't have time frame functions I wrote workaround. it works well on 60 min data bars but the shorter interval, the less dots of daily MA are visible. 

q1: is that because of QuickAFL enabled?
q2: if so, is it true that if QuuickAFL enabled and calculus involves variable that depends on its past values (eg. EMA), the calculus will not be exact from point of required data?

I would appreciate any explanation,
regards,
BM

here's my code:

//detecting last day bar
arrLastDayBar = Nz( DateNum()!=Ref(DateNum(),1) );

j = 0;
arrCloseTmp = 0;
for(i=0; i<BarCount; i++) {
	// if bar is day last bar -> put its close into temp array ("sqeezed" version of Close)
	if( arrLastDayBar[i] ) { arrCloseTmp[j] = Close[i] * arrLastDayBar[i]; j++; }
}

//temp array looks like C0,C1,..,C[lastday],0,0,0...0[lastbar]
//evaluate MA of temp array
arrCloseMA = MA(arrCloseTmp, 20);
//and redistribute result through bars
j = 0;
for(i=0; i<BarCount; i++) {
	// if bar is day last bar -> fill cell of temp array with MA value
	if( arrLastDayBar[i] ) { arrCloseTmp[i] = arrCloseMA[j]; j++; }
	// otherwise put zero there
	else arrCloseTmp[i] = 0;
}

// finally plotshapes
PlotShapes( IIf(arrCloseTmp, shapeHollowSmallCircle, shapeNone), colorBlue, 8, arrCloseTmp, 0);


------------------------ 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/