PureBytes Links
Trading Reference Links
|
<SPAN
class=495053616-11042003>Phsst,
<SPAN
class=495053616-11042003>something to consider.... -.50 is a much
different number on a $100 stock than it is on a $10 stock
Jayson
<FONT face=Tahoma
size=2>-----Original Message-----From: phsst
[mailto:phsst@xxxxxxxxx]Sent: Friday, April 11, 2003 12:28
PMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] Re:
Trailing StopsThis sample is unique to my own trading
systems but you should be ableto manipulate this code as needed. The
trailing Stop is set atprevious days close minus 0.50, and if the stock
Opens below thatfigure then it takes you out of the trade at the Open price.
And thisparticular trading system does not set a Stop Loss on the day that
aposition is entered.Just my way of doing it.Good luck...
PhsstSetTradeDelays(1,0,0,0); // Affects Back Test (not Scan or
Explore)Buy = <buy condition>LongBars = BarsSince(Buy==0);
// Used to prevent S/L on 1st daySellPrice = IIf(LongBars == 2,0,Ref(L -
.50,-1)); // No S/L 1st Day-(2 needed for
SetTradeDelays)PrevSellPrice = IIf(SellPrice == 0,0,Ref(L -
.50,-1)); // Trailing SellPrice =
Max(SellPrice,PrevSellPrice);
// StopSellPrice =
Min(SellPrice,O);
// LossSell = L <=
SellPrice;--- In amibroker@xxxxxxxxxxxxxxx, "Tony/Dianne"
<awenos@xxxx> wrote:> Hello,> > For the past several
days, I have been trying to code a TrailingStop without success.>
> I'm using both AFL and VB Script.> > My problem is that I
always seem to end up with a circular referenceproblem which> boils
down to: I need a Trailing stop variable to define the Sellcondition
and I need> the Sell condition to define the Trailing stop
variable.> > Can anyone give me advice/code sample to
help?> > As an aside, I've looked at the ApplyStop function and it
does notseem to do what I> am seeking . > > My
goal is, for a long entry, to have an amount defined by the ATRfunction,
which is subtracted from> the low creating the stop level. The stop
level would then trail uponly.> > Any help would be
appreciated.> > Regards,> > TonySend
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
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
Yahoo! Groups Sponsor
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
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
|