Guarda come scaricare robot di trading gratuitamente
Ci trovi su Twitter!
Unisciti alla nostra fan page
Script interessante?
Pubblica il link!
lasciare che altri lo valutino
Ti è piaciuto lo script? Provalo nel Terminale MetaTrader 5
Librerie

Memory Mapping - libreria per MetaTrader 5

Visualizzazioni:
7718
Valutazioni:
(36)
Pubblicato:
2012.01.13 13:48
Aggiornato:
2016.11.22 07:32
memmap32.zip (754.96 KB)
memmapdll.zip (29.22 KB)
Hai bisogno di un robot o indicatore basato su questo codice? Ordinalo su Freelance Vai a Freelance

This project (Visual C++ 2010) contains 2 classes - CMemMapApi и CMemMapFile.

They designed for working with memory mapped files. You can:

  • Create file in memory;
  • Write and read data from memory mapped file;
  • It provides an opportunity to exchange data between applications, including MetaTrader 4 и МetaТrader 5.
Using memory mapped files you can achieve a great performance in data exchange.

The main application is the data exchange:
  • Copying of the trades for several terminals on one PC
  • Quotes data exchange for the arbitrage Expert Advisors etc.

The memory mapped files can be used for a serve of the temporary data of the Expert Advisors.
The CMemMapApi class is just a wrapper of WinApi functions, that's the difference between CMemMapFile and CMemMapApi.

The CMemMapFile is useful, because it serves file name, file handle and controls the checkings of file size. In contrast, CMemMapApi class can work with several memory mapped files.

In current project the exported DLL functions are organized in CMemMapApi for working with several memory-mapped files.
The CMemMapFile class is designed for working with memory mapped files in other C++ projects.

Exported functions:
//--- open/create memory-mapped file and returns handle
int MemOpen(string path,int size,int mode,int &err[]);
//--- closes memory mapped file
void MemClose(int hmem);             
//--- increases the size of memory-mapped file
int MemGrows(int hmem,string path,int newsize,int &err[]);
//--- returns the size of memory mapped file
int MemGetSize(int hmem, int &err[]);
//--- sets the size of memory mapped file
int MemSetSize(int hmem, int size, int &err[]);
//--- writes v vector (size bytes) to memory-mapped file starting from position pos
int MemWrite(int hmem,int &v[], int pos, int size, int &err[]);       
//--- reads v vector (size bytes) to memory-mapped file starting from position pos
int MemRead(int hmem, int &v[], int pos, int size, int &err[]);
//--- writes a string (size bytes) to memory-mapped file starting from position pos
int MemWriteStr(int hmem, string buf, int pos, int size, int &err[]);
//--- reads a string (size bytes) from memory-mapped file starting from position pos
int MemReadStr(int hmem, string buf, int pos, int &size, int &err[]);

Example of the DLL use:  Quotes Monitoring (memory-mapped file)

12.03. 2012: Fixed an error in MemWriteStr


Tradotto dal russo da MetaQuotes Ltd.
Codice originale https://www.mql5.com/ru/code/816

Quotes Monitoring  (memory-mapped file) Quotes Monitoring (memory-mapped file)

This Expert Advisor is example of use of the Memory Mapping DLL for working with File Mapping functions. In this example the Expert Advisor create a virtual (memory-mapped) file and start to update the quotes on symbol. Using this way, Expert Advisors can exchange data (for example, quotes) using common memory-mapped file.

IncRVIOnArray IncRVIOnArray

CRVIOnArray class is designed for calculation of RVI (Relative Vigor Index) values on indicator buffers. Test_RVIOnArray indicator is provided as the example of the class use.

File Mapping  without DLL File Mapping without DLL

The classes (conveted from C++ to MQL5) for working with memory mapped files.

BykovTrend_HTF_Signal BykovTrend_HTF_Signal

BykovTrend_HTF_Signal shows a trend direction or a signal for performing a deal generated by BykovTrend indicator as a graphic object with colored trend indication or deal direction.