[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Re: Sell IF Today Open > Entry Price



PureBytes Links

Trading Reference Links

Hello,

EasyLanguage performs IMPLICT loop (hidden from the user thus non-controllable, iterating
the formula as many times as there are bars).
This implict loop among other things makes EasyLanguage way slower than AFL, but allows EntryPrice
constant.

AFL is different because it has NO implict loop that you can not control in any way.

Instead it allows YOU to choose if you want loop for given task or
if you can achieve what you need with ARRAY PROCESSING:

http://www.amibroker.com/guide/h_understandafl.html

Some applications need looping some not. If you need "EntryPrice" you may either
use loop as in the example I provided or use ApplyStop which handles lots of exit scenarios
based on entry price.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "ami_trader" <ami_trader@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Friday, February 18, 2005 8:09 PM
Subject: [amibroker] Re: Sell IF Today Open > Entry Price


> 
> 
> 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
> 
>> > 
>> >
> 
> 
> 
> 
> 
> 
> 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
> 
> 
> 
> 
> 
> 
> 
>


------------------------ Yahoo! Groups Sponsor --------------------~--> 
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/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/