| 
 PureBytes Links 
Trading Reference Links 
 | 
Thank you Tomasz, now it works exactly.
I had written similar code with "for loop" but I thought there was a 
more easy way.
Why in afl there is not a constant like "EntryPrice" 
in "EasyLanguage"?
Thanks.
--
Giuseppe
--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxxx> 
wrote:
> Hello,
> 
> ValueWhen reports last occurrence while it may not be
> the bar when actual buying took place. Instead use this code:
> 
> Buy = O > Ref( 0, -1 ); 
> 
> priceatbuy=0; 
> for( i = 0; i < BarCount; i++ ) 
> { 
>      if( priceatbuy == 0 && Buy[ i ] ) 
>      priceatbuy = BuyPrice[ i ]; 
> 
>      if( priceatbuy > 0 && Open[ i ] > priceatbuy ) 
>      { 
>        Sell[ i ] = 1; 
>        SellPrice[ i ] = Open[ i ]; 
>        priceatbuy = 0; 
>      } 
>      else 
>        Sell[ i ] = 0; 
> } 
> 
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
 
> > 
> >
------------------------ Yahoo! Groups Sponsor --------------------~--> 
In low income neighborhoods, 84% do not own computers.
At Network for Good, help bridge the Digital Divide!
http://us.click.yahoo.com/EpW3eD/3MnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links
<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/
<*> 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/
 
 |