PureBytes Links
Trading Reference Links
|
Hi Rik,
Buy/Sell variables expect expressions that resolve to True or False(1 or
0)...
your code:
Buy = BuyPrice;
Sell = SellPrice;
OTOH, attempts to set them to other than 1 or 0.
-john
----- Original Message -----
From: "Rik Rasmussen" <hrasmussen@xxxxxxxxx>
To: "Amibroker" <amibroker@xxxxxxxxxxxxxxx>
Sent: Saturday, July 03, 2004 8:49 AM
Subject: [amibroker] simple Back Test
I am trying to do a simple Back Test where I buy at close on a set date and
sell at close on last date. It does not work.
I am stumped.
/* This script reports the gain of the stocks in a portfolio*/
/*use Parameters to set number of days*/
/*Explore*/
Filter=1;
Filter = Ref( C,-1 ) != C;
StartClose = Ref( Close, -Param( "Days", 21, 1, 50, 1 ));
//Gain = Ref (C - StartClose);
AddColumn( C, "Close" );
AddColumn( StartClose, "StartClose" );
AddColumn(C - StartClose, "Gain");
AddColumn((((C-StartClose)/StartClose)) *100, "% Gain");
/*Back Test Rules, Buy at close on date set in Parameters, Sell on last
Close*/
SetTradeDelays(0,0,0,0);
BuyPrice = Ref ( Close, -Param( "Days", 21, 1, 50, 1 ));
SellPrice = C;
Buy = BuyPrice;
Sell = SellPrice;
Rik Rasmussen
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
------------------------ Yahoo! Groups Sponsor --------------------~-->
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/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/
|