this works
Dim AmiBroker = CreateObject(“Broker.Application”);
dim xtr = AmiBroker.Stocks(“bby”);
this doesnt
Dim ticker As String="bby"
Dim AmiBroker = CreateObject(“Broker.Application”);
dim xtr = AmiBroker.Stocks(ticker);
this works
Dim AmiBroker = CreateObject(“Broker.Application”);
dim xtr = AmiBroker.Stocks(“bby”);
this doesnt
Dim ticker As String="bby"
Dim AmiBroker = CreateObject(“Broker.Application”);
dim xtr = AmiBroker.Stocks(ticker);
try this:
You are using (probably) old version of AmiBroker. Visual Basic has strange tendency to pass strings as reference instead of value while AmiBroker expects string to be passed by value.
Newest version should accept both by value and by reference but in older versions you need to force passing by value using CStr like @bluesinvestor has shown.