Voir comment télécharger gratuitement des robots de trading
Retrouvez-nous sur Twitter !
Rejoignez notre page de fans
Un script intéressant ?
Poster un lien vers celui-ci -
laisser les autres l'évaluer
Vous avez aimé le script ? Essayez-le dans le terminal MetaTrader 5
Bibliothèque

Memory Mapping - bibliothèque pour MetaTrader 5

Vues:
7768
Note:
(36)
Publié:
2012.01.13 13:48
Mise à jour:
2016.11.22 07:32
memmap32.zip (754.96 KB)
memmapdll.zip (29.22 KB)
Besoin d'un robot ou d'un indicateur basé sur ce code ? Commandez-le sur Freelance Aller sur 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


Traduit du russe par MetaQuotes Ltd.
Code original : 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.