[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Trailing Stops



PureBytes Links

Trading Reference Links

Phsst,

So how does your "grail" system look with the portfolio equity curve 
indicator ?

--- In amibroker@xxxxxxxxxxxxxxx, "phsst" <phsst@xxxx> wrote:
> > Phsst,
> > something to consider....   -.50 is a much different number on a
> $100 stock
> > than it is on a $10 stock
> 
> Yes I know. For illustration purposes only.
> 
> Phsst
> 
> > 
> > Jayson
> > -----Original Message-----
> > From: phsst [mailto:phsst@x...]
> > Sent: Friday, April 11, 2003 12:28 PM
> > To: amibroker@xxxxxxxxxxxxxxx
> > Subject: [amibroker] Re: Trailing Stops
> > 
> > 
> > This sample is unique to my own trading systems but you should be 
able
> > to manipulate this code as needed. The trailing Stop is set at
> > previous days close minus 0.50, and if the stock Opens below that
> > figure then it takes you out of the trade at the Open price. And 
this
> > particular trading system does not set a Stop Loss on the day 
that a
> > position is entered.
> > 
> > Just my way of doing it.
> > 
> > Good luck... Phsst
> > 
> > 
> > 
> > SetTradeDelays(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 day
> > 
> > SellPrice = 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);                //    
Stop
> > 
> > SellPrice = Min(SellPrice,O);                            //       
Loss
> > 
> > Sell = L <= SellPrice;
> > 
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "Tony/Dianne" <awenos@xxxx> 
wrote:
> > > Hello,
> > >
> > > For the past several days, I have been trying to code a Trailing
> > Stop without success.
> > >
> > > I'm using both AFL and VB Script.
> > >
> > > My problem is that I always seem to end up with a circular 
reference
> > problem which
> > > boils down to:  I need a Trailing stop variable to define the 
Sell
> > condition 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 
not
> > seem to do what I
> > > am seeking .
> > >
> > > My goal is, for a long entry, to have an amount defined by the 
ATR
> > function, which is subtracted from
> > > the low creating the stop level.  The stop level would then 
trail up
> > only.
> > >
> > > Any help would be appreciated.
> > >
> > > Regards,
> > >
> > > Tony
> > 
> > 
> >       Yahoo! Groups Sponsor
> >             ADVERTISEMENT
> > 
> > 
> > 
> > 
> > Send BUG REPORTS to bugs@xxxx
> > Send SUGGESTIONS to suggest@xxxx
> > -----------------------------------------
> > 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.


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Rent DVDs Online-No late fees! Try Netflix for FREE!
http://us.click.yahoo.com/YKLNcC/oEZFAA/i5gGAA/GHeqlB/TM
---------------------------------------------------------------------~->

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 http://docs.yahoo.com/info/terms/