string readTicketInfo()
{
string sym = "data//" + _Symbol + "_info_" + (string)MagicNumber + ".txt";
string str;
int file_handle = FileOpen(sym, FILE_READ | FILE_TXT | FILE_COMMON);
if (file_handle != INVALID_HANDLE)
{
//--- additional variablesint str_size;
//str;//--- read data from the filewhile (!FileIsEnding(file_handle))
{
//--- find out how many symbols are used for writing the time
str_size = FileReadInteger(file_handle, INT_VALUE);
//--- read the string
str = FileReadString(file_handle, str_size);
//--- print the string
}
//--- close the fileFileClose(file_handle);
// PrintFormat("Data is read, %s file is closed",sym);
}
elsePrintFormat("Failed to open %s file, Error code = %d", sym, GetLastError());
return str;
}
string getDataFromTicket(int number)
{
string textReplace = readTicketInfo(); //"ticketId:349668287;Symbol:EURAUD;orderType:0;Magic Number:0;Count:1";string text=textReplace;
int replaced=StringReplace(text,"ticketId:","");
replaced+=StringReplace(text,"Symbol:","");
replaced+=StringReplace(text,"orderType:","");
replaced+=StringReplace(text,"Magic Number:","");
replaced+=StringReplace(text,"Count:","");
string to_split= text; //"ticketId:349668287;Symbol:EURAUD;orderType:0;Magic Number:0;Count:1"; // A string to split into substringsstring sep=";"; // A separator as a characterushort u_sep; // The code of the separator characterstring result[]; // An array to get strings//--- Get the separator code
u_sep=StringGetCharacter(sep,0);
//--- Split the string to substringsint k=StringSplit(to_split,u_sep,result);
//--- Show a comment // PrintFormat("Strings obtained: %d. Used separator '%s' with the code %d",k,sep,u_sep);return result[number];
}
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I want only update Count: If I have 1, to 2 and other string I don't want to change...
this is my code:
get from file: