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

[amibroker] VB program



PureBytes Links

Trading Reference Links

Hello,

I'm trying to (re)code a (simulator-like) program in VB. It works
allright without the 'Refreshall' method. (It used to work in AB 3.9)
However, when I insert the 'Refreshall' method is doesn't work 
anymore. Anybody know why ? (See code below, I indicated the suspect 
line)

William ? Dingo ?

Thanks
Leo

Option Base 0
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As 
Long)
Dim oAB As Object, oStocks As Object, oStock As Object, oQuote As 
Object
Dim nStock As Object, nQuote As Object, oDOC As Object
Dim StartBar As Integer, Ticker As String, nDate As Date
Private Sub Form_Load()
  Scrambler.Left = 0
  Scrambler.Top = 0
  Set oAB = CreateObject("Broker.Application")
End Sub
Private Sub InitApp()
 Dim StockName As String
  Set oStocks = oAB.Stocks
  Ticker = oAB.ActiveDocument.Name
  Set oStock = oAB.Stocks(CStr(Ticker))
  StartBar = oStock.Quotations.Count 'Number of quotations in stock
  'StockName = "~SCRMBLR_" + CStr(Ticker) + "_" + txtCounter
  StockName = "~SCRMBLR"
  oAB.Stocks.Remove (StockName)
  Set nStock = oAB.Stocks.Add(StockName)
  Set oDOC = oAB.Documents.Open(StockName)
  oAB.Refreshall
End Sub
Private Sub CopyLastQuotations()
 Dim i As Integer
 MsgBox Str(StartBar - 100)
  Set oStock = oAB.Stocks(CStr(Ticker))
  oStock.DataSource = 1 '  USE LOCAL DATABASE FOR THIS SYMBOL
  For i = StartBar - 100 To StartBar - 1
    Set oQuote = oStock.Quotations(i)
    Set nQuote = nStock.Quotations.Add(oQuote.Date)
    nQuote.Open = oQuote.Open
    nQuote.high = oQuote.high
    nQuote.low = oQuote.low
    nQuote.Close = oQuote.Close
    nDate = oQuote.Date
    oAB.Refreshall  <<<<<<<============================
  Next i
End Sub
Private Sub cmdRun_Click()
   InitApp
  CopyLastQuotations
  'oAB.refreshall
  Unload Me
End Sub



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

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 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/