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

[amibroker] *HELP NEEDED* Faster "take only 1st signal of the day" code?



PureBytes Links

Trading Reference Links


I'm currently using these codes to get auto backtester to buy/sell 
on the first signal generated during the day:

-----------------------------
LongSignal = xxx;
ShortSignal = xxx;

NewDay = DateNum() != Ref(DateNum(),-1);
BuyNum = Cum(LongSignal);
DailyBuyNum = BuyNum - ValueWhen(NewDay,BuyNum);

ShortNum = Cum(ShortSignal);
DailyShortNum = ShortNum - ValueWhen(NewDay,ShortNum);

Buy = LongSignal AND DailyBuyNum == 1 AND DailyShortNum == 1;
Short = ShortSignal AND DailyBuyNum == 1 AND DailyShortNum == 1;
------------------------------

The Cum() function lags my amibroker a lot when used to backtest 
years of data.
Any ideas to optimize these codes?

Is there a shorter way to make amibroker detect signals as they 
happen intra-day and start afresh the next? (Like check for x 
occurrance of a pattern within each day)

Thanks!!!





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

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/