For these types of problems, it often helps to break up the 
conditions for easier understanding.

Using your example, what about something like:

Low1 = Ref(LLV(L,2),-1);
Low2 = ValueWhen(Buy,Ref(L,-1)-0.01);

Sell = L < Low1 OR L < Low2;

SellPrice = IIF(L < Low1,
  IIF(L < Low2,
    max(Low1, Low2),
    Low1),
  IIF(L < Low2,
    Low2,
    0)
);

I'm assuming that if both conditions are met, then the one that 
happened first (i.e. the higher price point) would be the selling 
price.

Mike

--- In [email protected], "alta hob" <[EMAIL PROTECTED]> wrote:
>
> Hi
> 
> 
> I am trying to do something similar but need my sellprice to 
execute at the
> point the sell criteria below is hit
> 
> Sell = L < Ref(LLV(L,2),-1) OR L<ValueWhen(Buy,Ref(L,-1)-0.01);
> 
> Can someone please show me how to add the sellprice code to this?
> 
> 
> thanks
> 
> 
> On Sat, Apr 26, 2008 at 12:03 AM, safetrading <[EMAIL PROTECTED]> 
wrote:
> 
> >   Thanks Graham;
> >
> > That was exactly what I needed. I use Valuewhen all the time, for
> > some reason I just drew a blank on this. I think the "buy" 
variable
> > threw me, as I have never really done anything with it except put 
my
> > formula there.
> >
> > Anyways, thanks very much.
> >
> > Safetrading
> >
> >
> > --- In [email protected] <amibroker%40yahoogroups.com>, 
Graham
> > <kavemanperth@> wrote:
> > >
> > > Valuewhen is useful for this
> > > I assume you are entering on same bar as buuy signal. This line
> > gives
> > > you the low of the bar before buy signal
> > >
> > > sell=L<valuewhen(buy,ref(l,-1)-0.01);
> > >
> > >
> > >
> > > --
> > > Cheers
> > > Graham Kav
> > > AFL Writing Service
> > > http://www.aflwriting.com
> > >
> > >
> > >
> > > 2008/4/26 safetrading <safetrading@>:
> >
> > > > This is probably easy for most of you, but I just can't seem 
to
> > > > figure this out.
> > > >
> > > > I'm using one tick above the high of the previous day for an
> > entry
> > > > point and trying to create an exit rule where for a long
> > position,
> > > > the exit would be one tick below the low of the day prior to 
the
> > > > entry day ( the same days where I got my entry point from)
> > until a
> > > > low exists that is above the high of my entry point, at which
> > time
> > > > the exit would then become one tick below that low and 
continue
> > to
> > > > follow the trade like this; sell=L<ref(l,-1)-0.01;
> > > >
> > > > So what I need to do is label and hang on to the "one tick
> > below"
> > > > the low of the day prior to entering. I believe I need to use
> > the
> > > > Hold function, but am not sure how to identify the price 
point I
> > > > need.
> > > >
> > > > Any suggestions would be appreciated.
> > > >
> > > > Thanks,
> > > >
> > > > Safetrading
> > > >
> > > >
> > > >
> > > >
> > > > ------------------------------------
> > > >
> > > > 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