PureBytes Links
Trading Reference Links
|
Dimension,
I think the following might work.
buyCond = ( Month( ) == 2 ) and (ref(month(),-1) ==1)
sellCond=BarsSince(BuyCond)==14;
BTW are you on iHub with the same nick ?
--- In amibroker@xxxxxxxxxxxxxxx, dimension <dimension@xxxx> wrote:
> 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@x...]
> 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
>
>
>
>
> _____
>
> 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
> <mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe>
>
> * Your use of Yahoo! Groups is subject to the Yahoo!
> <http://docs.yahoo.com/info/terms/> Terms of Service.
------------------------ Yahoo! Groups Sponsor --------------------~-->
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/cosFAA/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/
|