then when next the O>ref(c,-1) occurs exit this trade?
you could try it without the buy==0 in the sell statement, but not sure the results would be what is wanted
Otherwise best to use a loop
--
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
On 06/09/06, compoundinfinity <[EMAIL PROTECTED]> wrote:
So there is an easy way to code this logic, would I need to use a loop?
Thanks.
--- In [email protected], Graham <[EMAIL PROTECTED]> wrote:
>
> you have the sell with the same condition as the buy, so you will
always get
> a buy before the sell is determined
>
> Buy=O>Ref(C,-1);
> Sell= Buy==0 AND O>Ref(C,-1);
> same as saying Sell= Buy==0 AND Buy==1; which can never happen
>
> --
> 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
>
>
> On 06/09/06, compoundinfinity <[EMAIL PROTECTED]> wrote:
> >
> > I am trying to code up a simple system on daily bars where the exit
> > condition is only activated if there was no entry on that day. As an
> > example, I want to buy the open if it is > yesterday's close. A long
> > position is kept until the exit condition is true, which is sell
> > today's open if it is > yesterday's close. Once the sell is
> > activated, we can get a new buy signal tomorrow.
> >
> > This is what I've done but it doesn't work:
> >
> > Buy=O>Ref(C,-1);
> > BuyPrice=O;
> > Sell= Buy==0 AND O>Ref(C,-1);
> > Buy=ExRem(Buy,Sell);
> > SellPrice=O;
> >
> > It only generates 1 long entry at the beginning of the series which is
> > never closed. When I do an exploration it appears to be doing the
> > right thing (the buy vector goes to zero after the initial signal),
> > but the sell vector never returns true even though the condition
is met.
> >
> > Any suggestions as I am stumped.
> >
> > Thanks
> >
> >
> >
> >
> >
> > 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
> >
> >
> >
> >
> >
> >
> >
>
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:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
__._,_.___
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
SPONSORED LINKS
| Software support | Small business finance | Business finance online |
| Business finance training | Business finance course |
YAHOO! GROUPS LINKS
- Visit your group "amibroker" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
__,_._,___
