Hi Guys
I am trying to download datas with DDE. Not easy.
the well know formula ='MT4'|Ask!EURUSD is perfect to have an instantaneous PA.
But to store a data base of datas it is not the way...
Here my code in VBA
Public Sub essai136()
Dim i, ChannelNumber As Integer
Worksheets("Datas").Select
Columns("A:H").Delete shift:=xlToLeft
Cells(1, 1).Value = "Time"
Cells(1, 2).Value = "Bid"
Cells(1, 3).Value = "Ask"
For i = 2 To 25 '25 lines for test
Item$ = "EURUSD"
ChannelNumber = Application.DDEInitiate(app:="MT4", topic:="TIME") 'channel
xo = Application.DDERequest(ChannelNumber, "Item$") 'xo to receive data
For Z = LBound(xo) To UBound(xo) 'it's an array
Worksheets("Datas").Cells(i, 1).Formula = xo(Z) 'in a sheet named data col 1
Next Z
ChannelNumber = Application.DDEInitiate(app:="MT4", topic:="BID")
xo = Application.DDERequest(ChannelNumber, "Item$")
For Z = LBound(xo) To UBound(xo)
Worksheets("Datas").Cells(i, 2).Formula = xo(Z)
Next Z
ChannelNumber = Application.DDEInitiate(app:="MT4", topic:="ASK")
xo = Application.DDERequest(ChannelNumber, "Item$")
For Z = LBound(xo) To UBound(xo)
Worksheets("Datas").Cells(i, 3).Formula = xo(Z)
Next Z
Application.DDETerminate ChannelNumber ' close channel to recativate the process
Application.Wait (Now + TimeValue("0:00:01")) ' wait 1 sec
Next i
Range("A:A").Select 'cosmetik for date
Selection.NumberFormat = "m/d/yyyy h:mm:ss"
End Sub
This (wonderfull!) piece of code doesn´t work : xo the variable supposing to receive the value of tick is empty.... Why... that is the question !
Sorry for VBA Guru's : I am new in programming !!!!
Thanks your help in the matter and nice WE
Bert
For people looking for datas : Dukascopy have an historical data base even in MT4 format and CSV format. Good...
Hope this help
And no needs to write a program in whatever language...
(Juste mais pas tres sympa AngeVoyageur... A ce compte la, on ne demande rien a personne... Et tout le monde est content...)
For people looking for datas : Dukascopy have an historical data base even in MT4 format and CSV format. Good...
Hope this help
And no needs to write a program in whatever language...
(Juste mais pas tres sympa AngeVoyageur... A ce compte la, on ne demande rien a personne... Et tout le monde est content...)
Sympa ? je suis censé faire quoi, me replongez dans VB pour pouvoir répondre à votre question ?
Nice? I'm supposed to do, immerse myself in VB to be able to answer your question?
Ange : cool down..
First : you are not the only one here...
Second : my question was not only for you...
Third : somewhere there is someone that got same idea than me...
Have a nice week
Bert
Ange : cool down..
First : you are not the only one here...
Second : my question was not only for you...
Third : somewhere there is someone that got same idea than me...
Have a nice week
Bert
You're off_topic for this forum. Rules: https://www.mql5.com/en/users/register.
- Any discussions except of concerning MetaQuotes Language 4 and auto trading are forbidden. Such topics will be deleted.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi Guys
I am trying to download datas with DDE. Not easy.
the well know formula ='MT4'|Ask!EURUSD is perfect to have an instantaneous PA.
But to store a data base of datas it is not the way...
Here my code in VBA
Public Sub essai136()
Dim i, ChannelNumber As Integer
Worksheets("Datas").Select
Columns("A:H").Delete shift:=xlToLeft
Cells(1, 1).Value = "Time"
Cells(1, 2).Value = "Bid"
Cells(1, 3).Value = "Ask"
For i = 2 To 25 '25 lines for test
Item$ = "EURUSD"
ChannelNumber = Application.DDEInitiate(app:="MT4", topic:="TIME") 'channel
xo = Application.DDERequest(ChannelNumber, "Item$") 'xo to receive data
For Z = LBound(xo) To UBound(xo) 'it's an array
Worksheets("Datas").Cells(i, 1).Formula = xo(Z) 'in a sheet named data col 1
Next Z
ChannelNumber = Application.DDEInitiate(app:="MT4", topic:="BID")
xo = Application.DDERequest(ChannelNumber, "Item$")
For Z = LBound(xo) To UBound(xo)
Worksheets("Datas").Cells(i, 2).Formula = xo(Z)
Next Z
ChannelNumber = Application.DDEInitiate(app:="MT4", topic:="ASK")
xo = Application.DDERequest(ChannelNumber, "Item$")
For Z = LBound(xo) To UBound(xo)
Worksheets("Datas").Cells(i, 3).Formula = xo(Z)
Next Z
Application.DDETerminate ChannelNumber ' close channel to recativate the process
Application.Wait (Now + TimeValue("0:00:01")) ' wait 1 sec
Next i
Range("A:A").Select 'cosmetik for date
Selection.NumberFormat = "m/d/yyyy h:mm:ss"
End Sub
This (wonderfull!) piece of code doesn´t work : xo the variable supposing to receive the value of tick is empty.... Why... that is the question !
Sorry for VBA Guru's : I am new in programming !!!!
Thanks your help in the matter and nice WE
Bert