Hi Howard,

 yes, na example would be nice.
 I've tried to modify this one (included in the users guide), but I'm
having trouble with referencing the entry price.

/* a sample low-level implementation of Profit-target stop in AFL: */

Buy = Cross( MACD(), Signal() );

priceatbuy=0;

for( i = 0; i < BarCount; i++ )
{
     if( priceatbuy == 0 && Buy[ i ] )
     priceatbuy = BuyPrice[ i ];

     if( priceatbuy > 0 && SellPrice[ i ] > 1.1 * priceatbuy )
     {
       Sell[ i ] = 1;
       SellPrice[ i ] = 1.1 * priceatbuy;
       priceatbuy = 0;
     }
     else
       Sell[ i ] = 0;
} 

 thanks
--- In [email protected], "Howard B" <[EMAIL PROTECTED]> wrote:
>
> Hi pm --
> 
> You will need to write afl code that includes a loop that looks at
the data
> each bar.  Do you know how to do that, or would like an example?
> 
> Thanks,
> Howard
> 
> On Thu, Mar 13, 2008 at 6:09 AM, pmxgs <[EMAIL PROTECTED]> wrote:
> 
> >   Hi all,
> >
> > I would like to implement a "modified trailing stop", that just
> > trails one time, for example I define the trailing stop to trail by
> > 1%. Then, as soon as the price goes up by 1% the stop is raised to the
> > entrypoint level (which is the usual way a trailing stop works), but
> > from this moment on, the stop would stay at that point even if the
> > price rose 10%.
> > Can someone give an hint on how I can accomplish this?
> >
> > thanks
> >
> >  
> >
>


Reply via email to