Thanks for the quick reply. What is DataLocalMode?

 

From: [email protected] [mailto:[email protected]] On Behalf
Of Tomasz Janeczko
Sent: Monday, March 15, 2010 4:16 PM
To: [email protected]
Subject: Re: [amibroker] DataLocalMode

 

  

Hello,

Correct property name is not DataLocalMode, but DataSource.
See:

http://www.amibroker.com/kb/2006/09/01/how-to-change-property-for-multiple-s
ymbols-at-once/

stock.DataSource = 1; // turn on "use only local database for this symbol"

Best regards,
Tomasz Janeczko
amibroker.com

On 2010-03-16 00:01, ta wrote: 

TJ

 

If you get a chance would you please let me know what I am doing wrong? TIA

 

From: [email protected] [mailto:[email protected]] On Behalf
Of ta
Sent: Tuesday, March 09, 2010 11:34 AM
To: [email protected]
Subject: [amibroker] DataLocalMode

 

  

I am trying to programmatically change the "Use only local database" from
"yes" to "no" for all the tickers in my database. Reading the manual, I saw
"Stock" has a property called DataLocalMode. I am assuming that it takes on
value 0 for no and 1 for yes. I modified one of TJ jscript codes to achieve
my objective as shown below. It is supposed to read from text file that
contains the tickers followed by a comma and a 0 (e.g. IBM,0). However, I am
not successful. Do you see the problem with my code? TIA

 

var filename = "c:\\amibroker\\List3.txt";

var fso, f, r;

var ForReading = 1;

var AmiBroker;

var fields;

var stock;

 

/* Create AmiBroker app object */

AB = new ActiveXObject("Broker.Application");

AB.LoadDatabase("c:\\Amibroker\\Data1Min");

 

AB.Visible = true;

 

/* ... and file system object */

fso = new ActiveXObject( "Scripting.FileSystemObject" );

 

/* open ASCII file */

f = fso.OpenTextFile( filename, ForReading);

 

/* read the file line by line */

while ( !f.AtEndOfStream )

{

r = f.ReadLine();

 

/* split the lines using comma as a separator */

fields = r.split(","); 

 

/* add a ticker - this is safe operation, in case that */

/* ticker already exists, AmiBroker returns existing one */

stock = AB.Stocks.Add( fields[ 0 ] ); 

stock.DataLocalMode = fields[ 1 ];

}

/* refresh ticker list and windows */

AB.RefreshAll();

WScript.echo("Local Mode Assignment Completed");



Reply via email to