| 
 PureBytes Links 
Trading Reference Links 
 | 
Thanks for that Graham. The bigger problem is I get an error message 
saying that I can't use conditions in this format. What does that 
mean?
--- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxx> wrote:
>
> Just this part I think
> High[ i ] >= ProfitTarget + priceatbuy)
> 
> -- 
> Cheers
> Graham
> AB-Write >< Professional AFL Writing Service
> Yes, I write AFL code to your requirements
> http://www.aflwriting.com
> 
> 
> 
> On 16/04/07, bernardedmond01 <bernardedmond01@xxx> wrote:
> > Could someone take a look at this pls?
> > I'm trying to code exiting once price is above buyprice by 3*ATR
(20)
> > at the time of purchase. The basic code is based on the user 
guide
> > but I've gone wrong somewhere.
> > Thanks in advance.
> >
> > BuyATR=ValueWhen(Buy,ATR(20)); // profit
> >
> > ProfitTarget = 3*BuyATR;
> > priceatbuy=0;
> > highsincebuy = 0;
> >
> > exit = 0;
> >
> > for( i = 0; i < BarCount; i++ )
> >
> > {
> >    if( priceatbuy == 0 AND Buy[ i ] )
> >      {
> >        priceatbuy = BuyPrice[ i ];
> >      }
> >
> >    if( priceatbuy > 0 )
> >      {
> >        highsincebuy = Max( High[ i ], highsincebuy );
> >
> >       if( exit == 0 AND
> >           High[ i ] >= ProfitTarget * priceatbuy)
> >        {
> >          // first profit target hit - scale-out
> >          exit = 1;
> >          Buy[ i ] = sigScaleOut;
> >        }
> >
> >   }
> > }
> >
> > SetPositionSize( 50, spsPercentOfPosition * ( Buy ==
> > sigScaleOut ) ); // scale out 50% of position
> >
> >
>
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
<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
    Individual Email | Traditional
<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)
<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 
 |