Finished Function

"I wanted to share a script I wrote which retrieves data from DBC.  I am a eSignal user and typically lose my connection to the internet while I am at work.  The Script goes through a list of symbols and requests various time frames from the eSignal servers.  A couple things to note:

1) ESPL has a Finished() function so the script will wait until all data is returned before requesting a new chart.

2) I put some Merge statements in to create other time frames.  No sense in slowing the Internet to create charts you can create with your own data.

3) Last I wrote the status of each request to the output window... to show how I made out.

I'm a rookie, but would like to give back ..... to some maybe less versed then I in ESPL." - Rick

procedure tickfill;
var 
  n,j: integer;
  sym, tf : string;
begin
  DimArray(6);
  SetArray(0,'0','1','5','D','W','M'); // array of time frames to retrieve from DBC
  Chart('SP0Z.1');
  sList.LoadFromFile(sPath+'symbols1.txt'); // list of symbols in text file
  for j:=0 to pred(sList.count) do begin
    sym:=trim(sList.strings[j]);
    for n:=0 to 5 do begin
      tf:=vArray(n);
      ChartReplace(sym+'.'+tf);
      if Finished(60) then begin    // Use function to pause for reception
        if tf='1' then begin
          merge(sym+'.1',sym+'.2'); // Reduce requests on the Internet
          merge(sym+'.1',sym+'.3');
          merge(sym+'.1',sym+'.4');
        end;
        if tf='5' then begin
          merge(sym+'.5',sym+'.10');
          merge(sym+'.5',sym+'.15');
          merge(sym+'.5',sym+'.30');
          merge(sym+'.5',sym+'.45');
          merge(sym+'.5',sym+'.60');
        end;
        writeln(sym+'.'+tf,' ',bar(edate,barbegin),' ',bar(edate,barend),' ',barend);
        // report begin and end dates on requested chart
      end
      else writeln(sym+'.'+tf+' ******NoUpdate*****');
    end;
    writeln('');
  end;
end;