What I need to do is to implement an exploration/backtest 
  that spans across all the stocks in the database(Why the entire stock database 
  is a whole different question that I couldn't find an answer for. That 
  question is also below).
   
  The AFL function I want to write will be reading a data 
  file with a list of dates,stock-list pairs, where each tock-list is a list of 
  15 stocks. The AFL will be generating a buy/sell signal on those 
  specific dates for the stocks in the assocaited stock 
list.
   
  The total number of stocks(across alll dates) in the 
  data file is only around 30-40.
  But the data file gets updates periodically(daily, weekly 
  or mothly) with one or more stocks and hence I can't use a fixed filter 
  of stocks to apply the exploration/backtest on. (Is it possible to have a 
  custom filter that function that could look at the data file to get the data 
  file, each time the exploration/backtest is run??)
   
  I am thinking if the AFL exploration is coded to 
  reads the data_file, it would have to do it for every stock in the 
  database(7000). I have all the 7000 why? Problem described above. I don't 
  know what stocks are going to be added/deleted from my 
  data_file.  
   
  This would then mean that the file gets open/read/closed 
  7000 times right? I am trying to avoid that.
   
  I was hoping that in JScript, I could create Global 
  Dictionary variable with the following code that should get executed 
  once.
       table = new 
  ActiveXObject("Scripting.Dictionary");
       
  ReadAndPopulate(table);
  This will define, read and populate the 
  table with the file data once. 
   
  That way, I am trying to avoid having to 
  read the file everytime, but just read from the 
  table.
   
  Hence my question if for every run of the 
  AFL function for each stockduring exploration/bactesting of 7000 stocks, there 
  is a new JScript interpreter is created. If yes, then I can't just create 
  global Dictionary variable.
   
  I could do 
      dict = 
  GetStaticObject("Scripting.Dictionary");
  in AFL, but not sure how to access/populate the dict variable via AFL or Jscript.
   
  Thx,
  Sarvi
  
  
    
    
    Hello,
     
    Yes the answer is CreateStaticObject() but to use that you 
    should write in AFL. Having said that
    I don't know why you need to code this in JScript and why 
    you need to use JScript to read the data from the file.
     
    AFL has file reading functions as well and allows to call 
    external OLE objects as well.
    
CreateStaticObject is AFL-only function and not 
    available to JScript.
    
Best regards,
Tomasz 
    Janeczko
amibroker.com
    
      ----- Original Message ----- 
      
      
      Sent: Tuesday, April 04, 2006 7:20 
      AM
      Subject: [amibroker] AFL 
      GetScriptObject - Is new instance created everytime it is called??
      
       
       
      I would like 
      to create a AFL function which defines a portion of the code in JScript. 
      use GetScriptObject to create and instance and call it multiple 
      times.
       
      I would like 
      to create a DictionayObject within JScript to read data from a 
      file.
       
      I am trying to 
      understand if the DictionaryObject gets created every time the AFL 
      function is called.
       
      I am trying to 
      see if the JScript could create the Dictionary object 
      once if it is not already defined within the interpreter and read an 
      populate it from a file.
      That way I am 
      hoping the reading from file does not happen every time the function is 
      called.
      This would 
      work, only if there is one instance of the script interpreter per 
      Amibroker, somehting similar to GetStatiObject. 
       
      I know 
      GetStaticObject would apply to my case, but I don't understand how I can 
      use JScript code.
       
      Will this 
      work. 
       
       
      Thx
      Sarvi
       
       
       
      
      -----------------------------------------------------------------------------------
      Sarvi 
      Shanmugham
      Technical 
      Leader
      Cisco Systems 
      Inc.
      Phone: 
      408-902-3875