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

VBSCRIPT HINTS



PureBytes Links

Trading Reference Links

using vb script and automation object model
remember everything starts at 0

First create vbscript object
AmiBroker = new ActiveXObject( "Broker.Application" );

or in Visual Basic
Set amibroker = CreateObject("Broker.Application")

now you can get the following

a = amibroker.stocks.count number of stocks in ami
0 = first stock in the list 1= 
second etc...

b = amibroker.stocks(a).ticker ticker symbol of stock
c = amibroker.stocks(a).FullName full name of that stock
d = amibroker.stocks(a).Quotations.Count number of quotes for that stock

so if you want the quote for stock number 0 in the list

d = amibroker.stocks(0).Quotations.Count will give you the count of quotes 
for the first symbol
in the list


if you want the last quote take the count and -1 so if d=150 make it 149
and do the following
a = amibroker.stocks(0).Quotations(149).Date
a = amibroker.stocks(0).Quotations(149).high
a = amibroker.stocks(0).Quotations(149).low
a = amibroker.stocks(0).Quotations(149).close
a = amibroker.stocks(0).Quotations(149).open
a = amibroker.stocks(0).Quotations(149).volume


amibroker.RefreshAll will refresh all the data screen 
in ami

this will get you a list of all symbols
a = amibroker.stocks.count
for b = 0 to a-1
a$=amibroker.stocks(a).ticker
print #1,a$
next b

I am not the best in explaining things but maybe this can help you newbies 
out there

nick