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

[amibroker] Re: Help with More Complicated JavaScript Needed


  • Date: Tue, 24 Nov 2009 21:30:28 -0000
  • From: "Mike" <sfclimbers@xxxxxxxxx>
  • Subject: [amibroker] Re: Help with More Complicated JavaScript Needed

PureBytes Links

Trading Reference Links



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@xxxxxxxxxxxxxxx, "bistrader" <bistrader@xxx> 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
>



__._,_.___


**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___