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

RE: [amibroker] Re: More simple backtesting questions



PureBytes Links

Trading Reference Links

To close out positions at 3am replace part of the  sell statement as follows

Sell =Cross(EMA(Close,29),EMA(Close,7)) AND DayOfWeek()==5 AND
TimeNum()>=014500 AND TimeNum()<=030000;  
with  
Sell = Cross(EMA(Close,29),EMA(Close,7)) OR Cross(timenum(),030000) );  
This will ensure that you sell on either the EMA cross, or on time out
Then you will need to change the Short to the original Sell statement so
that you do not get the Cross of 030000 as a short signal, and replace the
Cover to include the Timenum() Cross as per the Sell
Hope this makes sense, if not here they are

Buy = Cross(EMA(Close,7),EMA(Close,29)) AND DayOfWeek()==5 AND
TimeNum()>=014500 AND TimeNum()<=030000;

Sell = Cross(EMA(Close,29),EMA(Close,7) ) OR Cross(timenum(),030000) ;  

Short = Cross(EMA(Close,29),EMA(Close,7)) AND DayOfWeek()==5 AND
TimeNum()>=014500 AND TimeNum()<=030000;

Cover = Cross(EMA(Close,7),EMA(Close,29)) OR Cross(timenum(),030000);

Ps hope I got all the brackets correct

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

-----Original Message-----
From: the_real_redleg [mailto:james.hall3@xxxxxxxxxxx] 
Sent: Thursday, 16 October 2003 7:11 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: More simple backtesting questions


Graham,

My browser went 404 ... sorry if this post is a duplicate. 

The problem is that I don't know whether I will be long or short at 
the time I want to exit.

For example, I'm trying to test a EMA Cross strategy of 7/29 with a 
SL of 0.0123 on the USD/EUR 5 minute charts. I only want to consider 
data on Fridays between 1:45 AM and 3:00 AM. At 3 each Friday I want 
all open positions closed. Here is the AFL I'm using to attempt 
that. 

Buy = Cross(EMA(Close,7),EMA(Close,29)) AND DayOfWeek()==5 AND 
TimeNum()>=014500 AND TimeNum()<=030000;
Sell = Cross(EMA(Close,29),EMA(Close,7)) AND DayOfWeek()==5 AND 
TimeNum()>=014500 AND TimeNum()<=030000;
Short=Sell;
Cover=Buy;
ApplyStop(0,2,0.0123,True,False);

Thanks for the quick response!

James


--- In amibroker@xxxxxxxxxxxxxxx, "Graham" <gkavanagh@xxxx> wrote:
> Try
> Sell = Timenum()==yourtime and Datenum()=yourdate
> I might be able to be more specific with more detail of the times 
etc you
> want to close positions
> 
> 
> Cheers,
> Graham
> http://groups.msn.com/ASXShareTrading
> http://groups.msn.com/FMSAustralia
> 
> -----Original Message-----
> From: the_real_redleg [mailto:james.hall3@x...]
> Sent: Thursday, 16 October 2003 4:20 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] More simple backtesting questions
> 
> 
> Thanks to Graham and Yuki for answering my previous question! :)
> 
> Is there an AFL command for "close all open positions at this
time?" 
> I'm backtesting FOREX (EUR/USD)5 minute charts for specific time
> periods during specific days. But at the end of each time period I 
> would like to close all open positions. 
> 
> Also, how can I set the backtester so that all trades are 1 lot
(for 
> EUR/USD that means equivalent $100,000 USD per trade.) I have
> entered 100000 in the "set round lot size" function, but it 
appears 
> to trade multiple lots if the current ballance permits. How can I
> limit it to 1 lot only for all trades?
> 
> Thanks!
> 
> James
> 
> 
> 
> 
> Send BUG REPORTS to bugs@xxxx
> Send SUGGESTIONS to suggest@xxxx
> -----------------------------------------
> 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/




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/