PureBytes Links
Trading Reference Links
|
Graham,
Perhaps I did not explain well enough what I am trying to
do.
In my initial message, I said that I had simplified my code to
help with debugging a problem that I am having. I realize that you can not
expect to always have a profit. In this particular case, though, I want
the code to wait until there is a profit, even if that takes a long time (and
there were many better buys along the way). Once this is working, then I
can change it into a "real" system, not a "debugging" system.
I wanted to do this with the code below, but I guess I'll just
use a profit target instead.
Linda
<BLOCKQUOTE dir=ltr
>
----- Original Message -----
<DIV
>From:
<A title=gkavanagh@xxxxxxxxxxxxx
href="">Graham
To: <A title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: June 22, 2004 9:32 PM
Subject: RE: [amibroker] Problem with
Extraneous Buy Signals
<SPAN
>You are encountering the problems
associated with trading in general. Ho do you know if you should have sold,
when you know that you will have a better buy signal in the next couple of
days. You cannot foretell the future, so you are stuck with an earlier buy
signal than you would otherwise have wanted “in hindsight”. You have made a
sell signal reliant on certain conditions, but if you are not happy with the
fact that you are not getting sell signals when you wanted them you will need
to change the sell conditions. But, then you will find another situation when
you get a sell signal that you don’t want, so do you change the conditions for
that situation, and forego the earlier conditions that you changed
before???
<SPAN
>
<SPAN
>Basically, to me, mechanical
trading like any form of trading, is a balance of getting enough profits to
overcome losses. You will never be able to get 100% profitable trades, so you
try to reduce the losses incurred.
<SPAN
>
<SPAN
>If you only ever want profitable
trades, just have sell signal that is the buyprice + a percent. If you are
lucky enough stocks will go up to reach the sell price signal, but this is not
guaranteed.
<SPAN
>
<SPAN
>Cheers,Graham<A
href="">http://e-wire.net.au/~eb_kavan/
<SPAN
>-----Original
Message-----From: Linda
Wilmarth [mailto:smart@xxxxxxxxxx] <SPAN
>Sent: Wednesday, June 23, 2004 9:54
AMTo:
amibroker@xxxxxxxxxxxxxxx<SPAN
>Subject: Re: [amibroker] Problem with
Extraneous Buy Signals
<FONT face="Times New Roman"
size=2>
<FONT face="Times New Roman"
size=2>Gary,
<FONT face="Times New Roman"
size=2>
<FONT face="Times New Roman"
size=2>This changes the results, but doesn't
solve the problem completely.
<FONT face="Times New Roman"
size=2>
<FONT face="Times New Roman"
size=2>On 2/27/02, the RSI crosses below 30 and
so the system buys on 2/28/02 like it should. The RSI then rises above
30, but the Close is not high enough over the next couple days to make the
Sell condition be True. Then on 3/2/01, the RSI falls below 30
again. Since the system is already in the middle of a trade, there is
not another buy signal, which is what I want.
<FONT face="Times New Roman"
size=2>
<FONT face="Times New Roman"
size=2>But the code now exits when the close is
higher than what the entry would have been on the 2nd (potential) signal
instead of what the entry really was on the first (real) signal. The
system exits at a loss, when I want to always wait until there is a profit
before exiting.
<FONT face="Times New Roman"
size=2>
<FONT face="Times New Roman"
size=2>Linda
<BLOCKQUOTE
>
<SPAN
>----- Original Message -----
<FONT
face=Arial size=2><SPAN
>From:<FONT
face=Arial> <A
title=serkhoshian777@xxxxxxxxx href="">Gary
A. Serkhoshian
<FONT face=Arial
size=2><SPAN
>To:<FONT
face=Arial> <A
title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
<FONT face=Arial
size=2><SPAN
>Sent:<FONT
face=Arial> June 22, 2004 8:37
PM
<FONT face=Arial
size=2><SPAN
>Subject:<FONT
face=Arial> Re: [amibroker] Problem with
Extraneous Buy Signals
<FONT face="Times New Roman"
size=2>
<FONT face="Courier New"
size=2>Linda,<FONT
face="Courier New"><SPAN
>The
problem is that Cond1 =
RSI(14)<30is always true
when RSI is below 30. All you want is<FONT
face="Courier New">the cross. So, use Cross(30, RSI(14))
instead.<FONT
face="Courier New">Regards,<FONT
face="Courier New">Gary---
Linda Wilmarth <<A
href="">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<FONT
face="Courier New">> 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<FONT
face="Courier New">> buys on 4/29/02 and sells on 4/30/02.
> <FONT
face="Courier New">> But if the RSI stays below 30 for more than 1
day,> the code does not
work. For example, the RSI drops<FONT
face="Courier New">> 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<FONT
face="Courier New">> profit that day. But it does not - the RSI is
also> less than 30 on
10/11/00 and the code does not<FONT
face="Courier New">> produce the desired results. It waits
until> 10/12/00 to
sell. Then it buys again on 10/12/00,<FONT
face="Courier New">> which it should since the RSI on 10/11 was less
than> 30, but does not sell
until 2/28/01, when it should<FONT
face="Courier New">> have sold the next day on
10/13/00.>
> I've included the code
below. Anyone have an idea<FONT
face="Courier New">> what I am doing wrong?<FONT
face="Courier New">> >
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<FONT
face="Courier New">><FONT
face="Courier New">--------------------------------------------------------------<FONT
face="Courier New">> >
> Cond1 =
RSI(14)<30;>
> Buy = Cond1
;> <FONT
face="Courier New">> // SELL<FONT
face="Courier New">><FONT
face="Courier New">--------------------------------------------------------------<FONT
face="Courier New">> >
> Cond102 = Close >
Ref(BuyPrice,-BarsSince(Buy)+1);<FONT
face="Courier New">> >
Sell = Cond102 ; >
> Buy = ExRem (Buy,
Sell);>
> Sell = ExRem (Sell,
Buy);>
>
<FONT
face="Courier New">
<FONT
face="Courier New">__________________________________<FONT
face="Courier New">Do you Yahoo!?<FONT
face="Courier New">New and Improved Yahoo! Mail - Send 10MB
messages!<A
href="">http://promotions.yahoo.com/new_mail
Check
AmiBroker web page at:<SPAN
><A
href="">http://www.amibroker.com/<FONT
face="Courier New">Check group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Check AmiBroker web page
at:<SPAN
><A
href="">http://www.amibroker.com/<FONT
face="Courier New">Check group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Check AmiBroker web page at:<A
href="">http://www.amibroker.com/Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
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.
|