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

[amibroker] Re: What's wrong with this optimization?



PureBytes Links

Trading Reference Links

As far as I can see, I can associate a keyboard shortcut with one 
user defined menu item under tools. So, I decided to use automation 
to create additional hot-keys -- have operating-system level hotkeys 
trigger scripts that in turn automate AB. The most basic thing I want 
to do is navigate the results of an exploration w/o having to 
minimize and maximize the AA window back and forth. I created the 
following script. It assumes I export the exploration to a file 
Explore.csv. It works a few times, advancing to the next chart in the 
exploration, and then AB hits an exception. I'm running that latest, 
non-beta. Does anyone happen to see anything here that is out of 
place? Thanks.

****************************************

Const adCmdText = &H0001

Dim rs
Dim cn
Dim ab
Dim stk
Dim curT

Set cn = CreateObject("adodb.connection")
Set rs = CreateObject("adodb.recordset")
' -- GetObject() doesn't seem to work, and CreateObject()
'    seems to get pointer to current instance
'Set ab = GetObject(,"Broker.Application")
Set ab = CreateObject("Broker.Application")

curT = ab.ActiveDocument.Name

cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _ 
       "Data Source=C:\program files\Amibroker;" & _ 
       "Extended Properties=""text;HDR=Yes;FMT=Delimited;"";"
				
rs.Open "Select Top 1 * From Explore.csv where " & _
	"Ticker > """ & curT & """ ORDER BY [L/S], Ticker", cn, , , 
adCmdText 

If Not (rs.EOF And rs.BOF) Then 
        ' -- Name property appears to be 
	ab.ActiveDocument.Close()
	ab.Documents.Open(rs("Ticker"))
End If

rs.Close
cn.close
Set ab = Nothing
Set rs = Nothing
Set cn = Nothing




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:
     http://docs.yahoo.com/info/terms/