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

Re: [amibroker] Re: Exit not on day of entry



PureBytes Links

Trading Reference Links

I gather what you want is to enter the trade when O>ref(c,-1)
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 <lhw1@xxxxxxxxxxxxxxx> wrote:
>
> So there is an easy way to code this logic, would I need to use a loop?
>
> Thanks.
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxx> 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 <lhw1@xxx> 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
>
>
>
>
>
>
>
>