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;