Download MetaTrader 5
To add comments, please log in or register
Do you need private account monitoring? The Signals will provide you one!
makset
24
makset 2014.04.07 11:37 
hello

I used the following program in MQL4 but my supplier changed ME on version 5

Can someone translate it for me mql5.

I am very grateful for any help.

<code removed by moderator, see next post>

Achmad Hidayat
15273
Achmad Hidayat 2014.04.07 13:57  
makset:
hello

Please use SRC button to write script.

SRC

So it look like this

//+------------------------------------------------------------------+
//|                                                     tickexp3.mq4 |
//|                        Copyright 2013, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"
extern int length = 10;   // The amount of bars sent to be processed
string nameData;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
{
nameData = Symbol() + TimeCurrent() + Period() + ".txt"; 

   static int old_bars = 0;   // remember the amount of bars already known  
   if (old_bars != Bars)      // if a new bar is received
   {
     int handle;
  handle = FileOpen(nameData, FILE_CSV|FILE_WRITE,';');
  if(handle < 1)
  {
 
    return(0);
  }

  FileWrite(handle, "DATE","TIME","HIGH","LOW","CLOSE","OPEN");   // heading
  int i;
  for (i=length-1; i>=0; i--)
  {
    FileWrite(handle, TimeToStr(Time[i], TIME_DATE), TimeToStr(Time[i], TIME_SECONDS),
                      High[i], Low[i], Close[i], Open[i]);
  }
  FileClose(handle);                             // write the data file                             
   }     
   old_bars = Bars;              // remember how many bars are known
   return(0);
}

//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
  
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
{
nameData = Symbol() + TimeCurrent() + Period() + ".txt"; 

   static int old_bars = 0;   // remember the amount of bars already known  
   if (old_bars != Bars)      // if a new bar is received
   {
     int handle;
  handle = FileOpen(nameData, FILE_CSV|FILE_WRITE,';');
  if(handle < 1)
  {
 
    return(0);
  }

  FileWrite(handle, "DATE","TIME","HIGH","LOW","CLOSE","OPEN");   // heading
  int i;
  for (i=length-1; i>=0; i--)
  {
    FileWrite(handle, TimeToStr(Time[i], TIME_DATE), TimeToStr(Time[i], TIME_SECONDS),
                      High[i], Low[i], Close[i], Open[i]);
  }
  FileClose(handle);                             // write the data file                             
   }     
   old_bars = Bars;              // remember how many bars are known
   return(0);
}
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
Alain Verleyen
Moderator
28518
Alain Verleyen 2014.04.07 15:56  
makset:
hello

I used the following program in MQL4 but my supplier changed ME on version 5

Can someone translate it for me mql5.

I am very grateful for any help.

<code removed by moderator, see next post>

MetaEditor version 5 is used by MT4 and MT5 now. But I doubt your broker forces you to use MT5 if you have an MT4 account. By the way I can't see at first a problem with your code on mql4/MT4.

What is you real problem ?

/
To add comments, please log in or register