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

[amibroker] Re: Help with Jscript code... (for-loop)



PureBytes Links

Trading Reference Links

What you probably want to do is use the relatively new OLE interface 
to the AA -- in other words, use OLE Automation to run your scan, and 
then use the filesystemobject to open the file containing the results 
of your scan and do whatever you like with the list.

- Gordon 

--- In amibroker@xxxxxxxxxxxxxxx, "nargalzious" <nargalzious@xxxx> 
wrote:
> Hi group,
> 
> I want to cycle thru all stocks that present buy signals in my AFL 
> scan and run a Jscript code against them, but the code I assemble 
> below runs thru all stocks in my database.  How to I cycle thru 
just 
> the stocks that presented buy signal in my alf scan?   Thank you.  
> P.S.  I'm not a professional coder expert! ;-}
> 
> < AFL SCAN LOGIC GOES HERE.......>
> 
> EnableScript("jscript");
> <%
> BuyStk = VBArray( AFL("BUY") ).toArray();
> function GetArray( Name )
> {
> return VBArray( AFL( Name ) ).toArray();
> }
> 
> var oAB = new ActiveXObject("Broker.Application"); 
> var fso = new ActiveXObject("Scripting.FileSystemObject"); 
> file = fso.OpenTextFile( "exporting_list.txt", 2 ); 
> 
> var oStocks = oAB.stocks; 
> var Qty = oStocks.Count;
> 
> for( i = 0; i < Qty; i++ ) 
> {			
> 		if ( (BuyStk[i]) == 1)
> 		{
> 		  oStock = oStocks( i );
> 		 file.writeLine( oStock.Ticker + "," + 
> oStock.Fullname);
> 		}	
> } 
> 
> file.Close(); 
> %>


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

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