Applying Steve's answer generically, such that you can test different 
periods, you can use the Sum function 
http://www.amibroker.com/guide/afl/afl_view.php?name=sum

periods = Optimize("Periods", 2, 2, 5, 1);
Sell = Sum(Close < Ref(Close, -1), periods) == periods;


--- In amibroker@yahoogroups.com, "Steve Dugas" <[EMAIL PROTECTED]> wrote:
>
> If you want to exit after 2 consecutive lower closes, try this...
> 
> Sell = Close < ref( Close, -1 ) AND ref( Close, -1 ) < ref( Close, -
2 );
> 
> Steve
> 
> ----- Original Message ----- 
> From: "Steve Carlsson" <[EMAIL PROTECTED]>
> To: "Amibroker" <amibroker@yahoogroups.com>
> Sent: Tuesday, March 04, 2008 6:05 AM
> Subject: [amibroker] Sell trigger
> 
> 
> >
> > Hello
> >
> > Can anyone offer some help please...
> >
> > I want my trades to exit if the sell condition below is met:
> >
> > Sell= C < Ref(LLV(C,2),-1);
> >
> > What it is supposed to do is exit a trade if the closing price is 
lower 
> > for
> > 2 consecutive days...the 2 is a variable I want to test....
> >
> > My other effort at this formula is below:
> >
> > Sell =  (Ref(C,-1)>Ref(LLV(L,2),-2) AND C < Ref(LLV(L,2),-1));
> >
> > The problem is that firstly I dont understand the difference 
between the 2
> > formula, and also even though they appear to plot correctly I 
cant be sure
> > they are robust..
> >
> > Thanks in advance
> >
> > Steve Carlsson
> > Home and Property Maintenance
> > 12 WInsham Rd
> > KARRINYUP WA 6018
> > 0432990469
> >
> >
> > Please note that this group is for discussion between users only.
> >
> > To get support from AmiBroker please send an e-mail directly to
> > SUPPORT {at} amibroker.com
> >
> > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> > http://www.amibroker.com/devlog/
> >
> > For other support material please check also:
> > http://www.amibroker.com/support.html
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
>


Reply via email to