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

Re: [amibroker] Re: Question: How to make the code run faster ?



PureBytes Links

Trading Reference Links

Cum(B) is the culprit. There are way better ways to find
"first occurrence", like this single-liner:

 ExRem( B, 0 ); // returns 1 on FIRST occurrence of B.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "itmwh" <toxutao@xxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Wednesday, June 06, 2007 2:23 AM
Subject: [amibroker] Re: Question: How to make the code run faster ?


> Hi, TJ
> 
> I checked  my AFL codes and found it costs 5-7 secondes and 
> virtually takes all past bars in the calculation of every bar.  I 
> think it may be the fact that I use the function " cum()".  I am 
> using this function because I want to express the idea of "first 
> incurrence of ....."
> 
>    A = .....;
>    B=......;
>    Bnum= Cum(B);
>    AsinceB= Bnum - ValueWhen(A,Bnum );
>    firstAsinceB=AsinceB==1;
> 
> I use above calculation 3 times in my indicators, and guess that's 
> why the speed is slowed down.   Is there a way to get out ?
> Thanks/ itmwh
> 
> 
> 
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@xxx> 
> wrote:
>>
>> Hello,
>> 
>> Post the FORMULA you are using and then you will be able to get 
> help.
>> 
>> Best regards,
>> Tomasz Janeczko
>> amibroker.com
>> ----- Original Message ----- 
>> From: "itmwh" <toxutao@xxx>
>> To: <amibroker@xxxxxxxxxxxxxxx>
>> Sent: Tuesday, June 05, 2007 2:09 PM
>> Subject: [amibroker] Question: How to make the code run faster ?
>> 
>> 
>> > Hi, when I open a 1-minute chart with certain custom indicator, 
> the CPU 
>> > usage always rocket to above 90%, making it very inconvenient to 
> move 
>> > the crosshair on the chart, and do other basic chartings on the 
> chart. 
>> > When I run the same indicator on 5-minute chart, the speed is 
> OK, CPU 
>> > is operating at below 20%, it seems more bars on a 1-minute 
> chart slow 
>> > down the program.  I want to know is there a method to let the 
> program 
>> > operate faster ?  Or is it possible to let AB only calculate the 
> value 
>> > of the indicators in the visible bars ?
>> > 
>> > 
>> > 
>> > 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
>> > 
>> > 
>> > 
>> > 
>> >
>>
> 
> 
> 
> 
> 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
> 
> 
> 
> 
>


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/