Download MetaTrader 5

to real time tick by tick mt4 at excel..

To add comments, please log in or register
All Code Base apps are available from MetaTrader 5. You can publish your own one!
mack99
19
mack99 2016.05.13 16:40 

good morning to all,

I would like to save to a excel file line tick by tick the value of the last contract with the volumes and with time ..

if possible with the timing at the desired time, every 5 seconds ... there is an EA that does this work with ...

I do not want to use too dde ...



thanks in advance to all and good day
Maryann Emmanuel
2281
Maryann Emmanuel 2016.05.13 16:58  
mack99:

good morning to all,

I would like to save to a excel file line tick by tick the value of the last contract with the volumes and with time ..

if possible with the timing at the desired time, every 5 seconds ... there is an EA that does this work with ...

I do not want to use too dde ...



thanks in advance to all and good day
Do you mean using excel in realtime alongside with MT4 /5 EA? iam working that now. Have look at the previous job.
mack99
19
mack99 2016.05.13 20:49  
Maryann Emmanuel:
Do you mean using excel in realtime alongside with MT4 /5 EA? iam working that now. Have look at the previous job.
explain better than I do not understand?
thank you
Maryann Emmanuel
2281
Maryann Emmanuel 2016.05.13 23:24  
mack99:
explain better than I do not understand?
thank you
mack99
19
mack99 2016.05.13 23:46  

Ma Emmanuel:

thanks and sorry I am using a translator because I'm Italian and I do not know English well, I want to receive in real time in an excel sheet into 3 distinct cells the time every second or every 5 second  the last price, and the volumes of any future I have in mt4 , not I want to use dde that gives me problems with the pC, but not by the volume that is important to me, it is possible with EA?

thanks again kindness

mack99
19
mack99 2016.05.16 09:25  

good morrning,

this EA work pwell but problem is  this no save in the my pc  "C:\\Utenti\\mack\\Desktop\\\cartel221.xlsx",cartella) , and if i work one  new file excel for other work.. thisAE go at write in the new file always ,,,,and

no leaave me work in the excel.. if i no open one new session of excel..

someone is able to help me,, thanks again
#property version   "1.00"
#property strict

//Importo le funzioni dalla libreria.
#import "mt4excel.dll"
   bool    ExcelOpen();
   bool    ExcelClose();
   bool    ExcelOpenFile(char &FileName[]);
   bool    ExcelSave();
   bool    ExcelSaveAs(char &FileName[]);
   bool    ExcelAddSheet(char &Name[]);
   double  ExcelGetValueCell(int X,int Y);
   string  ExcelGetTextCell(int X,int Y);
   string  ExcelGetFormulaCell(int X,int Y);
   bool    ExcelSetValueCell(int X,int Y,double Value);
   bool    ExcelSetTextCell(int X,int Y,char &Value[]);
   string  ExcelGetLastErrorText();
#import
//+------------------------------------------------------------------+
//| Variabili globali                                                |
//+------------------------------------------------------------------+
int Riga;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   ExcelOpen(); //Apro il file.
  
   //Preparo i vettori.
   char valuta[],data[],orario[],ask[],bid[],volume[];
  
   //Trasformo le stringhe in vettori di caratteri.
   StringToCharArray("Valuta",valuta);
   StringToCharArray("Data",data);
   StringToCharArray("Orario",orario);
   StringToCharArray("Ask",ask);
   StringToCharArray("Bid",bid);
   StringToCharArray("Volume",volume);
  
   //Scrivo il nome di ogni colonna.
   ExcelSetTextCell(1,1,valuta);
   ExcelSetTextCell(1,2,data);
   ExcelSetTextCell(1,3,orario);
   ExcelSetTextCell(1,4,ask);
   ExcelSetTextCell(1,5,bid);
   ExcelSetTextCell(1,6,volume);
   //Aggiorno la riga.
   Riga=1;
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   //Preparo il vettore.
   char cartella[];
  
   //Trasformo la stringa in un vettore di caratteri.
   StringToCharArray("C:\\Utenti\\marco1234\\Desktop\\\cartel221.xlsx",cartella);
  
   //Salvo il file nella cartella specificata.
   ExcelSaveAs(cartella);
   //Chiudo il file.
   ExcelClose();
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   //Preparo i vettori.
   char simbolo[],data[],orario[];
  
   //Trasformo le stringhe in vettori di caratteri.
   StringToCharArray(Symbol(),simbolo);
   StringToCharArray(TimeToStr(TimeCurrent(),TIME_DATE),data);
   StringToCharArray(TimeToStr(TimeCurrent(),TIME_MINUTES|TIME_SECONDS),orario);
  
   //Scrivo i dati sul file.
   ExcelSetTextCell(Riga,1,simbolo);
   ExcelSetTextCell(Riga,2,data);
   ExcelSetTextCell(Riga,3,orario);
   ExcelSetValueCell(Riga,4,Ask);
   ExcelSetValueCell(Riga,5,Bid);
   ExcelSetValueCell(Riga,6,Volume[0]);
   //Aggiorno la riga.
  //Riga++;
  }
//+------------------------------------------------------------------+
Maryann Emmanuel
2281
Maryann Emmanuel 2016.05.16 17:40  
some more coding needs to be done to allow you save to your pc. have you got skype for more details.
mack99
19
mack99 2016.05.16 21:24  
Maryann Emmanuel:
some more coding needs to be done to allow you save to your pc. have you got skype for more details.
  thank you very much ... my skype name: mackk99
To add comments, please log in or register