PureBytes Links
Trading Reference Links
|
Hi Isaac have a look at this and see if its close
to what your after ?
/* trailing stop loss By David
Holzgrefe24.05.2001 */
buy =cross(close,sar());
best=hhv(close,10); //still no good cos 10
may not be the right period
stopLoss = (close < best * 0.97); // 3% drop from
highest 10 day hi
sell = stoploss;
buy = exrem(buy, sell);sell = exrem(sell, buy);
Regards David
<BLOCKQUOTE dir=ltr
>
----- Original Message -----
<DIV
>From:
<A title=dimyon@xxxx
href="">dimyon@xxxx
To: <A title=amibroker@xxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Thursday, May 24, 2001 9:45
PM
Subject: Re: [amibroker] trailing
stop
<FONT
size=+1>Yes, you are right.<FONT
face="Comic Sans MS">
Meanwhile, I
think I've solved my problem. Check this out,
please:<FONT
color=#000099>
enter =
valuewhen( buy, ref(open,1) ,1);<FONT
face="Comic Sans MS">
<FONT
size=+1>days=barssince(buy); <FONT
face="Comic Sans MS"><FONT
size=+1>writeval(days);<FONT
color=#000099>
<FONT
size=+1>time=lastvalue(days); <FONT
face="Comic Sans MS"><FONT
size=+1>writeval(time);<FONT
color=#000099>
<FONT
size=+1>best=hhv(close,time); <FONT
face="Comic Sans MS"><FONT
size=+1>writeval(best);<FONT
color=#000099>
sell =
close/best<0.85 and days>3 or
close/enter<0.6;<FONT
color=#000099>
<FONT
size=+1>Isaac. <FONT
color=#000099>
|