I believe that the following will serve as a skeleton for the desired
steps 1, 2, 5.

fso = new ActiveXObject("Scripting.FileSystemObject");
ab = new ActiveXObject("Broker.Application");
stocks = ab.Stocks;
count = stocks.Count;
aa = ab.Analysis;

for (i = 1; i <= 10; i++) {
    f = fso.GetFile("c:\\temp\\Input" + i + ".csv");
    ts = f.OpenAsTextStream(1, 0);  // Open for read of ASCII
    tickers = ",";

    while (!ts.AtEndOfStream) {
       tickers += ts.ReadLine();   // Assume one ticker per line in .csv
file
       tickers += ",";
    }

    ts.Close();


    for (j = 0; j < count; j++) {
       stock = stocks.Item(j);

       if (tickers.indexOf("," + stock.Ticker + ",") >= 0) {
          stock.WatchListBits |= 1 << 20;      // Add to watchlist 20
       } else {
          stock.WatchListBits &= !(1 << 20);   // Remove from watchlist
20
       }
    }

    ab.RefreshAll();

    // Your backtest here.
    // Your exploration here.
}

Mike


--- In amibroker@yahoogroups.com, "bistrader" <bistra...@...> wrote:
>
> I am working on a second JavaScript that I will post when done. I want
it to do the following.
>
> 1. Makes watchlist 20 empty.
> 2. Reads Input1.csv symbols into watchlist 20.
> 3. Runs a backtest on MyBacktest.afl with filter at watchlist 20.
> 4. Then, runs an exploration on MyExploration.afl using current symbol
loaded in AB. This exploration creates a text file called Output1.csv to
match up with Input1.csv
> 5. Loops thru Step 1 thru Step4 for a total of 10 times starting with
Input1.csv and ending with Input10.csv. In the end, there are
Output1.csv thru Output10.csv.
>
> I know how to do Steps 3 and 4. I do not know as of yet how to do
Steps 1, 2 and 5 in JavaScript. Help is appreciated and thanks!!
>
> Bert
>


Reply via email to