EXCEL MACRO

Moderator: Moderator

EXCEL MACRO

Postby lucmat » Wed Oct 24, 2012 4:21 pm

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
lucmat
 
Posts: 57
Joined: Sat Aug 13, 2011 12:14 pm

Re: EXCEL MACRO

Postby alpha_bravo » Wed Oct 24, 2012 9:11 pm

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.
alpha_bravo
 
Posts: 49
Joined: Thu Jan 13, 2011 3:51 pm

Re: EXCEL MACRO

Postby Ekaterina » Thu Oct 25, 2012 2:17 am

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
Ekaterina
 

Re: EXCEL MACRO

Postby Steve_W » Fri Jul 28, 2017 5:48 am

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 2779 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
Steve_W
 
Posts: 7
Joined: Fri Jul 28, 2017 4:44 am

Re: EXCEL MACRO

Postby Apprentice » Mon Aug 14, 2017 4:55 am

Have forwarded your query to the development team.
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: EXCEL MACRO

Postby Konstantin.Toporov » Wed Sep 27, 2017 9:51 pm

Unfortunately COM is not supported anymore, you should use .net instead.
Konstantin.Toporov
FXCodeBase: Initiate
 
Posts: 113
Joined: Mon Aug 31, 2015 10:16 am

Re: EXCEL MACRO

Postby Steve_W » Thu Sep 28, 2017 5:57 am

OK - thanks for getting back to me
Steve_W
 
Posts: 7
Joined: Fri Jul 28, 2017 4:44 am


Return to ForexConnect API

Who is online

Users browsing this forum: No registered users and 7 guests