Excel DDE syntax for using 'MT4|BID!....... in connection with an excel cell .... e.g. 'MT4'|BID!(B7) .... what syntax do i need to use?

 

Hi

I know how to activate DDE for quotes from MT4 to Excel by using the syntax: 'MT4'|BID!EURUSD for example.

Is there a way to use it in a more generalized way? If I want to set up a table with different FX pairs e.g.

EURUSD

EURJPY

USDZAR

AUDSEK

1.3728

124.30

7.6778

6.4584

… and don’t want to manually use the “EURUSD”, “EURJPY”, etc. but would rather like to link the syntax to the cell above?

I have tried e.g. 'MT4'|BID!B7 or 'MT4'|BID!(B7) or similar, but it didn’t work.

 
larry15872:

Hi

I know how to activate DDE for quotes from MT4 to Excel by using the syntax: 'MT4'|BID!EURUSD for example.

Is there a way to use it in a more generalized way? If I want to set up a table with different FX pairs e.g.

EURUSD

EURJPY

USDZAR

AUDSEK

1.3728

124.30

7.6778

6.4584

… and don’t want to manually use the “EURUSD”, “EURJPY”, etc. but would rather like to link the syntax to the cell above?

I have tried e.g. 'MT4'|BID!B7 or 'MT4'|BID!(B7) or similar, but it didn’t work.

Try this:

enter the name of a pair in a cell - USDCAD, for example. Then, whilst this cell is still selected, enter the same text into the name box (adjacent to the formula bar on the excel ribbon). Thereafter, instead of writing the full formula, you can refer to the named cell after you have typed the "!" in your formula.


I tried it on my sheet and it worked so hopefully it will for you too.

Regards

Oneday

 
Thank you for the reply, but it doesn't work..... 'MT4'|BID!CELLNAME ?? like this? Can you give me a concrete example?
 
larry15872:
Thank you for the reply, but it doesn't work..... 'MT4'|BID!CELLNAME ?? like this? Can you give me a concrete example?

I have made this short video to explain my point. Hope this is clearer!

 

Hey Oneday


I think I've got exactly the same question as Larry.


With respect I don't think your answer/solution is what Larry wanted.


I think he wants to (and so do I) be able to alter the contents of a cell and then what is written in cell is used in the DDE request


I don't not want to have to alter the CELLNAME, just the contents of the cell.


In your example you just named the cell with a valid FX pair - ie EURUSD


You solution does not work if you named this FXPAIR or BLAH etc


Any further help you can provide would be appreciated.

 
davidhardman:

Hey Oneday


I think I've got exactly the same question as Larry.


With respect I don't think your answer/solution is what Larry wanted.


I think he wants to (and so do I) be able to alter the contents of a cell and then what is written in cell is used in the DDE request


I don't not want to have to alter the CELLNAME, just the contents of the cell.


In your example you just named the cell with a valid FX pair - ie EURUSD


You solution does not work if you named this FXPAIR or BLAH etc


Any further help you can provide would be appreciated.




Hello David,

If I understand you correctly, you want what ever you type into a cell to be added to the part of the DDE formula reserved for the name of the currency pair. I assume that you would like to be able to do this so that each DDE formula would be updated whenever you change the text (content) in the one cell that you would use for naming the pair? If so, then I am afraid that is beyond my knowledge of Excel. As far as I am aware, you can only name the cell as I demonstrated because the DDE formula is only interested in the name of the cell and not the contents of the cell, indeed the cell could be empty. Perhaps there is a way with VBA coding...if you find a solution, I would be interested in the answer.


Regards

 
oneday:

Hello David,

If I understand you correctly, you want what ever you type into a cell to be added to the part of the DDE formula reserved for the name of the currency pair. I assume that you would like to be able to do this so that each DDE formula would be updated whenever you change the text (content) in the one cell that you would use for naming the pair? If so, then I am afraid that is beyond my knowledge of Excel. As far as I am aware, you can only name the cell as I demonstrated because the DDE formula is only interested in the name of the cell and not the contents of the cell, indeed the cell could be empty. Perhaps there is a way with VBA coding...if you find a solution, I would be interested in the answer.


Regards

Hi David,

Have been looking for the same thing in the end I wrote a macro to do just that,

Sub SetUpTable()

Cells(1, 1).Value = "Symbol"
Cells(1, 2).Value = "Bid"
Cells(1, 3).Value = "Ask"
Cells(1, 4).Value = "High"
Cells(1, 5).Value = "Low"
Cells(1, 6).Value = "Time"
Cells(1, 7).Value = "Full"

For iRow = 2 To 1000
If Cells(iRow, 1) = "" Then
Exit For
End If
Cells(iRow, 2).Value = "=MT4|BID!" & Cells(iRow, 1).Value
Cells(iRow, 3).Value = "=MT4|ASK!" & Cells(iRow, 1).Value
Cells(iRow, 4).Value = "=MT4|HIGH!" & Cells(iRow, 1).Value
Cells(iRow, 5).Value = "=MT4|LOW!" & Cells(iRow, 1).Value
Cells(iRow, 6).Value = "=MT4|TIME!" & Cells(iRow, 1).Value
Cells(iRow, 7).Value = "=MT4|QUOTE!" & Cells(iRow, 1).Value
Next

End Sub

this is the best I came up with, maybe someone else can do better, but it serves the purpose for the moment.

To use, create this in the VBA editor and attach it to a shortcut key, then whenever you press the shortcut key combination it updates the table.

The spreadsheet looks like this,

Symbol Bid Ask High Low Time Full
AUDNZD 1.25823 1.25888 1.25841 1.24402 5:27:00 PM 2010/05/17 17:27 1.25823 1.25888
EURGBP 0.85395 0.85423 0.85891 0.84981 5:27:00 PM 2010/05/17 17:27 0.85395 0.85423
AUDNZD 1.25823 1.25888 1.25841 1.24402 5:27:00 PM 2010/05/17 17:27 1.25823 1.25888


Adding a new symbol and pressing the shortcut will add the new row.


cheers,

tom...

 
tombr:

Hi David,

Have been looking for the same thing in the end I wrote a macro to do just that,

Sub SetUpTable()

Cells(1, 1).Value = "Symbol"
Cells(1, 2).Value = "Bid"
Cells(1, 3).Value = "Ask"
Cells(1, 4).Value = "High"
Cells(1, 5).Value = "Low"
Cells(1, 6).Value = "Time"
Cells(1, 7).Value = "Full"

For iRow = 2 To 1000
If Cells(iRow, 1) = "" Then
Exit For
End If
Cells(iRow, 2).Value = "=MT4|BID!" & Cells(iRow, 1).Value
Cells(iRow, 3).Value = "=MT4|ASK!" & Cells(iRow, 1).Value
Cells(iRow, 4).Value = "=MT4|HIGH!" & Cells(iRow, 1).Value
Cells(iRow, 5).Value = "=MT4|LOW!" & Cells(iRow, 1).Value
Cells(iRow, 6).Value = "=MT4|TIME!" & Cells(iRow, 1).Value
Cells(iRow, 7).Value = "=MT4|QUOTE!" & Cells(iRow, 1).Value
Next

End Sub

this is the best I came up with, maybe someone else can do better, but it serves the purpose for the moment.

To use, create this in the VBA editor and attach it to a shortcut key, then whenever you press the shortcut key combination it updates the table.

The spreadsheet looks like this,

Symbol Bid Ask High Low Time Full
AUDNZD 1.25823 1.25888 1.25841 1.24402 5:27:00 PM 2010/05/17 17:27 1.25823 1.25888
EURGBP 0.85395 0.85423 0.85891 0.84981 5:27:00 PM 2010/05/17 17:27 0.85395 0.85423
AUDNZD 1.25823 1.25888 1.25841 1.24402 5:27:00 PM 2010/05/17 17:27 1.25823 1.25888


Adding a new symbol and pressing the shortcut will add the new row.


cheers,

tom...





I came up with a slightly different solution in the end - here's a vid if you are interested....
 
oneday:
I came up with a slightly different solution in the end - here's a vid if you are interested....
tombr:

Hi David,

Have been looking for the same thing in the end I wrote a macro to do just that,

Sub SetUpTable()

Cells(1, 1).Value = "Symbol"
Cells(1, 2).Value = "Bid"
Cells(1, 3).Value = "Ask"
Cells(1, 4).Value = "High"
Cells(1, 5).Value = "Low"
Cells(1, 6).Value = "Time"
Cells(1, 7).Value = "Full"

For iRow = 2 To 1000
If Cells(iRow, 1) = "" Then
Exit For
End If
Cells(iRow, 2).Value = "=MT4|BID!" & Cells(iRow, 1).Value
Cells(iRow, 3).Value = "=MT4|ASK!" & Cells(iRow, 1).Value
Cells(iRow, 4).Value = "=MT4|HIGH!" & Cells(iRow, 1).Value
Cells(iRow, 5).Value = "=MT4|LOW!" & Cells(iRow, 1).Value
Cells(iRow, 6).Value = "=MT4|TIME!" & Cells(iRow, 1).Value
Cells(iRow, 7).Value = "=MT4|QUOTE!" & Cells(iRow, 1).Value
Next

End Sub

this is the best I came up with, maybe someone else can do better, but it serves the purpose for the moment.

To use, create this in the VBA editor and attach it to a shortcut key, then whenever you press the shortcut key combination it updates the table.

The spreadsheet looks like this,

SymbolBidAskHighLowTimeFull
AUDNZD1.258231.258881.258411.244025:27:00 PM2010/05/17 17:271.25823 1.25888
EURGBP0.853950.854230.858910.849815:27:00 PM2010/05/17 17:27 0.85395 0.85423
AUDNZD1.258231.258881.258411.244025:27:00 PM2010/05/17 17:27 1.25823 1.25888


Adding a new symbol and pressing the shortcut will add the new row.


cheers,

tom...

hi,

while using this code i have an error 

"run time error 1004"

Application-defined or object -defined error 

please provide me the solution and also let me know how to add shortcut  , I am a new user


 

can anybody help on the above problem 

 
tom brennfleck:

Hi David,

Have been looking for the same thing in the end I wrote a macro to do just that,

Sub SetUpTable()

Cells(1, 1).Value = "Symbol"
Cells(1, 2).Value = "Bid"
Cells(1, 3).Value = "Ask"
Cells(1, 4).Value = "High"
Cells(1, 5).Value = "Low"
Cells(1, 6).Value = "Time"
Cells(1, 7).Value = "Full"

For iRow = 2 To 1000
If Cells(iRow, 1) = "" Then
Exit For
End If
Cells(iRow, 2).Value = "=MT4|BID!" & Cells(iRow, 1).Value
Cells(iRow, 3).Value = "=MT4|ASK!" & Cells(iRow, 1).Value
Cells(iRow, 4).Value = "=MT4|HIGH!" & Cells(iRow, 1).Value
Cells(iRow, 5).Value = "=MT4|LOW!" & Cells(iRow, 1).Value
Cells(iRow, 6).Value = "=MT4|TIME!" & Cells(iRow, 1).Value
Cells(iRow, 7).Value = "=MT4|QUOTE!" & Cells(iRow, 1).Value
Next

End Sub

this is the best I came up with, maybe someone else can do better, but it serves the purpose for the moment.

To use, create this in the VBA editor and attach it to a shortcut key, then whenever you press the shortcut key combination it updates the table.

The spreadsheet looks like this,

Symbol Bid Ask High Low Time Full
AUDNZD 1.25823 1.25888 1.25841 1.24402 5:27:00 PM 2010/05/17 17:27 1.25823 1.25888
EURGBP 0.85395 0.85423 0.85891 0.84981 5:27:00 PM 2010/05/17 17:27 0.85395 0.85423
AUDNZD 1.25823 1.25888 1.25841 1.24402 5:27:00 PM 2010/05/17 17:27 1.25823 1.25888


Adding a new symbol and pressing the shortcut will add the new row.


cheers,

tom...

Thank you Tom,


This really helped me out.


I exported the market watch window in the MT4 application. This creates a '.set' file, which is a plain text file with a list of all securities my broker is trading.

Copied that list of ticker symbols to a separate sheet in excel and using your macro was able to construct a matrix with 140 'live quotes' traded by my broker, without having to type a single ticker symbol by hand.

After that it was easy to link to quotes of ticker symbols that I am interested in analysing / trading and do my calculations on those. 



Cheers,

Paolo

Reason: