PureBytes Links
Trading Reference Links
|
Graham,
Thanks for the input. When I used your example code I got an error
message telling me that the variable "Buy" must first be
initialized. I changed the code to read, "BarsSince(Buy=1) and the
program appears to run correctly.
Example code:
Setup = H>Ref(HHV(H,54),-1);
Cond1 = Cross(EMA(C,30),C) AND BarsSince(Buy=1)<=30;
Cond2 = Cross(EMA(C,20),C) AND BarsSince(Buy=1)>30;
Cond3 = Cross(Ref(LLV(L,15),-1),C) AND BarsSince(Buy=1)>30;
Buy = Setup;
Sell = Cond1 OR Cond2 OR Cond3;
Thanks again.
--- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxxx> wrote:
> Use format like this
> Cond1 = Cross(ema(c,20),C) and barssince(buy)<=30;
>
> Sell = Cond1 OR Cond2 OR Cond3;
>
> On 7/26/05, mp61276127 <mpalmer@xxxx> wrote:
> > Relatively new to Amibroker. Having difficulty figuring out how
to
> > code multiple exits. For example: Within the first thirty days
of
> > purchase - sell if close crosses below 30 day EMA. After 30
days,
> > sell if close crosses below 20 day EMA. And finally, after 60
days,
> > sell if stock crosses below LLV(close, 15). I assume this is
pretty
> > straight forward but I haven't been able to figure it out. Any
> > assistance?
> >
> > Thanks
> > mp61276127
> >
> >
> >
> >
> >
> > 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 other support material please check also:
> > http://www.amibroker.com/support.html
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
>
>
> --
> Cheers
> Graham
> AB-Write >< Professional AFL Writing Service
> Yes, I write AFL code to your requirements
> http://e-wire.net.au/~eb_kavan/ab_write.htm
------------------------ Yahoo! Groups Sponsor --------------------~-->
Try Online Currency Trading with GFT. Free 50K Demo. Trade
24 Hours. Commission-Free.
http://us.click.yahoo.com/DldnlA/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~->
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 other support material please check also:
http://www.amibroker.com/support.html
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:
http://docs.yahoo.com/info/terms/
|