mt4 to mt5 code convert

 
Please help convert the code from mt4 to mt5

I have no experience in coding in mql and time is running out for me.

The indicator's task is to export data, depending on which TF will be started

I will be very grateful for your help

Best regards



//+------------------------------------------------------------------+
//|                                              ___ProgramManag.mq4 |
//|                        Copyright 2018, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#property indicator_chart_window

#import "shell32.dll"
int ShellExecuteW(int hWnd,int lpVerb,string lpFile,string lpParameters,string lpDirectory,int nCmdShow);
#import

string nameData;
string nameDataTime;
extern int length = 3000;
extern int lengthTime = 1;

 string SasLog = "-log F:\_RealTime\_log"; //-nolog    -log F:\_RealTime\_log
 string Path =        "F:\_RealTime";

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   EventSetTimer(1);
   nameData = Symbol() +  Period() + "m.txt";
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
   static int old_bars = 0;   // remember the amount of bars already known   
   if (old_bars != Bars)      // if a new bar is received 
   {
      write_data(); 
      write_data_Time(); 
      run_bat();                            // write the data file                              
   }      
   old_bars = Bars; 
   
//--- return value of prev_calculated for next call
   return(rates_total);
  }

//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void write_data()
{
  int handle;
  handle = FileOpen(nameData, FILE_CSV|FILE_WRITE,';');

  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);
  Comment("File "+nameData+" has been created. "+ TimeToStr(TimeCurrent(), TIME_SECONDS) );
 }
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
 void run_bat()
{
   ShellExecuteW(0,0,"sas.exe","-icon -noterminal -nosplash -noxwait -noxsync -SYSIN " + Path + "\________Run_0_1m_RTControl_.sas " + SasLog,"C:\Program Files\SASHome\SASFoundation\9.4\\",1);
}


 
mkset:
Please help convert the code from mt4 to mt5

I have no experience in coding in mql and time is running out for me.

The indicator's task is to export data, depending on which TF will be started

I will be very grateful for your help

Best regards




make use of the freelancer on this platform https://www.mql5.com/en/job

Trading applications for MetaTrader 5 to order
Trading applications for MetaTrader 5 to order
  • 2022.09.28
  • www.mql5.com
The largest freelance service with MQL5 application developers
 
mkset:Please help convert the code from mt4 to mt5. I have no experience in coding in mql and time is running out for me. 

If you have no experience coding, then we are unable to help you. That would requite us to tutor you in learning, from the basics all the way to advance level, in both MQL4 and MQL5 coding. That would take several months, and I doubt anyone would do that for free.

So, if "time is running out", then I suggest you instead, place a job request in the Freelance section for someone to code you the conversion.

In the meantime, start your coding journey learning MQL5 via books, videos and the reference documentation.

Reason: