VBA + Amibroker: loop through the quotations for each stock and update

#1
I want to loop through the quotation of the stock, not just a single day "2013-07-14", as I want to update the stock quotation by a factor. how do I write it? thanks

Set Amibroker = CreateObject("Broker.Application")
'Set stocks = Amibroker.stocks

strTicker = "3336.HK"
Set Stock = Amibroker.stocks(CStr(strTicker))

If Not Stock Is Nothing Then
With Stock
.FullName = "巨騰"
Set quotation = .quotations("2013-07-04")
O = quotation.Open '3.51
H = quotation.High '3.57
L = quotation.Low '3.28
C = quotation.Close '3.3
V = quotation.volume ' 7130000
Debug.Print O & " " & H & " " & L & " " & C & " " & V
End With
End If
Amibroker.RefreshAll
End Sub
 

trash

Well-Known Member
#2
Why do you always need VBA?

You don't need it. Just use AFL.

Is this what you wanna do?

Code:
factor = 1.0;

PlotOHLC( factor * O, factor * H, factor * L, factor * C, "", colorGrey50, GetPriceStyle() );

_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.2f%%) {{VALUES}}", 
                     factor * O, factor * H, factor * L, factor * C, SelectedValue( ROC( C, 1 ) ) ));
 
#3
Why do you always need VBA?

You don't need it. Just use AFL.

Is this what you wanna do?

Code:
factor = 1.0;

PlotOHLC( factor * O, factor * H, factor * L, factor * C, "", colorGrey50, GetPriceStyle() );

_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.2f%%) {{VALUES}}", 
                     factor * O, factor * H, factor * L, factor * C, SelectedValue( ROC( C, 1 ) ) ));

As I need to adjust the stock price by a factor and import back to AB. I want this process automatically done.
 
#5
adjustment factor say dividend, stock split, etc. The factor is a variable for each stock, in the event of say ex-dividend, stock split effective date.
 

Similar threads

Intraday Higher Leverage

Save up to 90% in brokerage and get higher leverage for intraday trades.

Name:Phone:
Email:City:
State:
Are you a day trader?