I recently wrote the following script to automate the updating of all my
100 symbols with IB intraday data.  Very handy to avoid that boring
daily task.

I'd like to find a way to implement this entirely within AFL if that is
possible, probably using the new writable AB.ActiveDocument.Name.

One issue is that AutoIt uses only what is visible via Windows, and
there may not be a completely general way to find the symbol tree within
Amibroker.

Another issue is that no amount of delay will guarantee that the data
for each symbol has been downloaded.  Within AFL, I can imagine
detecting whether the last bar loaded is the most recent one available,
but that sounds tricky too.


[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>



; UpdateIBData.au3

; Daniel LaLiberte, 2008

; Visit every symbol in the list, stepping through with Down-arrow.

; If TWS is running and connected, and if you select the option

; in the Database Settings...to request updates on the first visit of
each symbol,

; then running this script will have the effect of requesting data
updates for all symbols.

; The script stops when the 'next' symbol is the same (which is when it
has reached the bottom),

; or when the symbol contains '~'.

; How much time to wait between each symbol, to avoid IB throttling.

$pauseSeconds = 60

; How to find the symbol tree control in Amibroker.

; This may vary each time you restart Amibroker, unless maybe you always
open it the same way.

; I would appreciate suggestions for how to do this more reliably.

$symbolTree = "[CLASSNN:SysTreeView322]"

AutoItSetOption("SendKeyDelay", 50)

AutoItSetOption("WinTitleMatchMode", 4)

$title = ''

$lastTitle = ''

Do

   ControlSend( "[CLASS:AmiBrokerMainFrameClass]", "", $symbolTree,
"{DOWN}" )

   Sleep(1000 * $pauseSeconds)

   $lastTitle = $title

   $title = WinGetTitle("[CLASS:AmiBrokerMainFrameClass]", "")

Until StringInStr ($title, "~") OR $title == $lastTitle

Reply via email to