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

RE: [amibroker] Exploration problem



PureBytes Links

Trading Reference Links

Hmmm…I think I may know what it is. I believe it is the “Day() == 1”.  That may fall on a non-trading day, such as the weekend.

 

How can I say “Buy the first trading day of February, and sell On February 14 or the first trading day after BEFORE that”?

 


From: dimension [mailto:dimension@xxxxxxxxxxxxx]
Sent: Wednesday, February 02, 2005 11:35 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Exploration problem

 

I am trying to write an exploration/backtest that Buys on Feb 1st, and sells 14 days later. The code below works, but only seems to show results for 2000 and 2001. The ticker I am using is FLWS.  I have daily data for it from 1999 to today.  Range is set to “All Quotations”.  Anyone see any flaws?

 

DAYSTOHOLD = 14;

DAYB4BUY = DAYSTOHOLD + 1;

 

buyCond = ( Month( ) == 2 ) && ( Day( )== 1 );

sellCond = BarsSince( buyCond ) == DAYSTOHOLD ;

 

BuyPrice = Ref( C, -( DAYSTOHOLD ) );

priceB4BUY = Ref( C, -( DAYB4BUY ) );

 

Buy=buyCond; Sell = sellCond;

 

AddColumn( priceB4BUY, "P B4 Buy");

AddColumn( BuyPrice, "Buy");

AddColumn( C, "Sell");

AddColumn ( C - BuyPrice , "G/L", 1.2);

AddColumn ( ( ( C - BuyPrice ) / C ) * 100, "%G/L", 1.2);

 

Filter = Sell;



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

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html





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