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

[amibroker] Re: help with trading system



PureBytes Links

Trading Reference Links

Jayson,

yes I have.

if I run the foolowing code:

// overide default settings
SetTradeDelays(0,0,0,0);

// make a simple trading system
Buy = Cross(RSI(),30);

// buy the next day at the open
// use Ref(Buy -1) because the Ref function returns a value
// so the "1" numbers inside the Buy array are moved forward this way.
Buy = Ref(Buy, -1);

// define the BuyPrice
BuyPrice = ValueWhen( Buy, Open);

SellCond1 = C > BuyPrice * 1.02; 
SellCond2 = C < BuyPrice * 0.96; 
SellCond3 = Cross( BarsSince(Buy), 5 ); 

Sell = SellCond1 OR SellCond2 OR SellCond3;

SellPrice = (SellCond1 * C);
SellPrice = SellPrice + (SellCond2 * C);
SellPrice = SellPrice + (SellCond3 * C);

Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);


for the stock CHKP I get as result in the backtester (last 2 trades):

CHKP	Long	7/3/2002	12.0800	7/5/2002	14.2600	18.0%
	2029.25	18.0%	930.847	11244.6	3273.88	2	9.02%
CHKP	Out	7/5/2002	14.2600	10/4/2002	13.4600	-5.6%
	0.00	0.0%	0	0	3273.88	64	0.00%
CHKP	Long	10/4/2002	13.4600	10/10/2002	13.9900	3.9%
	522.67	3.9%	986.172	13273.9	3796.55	5	0.79%
CHKP	Out	10/10/2002	13.9900	9/26/2003	16.6500	19.0%
	0.00	0.0%	0	0	3796.55	242	0.00%


the trade started at 7/3/2002 should be sold the same day at the 
close. I must have made some error somewhere, maybe in the code?

thanks,

Ed

--- In amibroker@xxxxxxxxxxxxxxx, "Jayson" <jcasavant@xxxx> wrote:
> Ed,
> Do you have "Allow same bar exit" checked?
> 
> Regards,
> Jayson



------------------------ 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/