PureBytes Links
Trading Reference Links
|
--- In amibroker@xxxxxxxxxxxxxxx, "dingo" <dingo@xxxx> wrote:
> anytime you have a problem and don't include the code you're
using - you
> assume that we're mind readers, duude..
>
> Can't help you.
>
> d
>
>
> _____
>
> From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx]
On Behalf
> Of angus_83210
> Sent: Friday, July 01, 2005 6:09 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] OLE Automation problem
>
>
> I can't get OLE Optimization to work. I open the database and
close
> all the documents and open a new document with the ticker(in this
> case "A"). I set the active document to that document and open
the
> analysis. I then load the formula and settings then clear the
> filters. I set applyto = 1, rangemode=0,showwindow = 1 and then
> optimize = 1. This is where I am having my problems. I get a
dialog
> box to ok the number of opt. steps. Need away to bypass the
dialog
> box when doing OLE. The next problems is that I don't have any
data
> to optimize. I have tried to run the windows scripts that are in
the
> OLE automation but they don't run. I get a windows script host
> error "No jobs are defined in the file" Any ideas on how to make
OLE
> work with 4.70? Also it would be nice to make the
Broker.Application
> Module have a visible field like Excel does so a developer can
watch
> what is going on.
>
> Thanks
>
>
>
>
> Please note that this group is for discussion between users only.
>
> To get support from AmiBroker please send an e-mail directly to
> SUPPORT {at} amibroker.com
>
> For other support material please check also:
> http://www.amibroker.com/support.html
>
>
>
>
>
> _____
>
> YAHOO! GROUPS LINKS
>
>
>
> * Visit your group "amibroker
> <http://groups.yahoo.com/group/amibroker> " on the web.
>
>
> * To unsubscribe from this group, send an email to:
> amibroker-unsubscribe@xxxxxxxxxxxxxxx
> <mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe>
>
>
> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service
> <http://docs.yahoo.com/info/terms/> .
>
>
> _____
Here is the code:
Dim abapp As Broker.Application
Dim abal As Broker.Analysis
Dim absts As Broker.Stocks
Dim abst As Broker.Stock
Dim abdocs As Broker.Documents
Dim abdoc As Broker.Document
Dim actdoc As Broker.Document
Dim abqts As Broker.Quotations
Dim abqt As Broker.Quotation
Dim filname As String
Dim xlapp As Excel.Application
Dim xlwb As Excel.Workbook
Dim xlws As Excel.Worksheet
Dim Gcnt As Integer
Private Sub Form_Load()
Dim dbload As Boolean
Set xlapp = New Excel.Application
Set abapp = New Broker.Application
Set absts = abapp.Stocks
dbload = abapp.LoadDatabase("C:\Program Files\AmiBroker\ETF")
Gcnt = absts.Count
Stop
End Sub
Private Sub Form_Unload(Cancel As Integer)
abapp.Quit
xlapp.Application.Quit
End Sub
Private Sub START_Click()
Dim i As Integer
Dim Frmload As Boolean
Dim good As Boolean
filname = "C:\program files\amibroker\dump.csv"
Set abdocs = abapp.Documents
If abdocs.Count > 0 Then abdocs(0).Close
For i = 0 To Gcnt - 1
Set abst = absts(i)
Set abdoc = abdocs.Open(abst.Ticker)
Call abdoc.Activate
Set actdoc = abapp.ActiveDocument
Set abal = abapp.Analysis
Frmload = abal.LoadFormula("C:\Program
Files\AmiBroker\Formulas\Custom\Weight.AFL")
Frmload = abal.LoadSettings("C:\Program
Files\AmiBroker\Formulas\Custom\Long.ABS")
Call abal.ClearFilters
abal.ApplyTo = 1
abal.RangeMode = 3
abal.RangeToDate = DateAdd("D", -1, Now)
abal.RangeFromDate = DateAdd("m", -6, abal.RangeToDate)
abal.ShowWindow 1
abal.Optimize 1
Kill (filname)
good = abal.Export(filname)
If good Then
Call Get_Dump
End If
Stop
Next
End Sub
Private Sub Get_Dump()
Set xlwb = xlapp.Workbooks.Open(filname)
xlapp.Visible = True
For i = 1 To xlapp.Worksheets.Count
Set xlws = xlwb.Sheets(i)
' ts2 = "A" & Trim(CStr(lop))
' ts3 = xlws.Range(ts2).Value
' If IsNumeric(ts3) Then
' num = CInt(ts3)
' ts2 = "B" & Trim(CStr(lop))
' ts3 = xlws.Range(ts2).Value
Next
xlwb.Close
End Sub
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.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/
|