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

Re: [amibroker] Re: Re: Re: Dimitris - Lucas bar counts and re again



PureBytes Links

Trading Reference Links





I am having problems with a system that I am writing.  

 
I have simplified it to the basics for testing purposes.  
At this point, I am testing the system using EOD data for QQQ only.  

 
The system will buy at the next Open if the 14-day RSI is less 
than 30.  Then I want to sell at the first close where I have made a 
profit, which may even be the same day that I buy.
 
The code works fine if the RSI drops below 30 for 1 day only, 
e.g. it buys and sells on 4/17/00, and it buys on 4/29/02 and sells on 
4/30/02.  
 
But if the RSI stays below 30 for more than 1 day, 
the code does not work.  For example, the RSI drops below 30 on 10/10/00 
and the system correctly buys on 10/11/00.  It should sell on the same day 
(10/11/00) because there would have been a small profit that day.  But it 
does not - the RSI is also less than 30 on 10/11/00 and the code does not 
produce the desired results.  It waits until 10/12/00 to sell.  Then 
it buys again on 10/12/00, which it should since the RSI on 10/11 was less than 
30, but does not sell until 2/28/01, when it should have sold the next day on 
10/13/00.
 
I've included the code below.  Anyone have an idea what I 
am doing wrong?
 
Thanks
 
Linda
 

Var0 = 1;
SetOption (<FONT 
color=#ff00ff size=2>"InitialEquity", <FONT 
color=#ff00ff size=2>100000); <FONT color=#0000ff 
size=2>
SetOption <FONT 
size=2>("MaxOpenPositions"<FONT 
size=2>, Var0);
PositionSize <FONT 
size=2>= -<FONT 
color=#ff00ff size=2>100/Var0; <FONT color=#008000 
size=2>// to compound results
BuyPrice = 
Open;
SellPrice = 
Close;
SetTradeDelays ( <FONT color=#ff00ff 
size=2>1, 0<FONT 
size=2>, 1, <FONT 
color=#ff00ff size=2>1); <FONT color=#008000 
size=2>// buy, sell, short, cover<FONT 
color=#008000 size=2>
// BUY -------------------------------------------------------------- 

Cond1 = RSI<FONT 
size=2>(14<FONT 
size=2>)<30<FONT 
size=2>;
Buy = Cond1 ;
// SELL -------------------------------------------------------------- 

Cond102 = Close > Ref<FONT 
size=2>(BuyPrice,-BarsSince<FONT 
size=2>(Buy)+1<FONT 
size=2>);
Sell = Cond102 ; 
Buy = ExRem 
(Buy, Sell);
Sell = ExRem 
(Sell, Buy);


Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html








Yahoo! Groups Sponsor


  ADVERTISEMENT 












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 the Yahoo! Terms of Service.