Page 1 of 1

EXCEL MACRO

PostPosted: Wed Oct 24, 2012 4:21 pm
by lucmat
Hi all!

Is there anyone that can tell me how to connect in realtime price data with excel?

I have a macro in excel that refresh data every 5 minutes with dde (it deletes the first data and add the last one: so I have always the same numbers of cells in excel); but with new version of windows this macro doesn't work!

Anyone can help me or tell me how to use, if possible, ForexConnect to connect marketscope or metatrader to excel?

Thanks

Lucmat

Re: EXCEL MACRO

PostPosted: Wed Oct 24, 2012 9:11 pm
by alpha_bravo
See this viewtopic.php?f=31&t=4159&p=42755&hilit=excel#p42755 . Updates data every 1 second; bid ask, account information ect. You will need a vba script to record changing values into new cells, here is an example recording 3 different variables into new colums. If you dont use it then "=TS2OFFERS|(INST)!BID" will repaint the cell every one second.

Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If .Cells.Count = 1 Then
If VarType(.Value) <> vbEmpty And _
VarType(.Value) <> vbError Then
Select Case Target.Address(False, False)
Case "A1"
Sheet1.Cells(Rows.Count, "D").End(xlUp)(2) = .Value
Case "A2"
Sheet1.Cells(Rows.Count, "E").End(xlUp)(2) = .Value
Case "A3"
Sheet1.Cells(Rows.Count, "F").End(xlUp)(2) = .Value
End Select
End If
End If
End With
End Sub

Personally i just use "=TS2OFFERS|(INST)!BID" as its pointless recording large amounts of data when you can download any historial data you need from Marketscope.

Re: EXCEL MACRO

PostPosted: Thu Oct 25, 2012 2:17 am
by Ekaterina
Hi lucmat,

To work in Excel VBA through ForexConnect, you need to download and install ForexConnect and COM wrapper.

After you install both, you can find Simple Samples of how to work with VBA in the folder where the ForexConnect has been installed. By default this folder is: %\ProgramFiles\Candleworks\ForexConnect API

As for:
Anyone can help me or tell me how to use, if possible, ForexConnect to connect marketscope or metatrader to excel?


It is not possible to connect Marketscope with Excel. I don't know about Metatrader.

Best regards,
Ekaterina

Re: EXCEL MACRO

PostPosted: Fri Jul 28, 2017 5:48 am
by Steve_W
Hi, can anybody help......?
EXCEL Office 2007 on Win10:
Installed 64 bit Forrexconnect and COM Wrapper.
Going to one of the simple examples in the COM\VBA directory - "Login.xlxm"
Pointed the sheet to pick up "fxcore2.com.tlb" from BIN_COM DLL directory

vb_error.png


Debugging VB code it appears to be due to failing to create an ActvieX object at line:
Set transport = CreateObject("fxcore2.com.Transport")

activeX error.png
activeX error.png (7.26 KiB) Viewed 2845 times


I've checked the COM library has been registered by running the "registerCom.bat" from an admin cmd window - no access errors so long as Excel is closed prior to this step.

com_registered_ok.png


I've tried to re-build the COM library - so far, no success in doing that - .NET is new to me

Any ideas what the general issue is and how it may be solved?

I have a .NET example working - downloading price data, but was rather hoping to be able to work in VBA

Steve

Re: EXCEL MACRO

PostPosted: Mon Aug 14, 2017 4:55 am
by Apprentice
Have forwarded your query to the development team.

Re: EXCEL MACRO

PostPosted: Wed Sep 27, 2017 9:51 pm
by Konstantin.Toporov
Unfortunately COM is not supported anymore, you should use .net instead.

Re: EXCEL MACRO

PostPosted: Thu Sep 28, 2017 5:57 am
by Steve_W
OK - thanks for getting back to me