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

[amibroker] Re: Time Restriction code... is it OK?



PureBytes Links

Trading Reference Links

Try This:

Hrs1=9;
Hrs2=12;
Hrs3=14;
Hrs4=20;

Buy = Cross( Close, SAR()) AND Hour()>Hr1 AND Hour()<Hr2 AND hour()
>Hr3;
Short = Cross( SAR(), Close) AND Hour()>Hr1 AND Hour()<Hr2 AND hour()
>Hr3;
 
Sell=Hour()==Hr4 OR Hour()==HR2 ; Cover=Hour()==Hr4 OR Hour()==Hr2;

Willem Jan

--- In amibroker@xxxxxxxxxxxxxxx, "netbull2000" <netbull2000@xxxx> 
wrote:
> I want to restrict the trades in my system to the hours between the 
> open and 12:00 and then from 14:00 till the close.
> 
> Here is the condition for opening new trades:
> 
> TimeRest=((Cross( TimeNum(), 140000 ) OR Cross(120000, TimeNum())));
> 
> For the long trades I have:
> Buy = Cross( Close, SAR()) AND TimeRest;
> 
> For the short trades I have: 
> Short = Cross( SAR(), Close) AND TimeRest;
> 
> And this somehow does not work as it should, it throws out a huge 
> number of trades.
> 
> Any idea why this is wrong? And how to do this right?
> 
> TIA,
> Wally


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/ySSFAA/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/