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

RE: [amibroker] AFL formula very slow



PureBytes Links

Trading Reference Links

Why not use the timeframe functions instead of the function if you are using
the betas 4.4+
An example

DayH = Timeframegetprice("H", indaily, -1);
DayL = Timeframegetprice("L", indaily, -1);



Cheers,
Graham
http://groups.msn.com/ASXShareTrading
http://groups.msn.com/FMSAustralia 

-----Original Message-----
From: black_marubozu [mailto:black_marubozu@xxxxxxxxx] 
Sent: Sunday, 16 November 2003 11:57 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] AFL formula very slow


hello everybody,

I've written short formula in AFL that plots pivot points on intraday
charts. but it is very slow and I don't know how to eliminate drawing
everywhere except the day before current day. could anybody help me to
optimize and improve this code if possible? I'd appreciate ny help and
suggestions.

thanks,
BM

here comes the code:

//
colorOfAxes = colorBlack;

function fSelectDayAgo( n ) {
	return IIf( DateNum()==LastValue(ValueWhen(DateNu
m()!=Ref(DateNum(),1), DateNum(), n)), 1, 0);
}

arrSelectedDay = fSelectDayAgo(1);

SelectedDayH = LastValue(Highest(High*arrSelectedDay));
SelectedDayL = LastValue(Lowest(IIf(Low*arrSelectedDay,
Low*arrSelectedDay, SelectedDayH+1)));
SelectedDayC = LastValue(ValueWhen(DateNum()!=Ref(DateNum(),1),
Close, 1));

PP = (SelectedDayC + SelectedDayL + SelectedDayH)/3;

Plot( arrSelectedDay*PP, "PP", IIf(arrSelectedDay, colorBlue, colorOfAxes),
styleNoLabel+styleDots+styleNoLine);
Plot( arrSelectedDay*(2*PP-SelectedDayL), "Resistance", IIf(arrSelectedDay,
colorRed, colorOfAxes), styleN
oLabel+styleDots+styleNoLine);
Plot( arrSelectedDay*(2*PP-SelectedDayH), "Support", IIf(arrSelectedDay,
colorGreen, colorOfAxes), styl
eNoLabel+styleDots+styleNoLine);
//


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


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