Because of bars since you are using variable-period variant and due to restarts 
required is much slower
than constant period. Instead of HHV you should be using
HighestSince function.
So instead your entire formula use just 2 lines:

bi = BarIndex();
result = HighestSince( BeginValue( bi ) == bi, Close );


Best regards,
Tomasz Janeczko
amibroker.com
  ----- Original Message ----- 
  From: Ken Close 
  To: [email protected] 
  Sent: Wednesday, October 29, 2008 4:09 PM
  Subject: [amibroker] Code Change Question for HHV -- Was: RT AB Sluggish at 
Small Time Settings --


  TJ or anyone:

  That was helpful.

  Formula has an HHV(C,period); function.
  Period is calculated below:

  bi = BarIndex();
  bv = BeginValue(bi);
  ev = EndValue(bi);
  sv = SelectedValue(bi);
  Length = ev - bv;
  Days = ev - sv;//EndValue(BarIndex()) - SelectedValue(BarIndex()); 
  Sbv = IIf(bi == bv,1,0);
  Period = BarsSince(Sbv);

  The HHV function takes all the time, but the sluggishness occurs when there 
is no BeginValue (Green) pole set and 10 min or 5 min Interval is set.  Period 
thus becomes all of the bars, and the HHV function takes all of the time (Check 
and Profile said 9 seconds, which seems like 1 minute).

  Question1: is there a fast execution HHV procedure that can be written 
(faster than HHV)?  What would it be?

  Question2: assuming I stay with HHV, how do I limit the length of processing 
if there is no Green pole (BeginValue) set on the screen (thus limiting bars 
processed). I tried something using the Min function but did not improve 
anything.

  Any simple coding suggestions for my questions?
  Ken



------------------------------------------------------------------------------
  From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Tomasz 
Janeczko
  Sent: Wednesday, October 29, 2008 6:44 AM
  To: [email protected]
  Subject: Re: [amibroker] RT AB Sluggish at Small Time Settings


  Hello,

  Go to Formula Editor, select Tools->Check And Profile
  and found bottleneck in your formula using profiler timing.

  Best regards,
  Tomasz Janeczko
  amibroker.com
    ----- Original Message ----- 
    From: Ken Close 
    To: [email protected] 
    Sent: Wednesday, October 29, 2008 11:41 AM
    Subject: [amibroker] RT AB Sluggish at Small Time Settings


    Can someone suggest what I may check or diagnosis to get a handle on and 
fix for this problem.

    I have used AB with my QuoteTracker feed for over a year now.  Of course I 
have some gaps in my data because QT and my source, Fidelity account, will not 
permit backfills.

    Suddenly, yesterday, AB is totally bogged down if I select 5 minute data.  
When I start it up, it automatically comes up in hourly mode and is ok.  
Switching pole positions for example is almost instantaneous.  If I switch to 
15 min display, I get a noticeable delay, maybe 3 to 5 seconds for the pole to 
appear. (I also have the Task Manager open and can watch broker.exe jump to the 
top of CPU usage and then drop down.  If I click on 5 min data, CPU goes to 
100%, Broker.exe is pegged at near 92 to 95% and it will take literally 1 to 2 
minutes to get the cursor back.  Again, the day before yesterday, everything 
worked fine.

    What changed?  Nothing that I know of.  I was experimenting with a rather 
long formula file (developed in EOD environment), and earlier versions worked 
ok, but maybe this had something to do with the slowdown.  I deleted the 
formula from the RT database, and rebooted the computer.

    What else can I try and what other data can I gather to diagnose this 
problem?

    Thanks.

    Running AB 5.19, with XP and plenty of RAM and HD
   

Reply via email to