PureBytes Links
Trading Reference Links
|
Linda,
The problem is that
Cond1 = RSI(14)<30
is always true when RSI is below 30. All you want is
the cross. So, use Cross(30, RSI(14)) instead.
Regards,
Gary
--- Linda Wilmarth <smart@xxxxxxxxxx> wrote:
> 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 ("InitialEquity", 100000);
>
> SetOption ("MaxOpenPositions", Var0);
>
> PositionSize = -100/Var0; // to compound results
>
> BuyPrice = Open;
>
> SellPrice = Close;
>
> SetTradeDelays ( 1, 0, 1, 1); // buy, sell, short,
> cover
>
> // BUY
>
--------------------------------------------------------------
>
>
> Cond1 = RSI(14)<30;
>
> Buy = Cond1 ;
>
> // SELL
>
--------------------------------------------------------------
>
>
> Cond102 = Close > Ref(BuyPrice,-BarsSince(Buy)+1);
>
> Sell = Cond102 ;
>
> Buy = ExRem (Buy, Sell);
>
> Sell = ExRem (Sell, Buy);
>
>
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/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/
|