Write data to file during optimization in MT5

MQL5 Experts Other

Job finished

Execution time 3 days
Feedback from employee
Great! Thank you for interesting task! Cheers!
Feedback from customer
Worked very hard to complete my complicated task and communicated well. I was impressed. Will hire again :)

Specification

I need help writing a bit of modular MQl5 code for EA integration.

The purpose of the code is to write the information of 20 different variables into a .csv file (in a format readable by excel) during the optimization in MT5.

It needs to write the information for all currently running optimization passes simultaneously in ontick()

(in other words, it needs the Frame() function)


I want it to write into a different file for each optimization pass.

(FrameInputs() does this)

So in other words pass1.csv pass2.csv, ect.


The variables to be written are empty, I will fill them later in my own. But the indexes need to have a variable name so I can feed them with information from another function.

The only variable I want you to write in is the TimeCurrent() into the first variable.


Here is an example of my (failed) code.

void OnTick()


  {

   int  data[20];
   data[0] = variable1;
   data[1] = variable2;
   data[2] = variable3;
   data[3] = variable4;
   data[4] = variable5;
   data[5] = variable6;
   data[6] = variable7;
   data[7] = variable8;
   data[8] = variable9;
   data[9] = variable10;
   data[10] = variable11;
   data[11] = variable12;
   data[12] = variable13;
   data[13] = variable14;
   data[14] = variable15;
   data[15] = variable16;
   data[16] = variable17;
   data[17] = variable18;
   data[18] = variable19;
   data[19] = variable20;

   ArrayInitialize(data,0);

// int values(int& data[])

   int hl=FileOpen("filetest",FILE_CSV|FILE_WRITE|FILE_SHARE_WRITE|FILE_ANSI|FILE_COMMON);

   if(hl==INVALID_HANDLE)
     {
      printf("Error %i creating tester file",GetLastError());
     }
   else
     {
      FileSeek(hl,0,SEEK_END);
      FileWrite(hl,data[0],data[1],data[2],data[3],data[4],data[5],data[6],data[7],data[8],data[9],data[10],data[11],data[12],data[13],data[14],data[15],data[16],data[17],data[18],data[19]);
      FileClose(hl);


      if(!FrameAdd("Statistics",0,0,data[
20 ]))
         printf("FrameAdd failed with error %i",GetLastError());
      else
        {
         Print("Frame added");
        }
     }


  }
//+----------------------

The results in the file should look something like this 

So excel reads them like this




The names and variables should be an empty value and return nothing unless I fill the variable.

So variable1 = 2, variable2 = "" variable3 = ""

and variablename1 = "drawdown", variablename2 = "", variablename3 = ""


Or something to that effect.


The end result is I want it to be modular and fill the file with whatever data I choose at a later point.


Responded

1
Developer 1
Rating
(216)
Projects
283
20%
Arbitration
28
57% / 14%
Overdue
0
Working
2
Developer 2
Rating
(27)
Projects
36
72%
Arbitration
1
0% / 0%
Overdue
2
6%
Free
Published: 2 articles, 12 codes
3
Developer 3
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
Similar orders
To build a Self-Hosted MT4/MT5 Cross-Broker Trade Copier I am looking to develop a trading and copy trading system based on an existing MT4/MT5 Client API or SDK, deployed on my own server(Windows Serve). The system should connect to standard trading accounts across different brokers and automatically copy trades from one master account to multiple follower accounts. Core requirements: The entire backend must operate
I am looking to acquire an existing, fully developed and tested XAUUSD trading signal system, either an MT5 indicator or an Expert Advisor. I am NOT looking for new strategy development, custom coding, or experimental systems. My objective is to own and independently operate a reliable gold trading signal source for personal trading and an international paid subscription service. Requirements: 1. An existing
TRADE COPIER 40+ USD
I WANT A CUSTOMIZED TRADE COPIER THAT CAN COPY TRADE TO DIFFERENT MT5 ACCOUNT WITHOUT LAG. THAT IS ENTRY, STOP LOSS AND TAKE PROFIT. LIMIT AND STOP ORDERS INCLUSIVE. EXECUTION TIME SHOULD BE ABOUT 2SECONDS AT MOST. MY BUDGET IS $40
Hello, How are you doing? I’m looking for an experienced blockchain developer to assist with the smart contract development and on-chain functionality for a Web3 fundraising platform. I’d like to see an overview of your pricing, development process, and estimated timeline for a project of this nature. Additionally, I’d like to understand how you approach smart contract testing, security reviews or audits, and

Project information

Budget
30 - 50 USD
Deadline
from 1 to 10 day(s)