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

[amibroker] Re: help with trading system



PureBytes Links

Trading Reference Links

Jayson,

thanks. I found the proper buy and sell signals. Still I am 
puzzled ... my super simple code does not give proper results. If I 
execute this code on CTMI I get 3 trades. However, it not always buys 
at the open like I tell it to. Do you agree when looking at the code 
below that it *always* should buy at the open?

Below I show the results of the backtest. It does not buy at the 
open. The first trade takes the low price, the second trade takes the 
open price and the third trade takes some kind of average price as 
the price of entry.

How can this be explained?

regards, Ed

//----------------------------------------------------
// overide default settings, set buy delay at 1 bar
SetTradeDelays(1,0,0,0);

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

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

// define the sell condition
SellCond1 = C > BuyPrice * 1.02; 
SellCond2 = C < BuyPrice * 0.96; 
SellCond3 = Cross( BarsSince(Buy), 5 ); 

Sell = SellCond1 OR SellCond2 OR SellCond3;

// define the SellPrice
SellPrice = ValueWhen( Sell, Close);

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


backtest:

CTMI	Long	7/25/2002	15.7500	7/25/2002	16.5900	5.3%
	533.33	5.3%	634.921	10000	533.333	1	5.33%
CTMI	Out	7/25/2002	16.5900	3/14/2003	17.8190	7.4%
	0.00	0.0%	0	0	533.333	160	0.00%
CTMI	Long	3/14/2003	17.8190	3/14/2003	18.5100	3.9%
	408.47	3.9%	591.129	10533.3	941.804	1	3.88%
CTMI	Out	3/14/2003	18.5100	8/22/2003	13.1000	-29.2%
	0.00	0.0%	0	0	941.804	112	0.00%
CTMI	Long	8/22/2003	13.1000	8/26/2003	13.5800	3.7%
	400.92	3.7%	835.252	10941.8	1342.72	3	1.22%
CTMI	Out	8/26/2003	13.5800	9/26/2003	14.0000	3.1%
	0.00	0.0%	0	0	1342.72	22	0.00%





--- In amibroker@xxxxxxxxxxxxxxx, "Jayson" <jcasavant@xxxx> wrote:
> Are you simply double clicking the trade to plot the arrows or have 
you
> right clicked then chosen "Show actual trades"??
> 
> Try this...  create a new indicator with this code.....
> 
> 
> x = Cross(RSI(),30);
> Plot(RSI(),"",5,1);
> PlotGrid(30,colorWhite);
> Plot(x,"",4,2|styleOwnScale);
> 
> The red lines will show the actual cross. Now run this simple 
system test...
> 
> 
> SetTradeDelays(3,0,0,0);
> Buy= Cross(RSI(),30);
> Sell=Cross(30,RSI());
> 
> Test over enough days to be sure you get a signal. Next rt click a 
trade and
> choose "Show actual trade". I believe you will see the arrow to be 
3 days
> after the red line cross..
> 
> 
> 
> 
> 
> Regards,
> Jayson
is subject to the Yahoo! Terms of Service.


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