Sign Up

Have an account? Sign In Now

Sign In

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask question.

Forgot Password?

Need An Account, Sign Up Here
Sign InSign Up

First independent community of traders

First independent community of traders Logo First independent community of traders Logo

First independent community of traders Navigation

  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • Buy Theme
  • Home
  • About Us
  • Blog
  • Contact Us
Home/ Questions/Q 4581
Next
In Process
nexxtor
nexxtor

nexxtor

  • 1 Question
  • 2 Answers
  • 0 Best Answers
  • 20 Points
View Profile
  • 0
nexxtor
Asked: December 27, 20202020-12-27T05:20:50+00:00 2020-12-27T05:20:50+00:00In: Forex Expert Advisors

How do I write optimization results to a file when using cloud agents?

  • 0

Good afternoon

How do I write the optimization results to a file when using Local Network Farm or MQL5 Cloud Network ?

There is a procedure in OnTester (void) that uses:

string toWrite = "test";
fileHandle=FileOpen(fileName,FILE_CSV|FILE_READ|FILE_WRITE|FILE_ANSI|FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_COMMON,",");
FileWrite(fileHandle,toWrite);
FileClose(fileHandle);
When using Local agents, the file with the optimization results is created in a shared folder; when using Local Network Farm or MQL5 Cloud Network, there is no file.

  • 6 6 Answers
  • 0 Followers
  • 0
Answer
Share
  • Facebook

    6 Answers

    • Voted
    • Oldest
    • Recent
    1. fxsaber

      fxsaber

      • 1 Question
      • 54 Answers
      • 0 Best Answers
      • 134 Points
      View Profile
      fxsaber
      2020-12-27T05:21:37+00:00Added an answer on December 27, 2020 at 5:21 am

      Nexxtor:

      How do I write the optimization results to a file when using Local Network Farm or MQL5 Cloud Network ?

      Forum on trading, automated trading systems and testing of trading strategies

      Questions from beginners MQL5 MT5 MetaTrader 5

      fxsaber, 2017.08.23 14:10

      To record data of Agents in a single file you need to use Frame mode.

      // Example of writing agent data (including Cloud data) to a single file
      input int Range = 0;

      void OnTick()
      {
      // ....
      }

      / / We open the file only in single-run or Frame modes.
      const int handle = ((MQLInfoInteger(MQL_TESTER) && !MQLInfoInteger(MQL_OPTIMIZATION)) || MQLInfoInteger(MQL_FRAME_MODE)) ?
                         FileOpen(__FILE__, FILE_WRITE | FILE_TXT) : INVALID_HANDLE;

      // Data preparation
      void GetData( string &Str, MqlTick &Ticks[], double &Balance )
      {
        Str = "Hello World!";
        
        CopyTicks(_Symbol, Ticks, COPY_TICKS_ALL, 0, 2); // The last two ticks (example)
        
        Balance = AccountInfoDouble(ACCOUNT_BALANCE);
      }

      / / Writing data
      void SaveData( const string &Str, const MqlTick &Ticks[], const double Balance )
      {
        FileWrite(handle, Str);
        
        for (int i = 0; i < ArraySize(Ticks); i++)
          FileWrite(handle, Ticks[i].bid);
          
        FileWrite(handle, Balance);
      }

      void OnTesterDeinit()
      {
        if (handle != INVALID_HANDLE)  
          FileClose(handle);
          
        ChartClose();
      }

      #include //

      double OnTester()
      {
        string Str;
        MqlTick Ticks[];
        double Balance;
        
        GetData(Str, Ticks, Balance); // Preparing data for recording

        if (MQLInfoInteger(MQL_OPTIMIZATION)) // Optimization of
      { CONTAINER
      <uchar> Container; //
          
          Container[0] = Str;
          Container[1] = Ticks;
          Container[2] = Balance;
        
          FrameAdd(NULL, 0, 0, Container.Data); // Sent data from the Agent to the Terminal
      }
      else / / Single run
        {    
          if (handle != INVALID_HANDLE)
      SaveData(Str, Ticks, Balance); / / Data will be written to the Agent's (not terminal's) MQL5Files folder)
          
          FileClose(handle);
        }
        
        return(0);
      }

      void OnTesterPass()
      {    
        if (handle != INVALID_HANDLE)
        {
          ulong Pass;
          string Name;
          long ID;
          double Value;
        
          CONTAINER<uchar> Container; //
        
          while (FrameNext(Pass, Name, ID, Value, Container.Data))
          {
            string Str;
            MqlTick Ticks[];
            double Balance;
            
            / / Received data from the Agent
            Container[0].Get(Str);
            Container[1].Get(Ticks);
            Container[2].Get(Balance);
            
      / / FileWrite(handle, Pass); / / If you want to record the pass number
            SaveData(Str, Ticks, Balance); / / the Data will be written to The mql5files folder of the Terminal (not the Agent)
          }
        }
      }

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    2. -aleks-

      -aleks-

      • 2 Questions
      • 35 Answers
      • 0 Best Answers
      • 72 Points
      View Profile
      -aleks-
      2020-12-27T05:21:25+00:00Added an answer on December 27, 2020 at 5:21 am

      Nexxtor:

      I refused frames for the reason that when the number of options is more than 18 steps, they did not work.

      as a result, I put an entry in the file in the OnTester procedure

      @Aleksey Vyazmikin, can you check if the frames will work if the number of options is greater than 18 degrees? maybe they’ve already fixed it…

      Uh, sorry for the stupid question, but what is “18 stepnen”? How much is it in numbers – I’m stupid. Or is it about the number of variables?

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    3. nexxtor

      nexxtor

      • 1 Question
      • 2 Answers
      • 0 Best Answers
      • 20 Points
      View Profile
      nexxtor
      2020-12-27T05:21:19+00:00Added an answer on December 27, 2020 at 5:21 am
      How do I write optimization results to a file when using cloud agents?

      Aleksey Vyazmikin:
      I have something like that now, everything works. But, it is only necessary to redo the work with writing to a file, since for this purpose I use a non-public class.

      I refused frames for the reason that when the number of options is more than 18 steps, they did not work.

      as a result, I put an entry in the file in the OnTester procedure

      @Aleksey Vyazmikin, can you check if the frames will work if the number of options is greater than 18 degrees? maybe they’ve already fixed it…

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    4. komposter

      komposter

      • 1 Question
      • 36 Answers
      • 0 Best Answers
      • 92 Points
      View Profile
      komposter
      2020-12-27T05:21:14+00:00Added an answer on December 27, 2020 at 5:21 am

      Oh, there is no fxsaber, and he would immediately give an answer.

      Dig in the direction of frames, all data from agents can be obtained.

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    5. alexx_v

      alexx_v

      • 1 Question
      • 4 Answers
      • 0 Best Answers
      • 26 Points
      View Profile
      alexx_v
      2020-12-27T05:21:00+00:00Added an answer on December 27, 2020 at 5:21 am

      Nexxtor:
      well, what kind of forum is this? doesn’t anyone have any ideas?

      no one will give You the opportunity to record anything on someone else’s remote machines, I think You would also be against having something start recording somewhere on your PC, then (probably) download it to your PC, etc.

      P. S.: check out this library, maybe it will give you some ideas on how to implement what you want

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    6. nexxtor

      nexxtor

      • 1 Question
      • 2 Answers
      • 0 Best Answers
      • 20 Points
      View Profile
      nexxtor
      2020-12-27T05:20:54+00:00Added an answer on December 27, 2020 at 5:20 am

      any ideas?

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    Leave an answer

    Leave an answer
    Cancel reply

    Browse

    Sidebar

    Ask A Question

    Stats

    • Questions 506
    • Answers 2k
    • Posts 5
    • Comments 0
    • Best Answers 0
    • Users 683
    • Popular
    • Comments
    • Tags
    • forexcommunity

      Highlighting what’s important about questions & Answers on Discy Community!

      • 0 Comments
    • forexcommunity

      Introducing Keyboard Shortcuts, our first Labs feature

      • 0 Comments
    • forexcommunity

      Defining quality on Discy Engine — what a helpful answer ...

      • 0 Comments
    • forexcommunity

      Organizational and company accounts on Discy Engine the next step

      • 0 Comments
    • forexcommunity

      Hello world!

      • 0 Comments

    Related Questions

    • JeffreySer

      2015 1-72 HOURS Twitter

      • 0 Answers
    • Jerrynug

      Игровые стратегии для бк

      • 0 Answers
    • Brus Agell

      Правельный выбор

      • 0 Answers
    • pinupcasinoo

      Pin Up Casino

      • 0 Answers
    • c00l777

      During optimization, indicators that are not present in the robot ...

      • 2 Answers

    Users

    JeffreySer

    JeffreySer

    • 1 Question
    • 0 Answers
    Jerrynug

    Jerrynug

    • 1 Question
    • 0 Answers
    Leonardcig

    Leonardcig

    • 0 Questions
    • 0 Answers

    Footer

    First independent community of traders

    About

    An independent community of forex traders. This is where traders communicate. You can ask your questions and you will receive an answer to your question.
    • Terms of Use
    • Privacy Policy
    • Cookie Policy
    • Knowledge Base
    • Support

    © 2021 Forexcommunity.net. All Rights Reserved