PureBytes Links
Trading Reference Links
|
in my
opinion it could be done like this (I did not test this so there might be
errors)
rgds, Ed
<FONT face="Courier New" color=#008000
size=3>
//
first you need to define the trade delays. As ApplyStop hits 5 days it needs to
<FONT face="Courier New" color=#008000
size=3>// know when and where to exit. The selldelay I set at 0. The others I
left at 1 <FONT
color=#008000>... for
<FONT
color=#000000>// you to decide what they should
beSetTradeDelays<FONT
color=#000000>(1<FONT
color=#000000>,0<FONT
color=#000000>,1<FONT
color=#000000>,1<FONT
size=3>); <FONT
color=#008000>// define number of days before exit<FONT
size=3> nDays = <FONT
color=#ff00ff>5<FONT
color=#000000>; // define the sell threshold
percentage<FONT
color=#000000> st = 2<FONT
size=3>; <FONT
color=#008000>// now implement the sell rule so when it hits the ApplyStop it
knows what price to take <FONT
color=#000000>// 1) if
on day 5 it opens higher than 2% then sell immediately at the open<FONT
size=3> <FONT
color=#008000>// 2) if on day 5 it opens lower than 2% but the high is greater
than 2% sell at Ref(C,-1) + 2%<FONT
face="Courier New"> // 3) in
all other cases sell at the close<FONT
face="Courier New"> <FONT
color=#000000>SellPrice = <FONT
color=#0000ff>IIf( (<FONT
color=#000000>Open-<FONT
color=#0000ff>Ref(<FONT
color=#000000>C,-<FONT
color=#ff00ff>1))/<FONT
color=#0000ff>Ref(<FONT
color=#000000>C,-<FONT
color=#ff00ff>1)*<FONT
color=#ff00ff>100 > st, <FONT
color=#000000>Open, <FONT
color=#0000ff>IIf((<FONT
color=#000000>H - <FONT
color=#0000ff>Ref(<FONT
color=#000000>C,-<FONT
color=#ff00ff>1))/<FONT
color=#0000ff>Ref(<FONT
color=#000000>C,-<FONT
color=#ff00ff>1)*<FONT
color=#ff00ff>100 > st ,<FONT
color=#0000ff>Ref(<FONT
color=#000000>C,-<FONT
color=#ff00ff>1) + <FONT
color=#0000ff>Ref(<FONT
color=#000000>C,-<FONT
color=#ff00ff>1)*(st/<FONT
color=#ff00ff>100), <FONT
color=#000000>Close<FONT
face="Courier New">) ); <FONT
color=#008000>// execute Applystop<FONT
face="Courier New"> <FONT
color=#0000ff>ApplyStop( <FONT
color=#000000>stopTypeNBar,<FONT
color=#000000>stopModeBars,nDays,ExitAtStop =
1,Volatile = <FONT
color=#000000>False, ReentryDelay =
1<FONT
face="Courier New" size=3> );
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
Werner
To: <A title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Saturday, March 13, 2004 9:22
PM
Subject: [amibroker] How to set up
STOPS
Good day,I am trying to implement some STOPS: How
would I setup the following:Sell 5 days after Entry.On the 5th day
sell 2% higher than Yesterday's Close.If that price can not be achieved,
sell on the Close of that day.(What I am trying to do is catching a
higher Sell Price if it becomes available. If not, sell at the
Close.)Thank you,WernerSend
BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
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
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.
|