MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal

Automated Trading Language Documentation

Subscribe to signal
NN Candlesticks
62.87%, 6 761.90 USD
MetaQuotes ID in MetaTrader Mobile Terminal MetaQuotes ID in MetaTrader Mobile Terminal Exp_ZPF Expert Advisor
Exp_ZPF
Author: GODZILLA
Trajecta Labs Vision School G4Trajecta Labs Vision School G4 Try product
Trajecta Labs Vision School G4
Author: figurelli
Screenshot
GCKH92, D1
Demo

Save

Saves data array in the file.

virtual bool  Save(
   int  file_handle      // File handle
   )

Parameters

file_handle

[in]  Handle to open earlier, with the function FileOpen (...), binary file.

Return Value

true – if successfully completed, false - if an error.

Example:

//--- example for CArrayLong::Save(int)
#include <Arrays\ArrayLong.mqh>
//---
void OnStart()
  {
   int         file_handle;
   CArrayLong *array=new CArrayLong;
   //---
   if(array!=NULL)
     {
      printf("Object create error");
      return;
     }
   //--- add 100 arrays elements
   for(int i=0;i<100;i++)
     {
      array.Add(i);
     }
   //--- open file
   file_handle=FileOpen("MyFile.bin",FILE_WRITE|FILE_BIN|FILE_ANSI);
   if(file_handle>=0)
     {
      if(!array.Save(file_handle))
        {
         //--- file save error
         printf("File save: Error %d!",GetLastError());
         delete array;
         FileClose(file_handle);
         //---
         return;
        }
      FileClose(file_handle);
     }
   delete array;
  }


Updated: 2010.02.09