Is it possible in Excel to hyperlink a symbol to open in AB

I have a list of symbol in excel, is it possible to hyperlink a symbol to open the chart in AB?

Hi @twin,

you can create a hyperlink in excel to open amibroker, open specific chart formats, an amiquote list but not a specific chart. I have tried this but haven't found a way to link up to specific symbol chart. If anyone else has a solution, i would like to know too.

thanks,
Gautam

1 Like

@twin, @gautamlaungani if you are familiar with Excel VBA macros you can try to do it via OLE (you should already have one instance of AmiBroker open with a chart)

(put this sample code in the VBA "Sheet" section):

Sub AB_UpdateTicker(ticker)
    Dim oAB, oAW, oAD
    
    ' create AmiBroker object to update the ticker of the active document
    Set oAB = CreateObject("Broker.Application")
    oAB.Visible = True
    Set oAD = oAB.ActiveDocument
    Set oAW = oAB.ActiveWindow
    oAD.Name = ticker
End Sub

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    Cancel = True
    AB_UpdateTicker (Target)
End Sub

This quick example will invoke the macro with a double-click on a cell where you will have tickers in Excel (modifiy it as needed).

VBA2AB

18 Likes

The bold text of upper quote obviously is wrong. You can do so (via VBA,OLE)! Old news.
And actually you can do much more "crazy" things.

You can load chart template, you can select different chart tab, you can change AB chart sheet, you can set different symbol, you can insert current chart of AB as picture into Excel, .... etc. All in realtime.

Watch video proof and get enlightened: http://www.fastswf.com/89SCcbg
then go to church and make atonement for not believing in God "AmiBroker".

(The chart template's names you see in cell D6 of upper video refers to existing AB chart templates on hard drive e.g. test.ALY, test2.ALY etc.)

204657

8 Likes

hi @fxshrat,

Did not doubt the capabilities of Amibroker here at all. I am just very new to programming and i could not find a way myself hence the request for some other intelligent soul like you to help. Thanks for pointing us in the right direction.

cheers
G

1 Like

hi @beppe,

Once again thank you for your help. Really interesting VBA script. Will give it a try tonight.

Thanks

cheers,
G

1 Like

Thank you for your time and help @beppe @fxshrat ... My net was not work so sorry for the late reply.... thank you once again

@beppe I couldn't achieve what I wanted with the code.. I inserted the code in a new module and in sheet 1 from A1:A10 I have the list of symbols. what am I missing??

@twin, in my example, you need to "double click" on one of the tickers cells to trigger the macro (it is not an hyperlink).
If you do not like to double-click or want to use the double click for other purposes you should change the code/event to invoke the AB_UpdateTicker() macro; and obviously, you should have macro execution enabled in Excel.
Finally, as said above, you should have already opened an instance of AmiBroker.

2 Likes

is it possible to share an excel file?

Dear beppe,
Without too much knowledge of VBA, I succeeded in getting the code working thanks to your script.
I would like to thank you to make the code available.
Kind regards,
Laurent

2 Likes

This was something i was keenly looking at. I pasted your code into Excel VBA under Sheet1. But while executing, there is no macro to be chosen. When I changed the Sub AB_UpdateTicker(ticker) to only Sub AB_UpdateTicker, the macro shows up but not able to get the double-click in Excel cells and not able to get the chart changed in AB. Would love to get it working....
PS: I am quite new to VB.

Hi..
Me too not able to get it to work. Were you able to do it finally?

Finally, i could get it after disabling the 'enable editing directly in cells'.

2 Likes