Help with this simple script

 

I don't really know anything about programming in MQL5 but I would like someone to help me edit this script by modifying this one so that can add a line of code that can print a header of reference for each column such as: Date, Open, High, Low, Close for each CSV book and that the data can be printed from the most recent to the oldest instead of the oldest to the newest


string str_write = "";

StringConcatenate( str_write

, TimeToString( rates_array[i].time, TIME_DATE )

, ",", DoubleToString( rates_array[i].open , digits )

, ",", DoubleToString( rates_array[i].high , digits )

, ",", DoubleToString( rates_array[i].low , digits )

, ",", DoubleToString( rates_array[i].close , digits )

, "\n" );

FileTxt.WriteString( str_write );


//---

FileBin.WriteDouble (  rates_array[i].open );

FileBin.WriteDouble (  rates_array[i].low );

FileBin.WriteDouble (  rates_array[i].high );

FileBin.WriteDouble (  rates_array[i].close );

}


Print( symbol, ", ", EnumToString( period ), ": ", IntegerToString( copy_count ), " bars have been written to \"", FileTxt.FileName(), "\" and \"", FileBin.FileName(), "\" within ", DoubleToString( (GetTickCount() - start)/1000.0, 1 ), " sec!" );

FileTxt.Close();

FileBin.Close();


 

The best thing for you would be to ask a freelancer to do it for you!

But please be sure to read beforehand:

https://www.mql5.com/en/job/rules // rules
https://www.mql5.com/en/articles/4368 // EA   requirements specification
https://www.mql5.com/en/articles/4304 // Indi requirements specification
https://www.mql5.com/en/articles/117 // How to Order a Trading Robot in MQL5 and MQL4

Trading applications for MetaTrader 5 to order
Trading applications for MetaTrader 5 to order
  • 2022.08.03
  • www.mql5.com
The largest freelance service with MQL5 application developers
 
dexink: I don't really know anything about programming in MQL5 but I would like someone to help me … can be printed from the most recent to the oldest instead of the oldest to the newest
  1. Please edit your (original) post and use the CODE button (or Alt+S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum (2019)
              Messages Editor

  2. You have only four choices:

    1. Search for it (CodeBase or Market). Do you expect us to do your research for you?

    2. Beg at:

    3. MT4: Learn to code it.
      MT5: Begin learning to code it.

      If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into your code.

    4. Or pay (Freelance) someone to code it. Top of every page is the link Freelance.
                Hiring to write script - General - MQL5 programming forum (2019)

    We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using CODE button) and state the nature of your problem.
              No free help (2017)

  3. Your posted code does not print oldest to newest; it prints one (at index i). Always post all relevant code (using Code button) or attach the source file.
         How To Ask Questions The Smart Way. (2004)
              Be precise and informative about your problem

Reason: