PureBytes Links
Trading Reference Links
|
I just wanted to backtest a simple "lunar cycles" of buying "Full
Moon" and shorting "New Moon" but could not find a reasonably accurate
formula to generate the full-moon and new-moon dates.
So I web-searched and found the calendar and hard-coded them as
follows:
Dt = DateNum();
DtNext = Ref( DateNum(), 1 );
Buy = Cover =
(Dt<=880104 and DtNext>880104) or
(Dt<=880203 and DtNext>880203) or
...
(Dt<=1040307 and DtNext>1040307) or
(Dt<=1040405 and DtNext>1040405);
Short = Sell =
(Dt<=880119 and DtNext>880119) or
(Dt<=880218 and DtNext>880218) or
...
(Dt<=1040321 and DtNext>1040321) or
(Dt<=1040419 and DtNext>1040419);
The above code works OK for the short history but eats up too much
memory to be usable when the history is long.
Could anyone suggest the memory-efficient way of hard-coding them, or
"simple and elegant" solution?
ysk
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
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|