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 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.
Solicitudes similares
Acquire existing profitable Expert Advisor with source code for client investment portfolio - Full .mq5 code (clean & commented) - 4+ years backtest (Jan 2022 - Dec 2025, 100% tick data) - ~10% monthly return - Max DD ≤15% - No grid/martingale (strictly enforced) - 1-month forward test required - Send trade history + EA details for review - Demo EA file needed for backtest replication - Open to any currency
Hello, How are you doing? i need a developer who can help me work on my FXDreema project. I did an extensive back testing and come up with an edge wich i would like to automate, it's a mechanical strategy that waits for a session sweep, wait for certain confluences and then a 5min FVG. Kindly bid if this is what you can do. Thanks
Hello, How are you doing? i need a developer who can help me work on my FXDreema project. I did an extensive back testing and come up with an edge wich i would like to automate, it's a mechanical strategy that waits for a session sweep, wait for certain confluences and then a 5min FVG. Kindly bid if this is what you can do. Thanks
I'm looking for a skilled trader/developer to share a proven scalping strategy on M1-M5 timeframes without using Martingale, Grid trading, or Hedge. Requirements: - Minimum trade duration: 2 minutes - Lot size: <20 - Proof of skill: Provide MT4/MT5 trade history report (PDF/HTML) - No High Frequency Trades - GMT+1 timezone, flexible hours - Price negotiable, performance-based compensation possible If you're a
I have an indicator i need automated i use it manually and it plots arrows. Can you automate it for my Ninjatrader8? Do you need to see file? Expert Ninjatrader Developer can Bid for this project
I am seeking a highly experienced MT4/MT5 developer to analyze my trade history and replicate the trading strategy into a new Expert Advisor. The developer must have proven experience in strategy reverse-engineering, trade data analysis, and EA development across various trading methodologies. Strong familiarity with EURUSD trading behavior and chart analysis is essential. Please keep on mind we don't have physical
Hi, im not looking into developing a new EA. I am looking into purchasing an existing EA that can deliver such results like: mq5 source, 4‑year backtest (2022‑2025) report, equity curve, trade list, strategy description, and 1‑month demo access. Please without concrete prove of experience functioning existing EA working perfectly and as contained on my description, then we can't strike a deal. Thank you
🔥 Premium Trading Website for Sale – NeuroTraderX.com (Ready-Made Signal Business) NeuroTraderX.com is a professionally branded, fully functional trading website designed specifically for Forex / Crypto / Indices traders, signal providers, and prop-firm traders who want to monetize their trading immediately without building everything from scratch. This is not just a website — it’s a complete trading business
Hi, I need a StrategyQuant X template built for index trading. The template must include: 1. Session and Time Filters The strategy must only trade inside fixed GMT sessions for each index. These sessions must be converted to broker server time and stay correct when the broker switches between summer and winter time. The template also needs optional delay blocks around market opens, a lunch window filter, and simple
IF you are a successful trader with a scalping method on M1 - M5 and you are able to teach me your strategy without dangerous strategy like Martingale, Grid trading, even hedging without High Frequency Trades [means minimun duration is > 2 minutes with number of lot less than 20 WITH proof of this skill by showing a PDF [or HTML] report produce directly by MT4 or MT5 ===> NOTE THAT WITHOUT THIS LIST OF TRADE FROM