Refer to Optimize reference here: 
http://www.amibroker.com/guide/afl/afl_view.php?id=107

e.g. Continuing with the example at hand...

"Optimize for periods between 50 - 100 days, incrementing by 25 days 
(with a default of 50 days when not optimizing), and a drop of 10 
cents - 25 cents, incrementing by 5 cents (with a default of 10 cents 
when not optimizing)".

Period = Optimize("Period", 50, 50, 100, 25);
Offset = Optimize("Offset", 0.10, 0.10, 0.25, 0.05);
Buy = Close <= MA(Close, Periods) - Offset;

The above would give you many redundant buy signals that you might 
have to remove (via ExRem) depending on your backtesting mode. If 
using the default backtester mode, AmiBroker will handle that for you.

Alternatively, you could use the Cross function and avoid the 
duplicate signals, found here:
http://www.amibroker.com/guide/afl/afl_view.php?name=cross

Mike

--- In amibroker@yahoogroups.com, "longarm61" <[EMAIL PROTECTED]> wrote:
>
> Thanks, Louis, appreciate it.  
> 
> Can anyone tell me how to optimize the "10 cents below" part?  I 
> thought I could figure it out, but I'm not getting anywhwere.
> 
> Thanks,
> 
> Grant
> 
> 
> --- In amibroker@yahoogroups.com, "Louis 
> Préfontaine" <rockprog80@> wrote:
> >
> > Hi,
> > 
> > I am not 100% sure, but what about this:
> > 
> > Close<(MA (C, 14))-0.1
> > 
> > Louis
> > 
> > 
> > 2008/2/26, longarm61 <norm1@>:
> > >
> > >   How would I code "buy when price (close) is at least 10 cents 
> below
> > > MA?" I would like to optimize the "10" but I think I can figure 
> that
> > > part out...I think. ;-)
> > >
> > > Thanks.
> > >
> > > Grant
> > >
> > >  
> > >
> >
>


Reply via email to