PureBytes Links
Trading Reference Links
|
<FONT face=Arial
color=#0000ff size=2>Here's some vbScript from William that manipulates the
watchlistbits.
<FONT face=Arial
color=#0000ff size=2>
<FONT face=Arial
color=#0000ff size=2>'**************************''Purpose: Adds tickers to
an Amibroker watchlist from a file created by running an AFL
formula.' The AFL formula is run by this script and must be
located in the ' Amibroker Database directory.'
The file needs to contain a list of tickers with the corresponding watchlist
numbers.'Create By: William Peters'Date: Thursday 6th Feb
2003 '**************************'
<FONT face=Arial
color=#0000ff size=2>Dim oABDim oStockDim oAADim fsoDim
ReportFileAndPathDim MyStringDim MyArrayDim oFileDim
MyBitDim Watchlist
<FONT face=Arial
color=#0000ff size=2>set oAB = CreateObject("Broker.Application")set fso =
CreateObject("Scripting.FileSystemObject")
<FONT face=Arial
color=#0000ff size=2>ReportFileAndPath = oAB.DatabasePath & "\" &
"ResultsFromBasketOfStocks.csv"
' retrieve
automatic analysis objectset oAA = oAB.Analysis
' load formula
from external fileoAA.LoadFormula(oAB.DatabasePath &
"\MyAFLFormula.afl")
' optional: load
settings' AA.LoadSettings("the_path_to_the_settings_file.abs")
' setup filters
hereoAA.ClearFilters()oAA.Filter( 0, "market" ) = 2
' set apply to and
range oAA.ApplyTo = 2 '// use filtersoAA.RangeMode = 2 '// use all
available quotes
' run explore and
export the fileoAA.Explore()oAA.Export(ReportFileAndPath)
Set oFile =
fso.OpenTextFile(ReportFileAndPath, 1)
'***Code here
to read the ticker and sectoridoFile.skipline
Do While
oFile.AtEndOfStream <> True MyString =
oFile.ReadLine MyArray = Split(MyString, ",", -1, 1) Watchlist
= CInt(MyArray(2)) Set oStock =
oAB.Stocks(CStr(MyArray(0))) If Not oStock Is
Nothing Then If Watchlist
< 32
Then
MyBit = oStock.watchlistbits Or
GetWatchListBits(Watchlist)
oStock.watchlistbits = MyBit
Else
MyBit = oStock.watchlistbits2 Or GetWatchListBits(Watchlist -
32)
oStock.watchlistbits2 =
MyBit End
If End IfLoopoFile.Close
<FONT face=Arial color=#0000ff
size=2>oAB.RefreshAll()
set oFile =
nothingset oStock = nothingset oAA = nothingset oAB =
nothing
Function
GetWatchListBits(WatchListNumber)Dim i 'IntegerDim j
'DOuble
i = 0j =
1If WatchListNumber > 0 Then For i = 0 To
WatchListNumber - 1 j = j *
2 NextEnd If
If j = 2147483648
Then j = j * -1End If
GetWatchListBits =
j
End
Function
<FONT face=Arial color=#0000ff
size=2>
H<SPAN
class=434002821-19012004>TH
<SPAN
class=434002821-19012004>
<SPAN
class=434002821-19012004>d
From: Gordon [mailto:amibroker@xxxxxxxxxxxxxx]
Sent: Monday, January 19, 2004 4:08 PMTo:
amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] Watchlistbits >
31
Hi,I've got some basic code which works fine. It addes
the stock for the active document to watch list "List 8" as 2 ^ 8 = 256.
However, I can't find from the newsgroups or help how to deal with, say,
list 47. 2 ^ 47 results in overflow. Any thoughts?Dim abDim
tickerDim stkDim qtsSet ab =
Wscript.GetObject("","broker.application")ticker =
ab.ActiveDocument.NameSet stk =
ab.Stocks.Item(cstr(ticker))stk.WatchListBits = (stk.WatchListBits Or
256)Set stk = nothingSet ab =
nothingGordonSend BUG REPORTS to
bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
To visit your group on the web, go to:<A
href="">http://groups.yahoo.com/group/amibroker/
To unsubscribe from this group, send an email to:<A
href="">amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
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
Yahoo! Groups Links
To visit your group on the web, go to:http://groups.yahoo.com/group/amibroker/
To unsubscribe from this group, send an email to:amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
|