Hi Rosh, Please help!

 
Hi Rosh,
Please provide sample how to set expire date (example: when the ea is expire, it will stop working forever)?
Thanks in advance.
Shams
 
Here it
 
start()
{
if (TimeCurrent()>dateExpiration) return;
 
....
other code
....
}
 
Thanks for your help:)
Can you also provide me the sample when the ea expire, the backtest and forward test also will stop?
Thanks again.
 
//+------------------------------------------------------------------+
//|                                                    LocalTime.mq4 |
//|                      Copyright © 2006, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"
 
#import "kernel32.dll"
void GetLocalTime(int& TimeArray[]);
#import
 
//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  {
   int TimeArray[4];
   int nYear,nMonth,nDay,nHour,nMin,nSec;
//----
   GetLocalTime(TimeArray);
   nYear=TimeArray[0]&0x0000FFFF;
   nMonth=TimeArray[0]>>16;
   nDay=TimeArray[1]>>16;
   nHour=TimeArray[2]&0x0000FFFF;
   nMin=TimeArray[2]>>16;
   nSec=TimeArray[3]&0x0000FFFF;
   Print(nYear,".",nMonth,".",nDay," ",nHour,":",nMin,":",nSec);
//----
   return(0);
  }
//+------------------------------------------------------------------+
 
Many thanks, ROSH
:)
 
Hi ROSH,
Please help, how to display the realtime date and timer (current user computer dated and time) on chart window attach with the ea?
 
See this sample

//+------------------------------------------------------------------+
//|                                            EA_with_LocalTime.mq4 |
//|                      Copyright © 2007, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"
 
#import "kernel32.dll"
void GetLocalTime(int& TimeArray[]);
#import
 
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
datetime myLocalTime()
   {
   datetime res;
//----
   int TimeArray[4];
   int nYear,nMonth,nDay,nHour,nMin,nSec;
//----
   GetLocalTime(TimeArray);
   nYear=TimeArray[0]&0x0000FFFF;
   nMonth=TimeArray[0]>>16;
   nDay=TimeArray[1]>>16;
   nHour=TimeArray[2]&0x0000FFFF;
   nMin=TimeArray[2]>>16;
   nSec=TimeArray[3]&0x0000FFFF;
  
   string sYear=nYear;
   string sMonth=nMonth;
   string sDay=nDay;
   string sHour=nHour;
   string sMin=nMin;
   string sSec=nSec;
   
   string local=StringConcatenate(sYear,".",sMonth,".",sDay," ",sHour,":",sMin,":",sSec);
   res=StrToTime(local);         
   //Print(nYear,".",nMonth,".",nDay," ",nHour,":",nMin,":",nSec);
//----
   return(res);
   }
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   Print("Back testing start at ",TimeToStr(myLocalTime(),TIME_DATE|TIME_SECONDS));
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   Print(Bars," bars wass passed due back testing. It is finished  at ",TimeToStr(myLocalTime(),TIME_DATE|TIME_SECONDS));
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
 
Hi Rosh,
Thank you for your help, it must appreciate.
But, I have get this error message on back test journal:
2008.03.23 13:10:17 2007.01.02 00:00 088 EURGBP,M15: expert stopped
2008.03.23 13:10:17 2007.01.02 00:00 088 EURGBP,M15: dll calls are not allowed; 'kernel32.dll'-'GetLocalTime'
Please help.
Thanks


 
See "Options" (Ctrl+O)
 
Hi Rosh,
I get it, really thanks for your help.
Shams