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

[amibroker] Re: Help with More Complicated JavaScript Needed


  • Date: Sat, 28 Nov 2009 23:30:30 -0000
  • From: "bistrader" <bistrader@xxxxxxxxx>
  • Subject: [amibroker] Re: Help with More Complicated JavaScript Needed

PureBytes Links

Trading Reference Links

Thanks Mike.  I did each, will do more and give it a try.  I am sure I will get it,  Today, I do not totally understand exactly what the following code you provided is doing.  It seems to be comparing 2 strings by looping thru all stocks in the database.  I have read via google and am not clear.  

   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 
      } 



--- In amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@xxx> wrote:
>
> Microsoft's MSDN has good coverage for much of what is available.
> 
> e.g. file usage:
> http://msdn.microsoft.com/en-us/library/czxefwt8(VS.85).aspx
> 
> They also have an area dedicated to JScript, which I haven't sifted through yet.
> 
> http://msdn.microsoft.com/en-us/library/4yyeyb0a(VS.85).aspx
> 
> Whenever I need something, I just google for an english description of what I want, like "how to ... in JScript". You usually end up wading through a bunch of javascript web development specific stuff. But, eventually you hit a JScript example in a user forum somewhere.
> 
> Mike
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "bistrader" <bistrader@> wrote:
> >
> > Mike, I did not see this and do not know how I missed it.  I studied.  I understand all of the basic code and loop.  I do not understand first 4 lines and will do google search on these.  Maybe you or someone else has a good site or document to go to, to do better job at JavaScript.  Thanks so much for your help.
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@> wrote:
> > >
> > > 
> > > 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@> 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/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    amibroker-digest@xxxxxxxxxxxxxxx 
    amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/