MetaTrader Trading Tools
Showing 93 results in this view

ZeroMQ asynchronous communication

ZEROMQ

Quote:

"Ø  The socket library that acts as a concurrency framework.

 Ø  Carries messages across inproc, IPC, TCP, and multicast.

 Ø  Connect N-to-N via fanout, pubsub, pipeline, request-reply.

 Ø  Fast enough for clustered products and supercomputing.

 Ø  Asynch I/O for scalable multicore message-passing apps.

 Ø  Large and active open source community.

 Ø  20+ languages including C, C++, Java, .NET, Python.

 Ø  Most OSes including Linux, Windows, OS X.

 Ø  LGPL free software with full commercial support."

And its very simple to use. Notice that you cant automatically connect to a raw socket, we're connecting zeromq to zeromq here. Though i think there is support for adding raw sockets into a network using zeromq_poll, though i haven't bound that yet.

"Native" MQL HTTP Client

Author:

gunzip <spammmmme@gmail.com>

Description:

It doesn't require any external dll(s) apart from the standard wininet shipped with win32.

Moreover it provides some file upload ability.

Put this in experts/include subfolder.

Usage:

NOTES

  • you _must_ pass two arrays for params and filenames. pass an empty two dimensional array if you have no files/params (ie. string params[][];)
  • files to upload MUST reside in experts/files subfolder

Tester Control

Idea: As far as i know, many times i need backtest some EA to find a proper settings. Run backtest from time1 to time2, change settings and run again... after 1h waiting, must click to Start and test is again.

If u use or something similar or newer, u can fully automated the whole backtest pocedure. Just using this library... :D

So the inspiration was the - , but his code is not as good enough (btw thanks), ofc my code isnt so good...

Library:

2 files needed:

- MetaTrader\experts\include -> testerControl.mqh - MetaTrader\libraries -> specialUser32.mq4 u must compile specialUser32 solo, because some control handling need different type of SendMessageA function from user32.dll, in this file the lparam is string not an integer. and testerControl file using this specialUser32 as a library importing by ex4 file.

Sample:

- MetaTrader\experts\scripts -> AutomataTesterSample.mq4

In this sample demonstrate how u can use this library, simply as enough. Specify multiple experts,symbol,period,(from-to) time... Ofc use them in your own way, just few requirements needed: use this funtion on Init() procedure - this rutin detect a Tester window and controls...

and set the tester options by

and run it by

thats all folks.

Update 1.1

new method present - settings are similar the expert properties window

Features for futures:

- u can edit optimalization parameters via this library

BB_MACD_funcs

In this library there are 2 functions iBandsfunc and iMACDfunc, which extend calculating capabilities of the appropriate functions, e.g. for expert advisers.

The standard function is calculated by using the deviation only as an integer value and on the basis of a simple moving average (SMA). In iBandsfunc it is possible to use deviation as a double value and other .

The standard function is calculated by formulas:

where MACD is calculated on the basis only of the exponential moving average (EMA), and the signal line - a simple moving average (SMA). In iMACDfunc it is possible to choose a moving average for main (MACD) and signal line.

Examples of the use these functions can be found in the attached file.

iACfunc, iAOfunc and iBearsBullsfuncs

In this library you will find 3 custom functions: iACfunc, iAOfunc and iBearsBullsfuncs, which extend calculating capabilities of the appropriate functions and may be used for example in expert advisers.

In contrast to standard function the proposed function iACfunc allows to calculate value with possibility to choose , and periods according to the following formulas:

double iACfunc (string Sy, int Tf, int MA_mode, int Applied_price, int Period_1, int Period_2, int Period_3, int Shift)

In contrast to standard function the proposed function iAOfunc allows to calculate value with possibility to choose , and periods according to the following formula:

double iAOfunc (string Sy, int Tf, int MA_mode, int Applied_price, int Period_1, int Period_2, int Shift)

In contrast to standard functions and the proposed function iBearsBullsfuncs allows to calculate values with possibility to choose also according to the following formulas:

double iBearsPowerfunc (string Sy, int Tf, int BearsPeriod, int Applied_price, int Bears_MA_mode, int Shift) double iBullsPowerfunc (string Sy, int Tf, int BullsPeriod, int Applied_price, int Bulls_MA_mode, int Shift)

Input parameters:

  • Sy - symbol,
  • Tf - timeframe,
  • MA_mode, Bears_MA_mode, Bulls_MA_mode - moving average,
  • Applied_price - applied price,
  • Period_1, Period_2, Period_3, BearsPeriod, BullsPeriod - period for calculation of appropriate moving average,
  • Shift - index of the value taken from the indicator buffer.

More detailed description of parameters with examples you will find in the attached zip file.

Export to Excel in Real Time

I use DDE library provided by Windows and wrap it up so that a novice coder can use it easily.

DDE works as follow:

  1. Initialize DDE
  2. Create string handle for Excel Application (in DDE term, it is known as SERVICE)
  3. Create string handle for Sheet name (TOPIC)
  4. Connect to Sheet
  5. Free the above handles, they won't be used anymore
  6. Create string handle for cell (ITEM) using cell address in R1C1 style
  7. Send the data
  8. To export data to another cell, repeat 6-7
  9. You can reuse the already created items' handle (in case you want to update the cells regularly)
  10. Before program return, free all items' string handle
  11. Disconnect Excel and sheet
  12. Uninitialize DDE

Make sure to enable "Allow DLL imports" in Expert Advisor settings. You may need to disable MT4 DDE Server before running this script.

There are 2 files attached in this post:
  • ExcelExportLib.mq4, put this file in experts\libraries folder. This is just a simple mq4 library that wrap a few DDE functions.
  • ExcelExportTest.mq4, put this file in experts\scripts folder. This is a test script that will write text on Excel Sheet 1, cell R2C2

Cheers,

sangmane

ALGLIB - Numerical Analysis Library

Sergey Bochkanov. ALGLIB project website - . The library dates .

Note: The Expert Advisor works with MetaTrader 4 .

The archive must be unpacked to: terminal_data_folder. The codes of the library are located in terminal_data_folder\Math\Alglib\ Examples of test scripts are located in terminal_data_folder\MQL4\Scripts\Alglib\

ALGLIB is one of the largest and most complete mathematical libraries

Do you need to make a fast Fourier transform or to solve a differential equation system? Do you perform a complex data analysis trying to gather all methods in one place as a source code? Then library of numerical methods is for you!

ALGLIB is currently one of the best libraries of the multi-language algorithms. Below are ALGLIB features mentioned on the official website:

CAlglib class static functions should be used to work with the library - all library functions are moved to CAlglib system class as static functions.

testclasses.mq4 and testinterfaces.mq5 test cases scripts are attached together with a simple usealglib.mq4 demo script. Include files of the same name (testclasses.mqh and testinterfaces.mqh) are used to launch test cases. They must be placed to \MQL4\Scripts\Alglib\Testcases\.

Note: testclasses.mq4 script execution takes quite a long time (about 30 minutes).

Below is more detailed information about ALGLIB MQL4 ported library packages:

Code:

Library functions have detailed comments on their usage.

CAlglib class static functions should be used to work with the library. Below is usealglib.mq5 function script's source code for calculation of some statistical trading parameters:

We will receive the following result (depening on results of your trading):

Simple UnitTest include library for new MQL4

This is a simple (cheap) UnitTest include library for MQL4.

How to use:

See a sample attacched: TestExpert.mq4

By UnitTest#printSummary(), the result is output as follows:

Distribution:

Source is distributed at .

mt4R for new MQL4

mt4R, originally developed by Bernd Kreuss and distributed , does not work correctly with new MQL4.

I modiifed the dll and the include file to support new MQL4.

Trouble or Bug Report:

If you are in trouble with this, please report it to GitHub .

Because MQL4.com notification is broken, I cannot notice someone reported here.

Changelog is also at and .

Update history:

Feburary 10, 2014: v1.4.0-b7: Added sample experts: Arb-O-Mat and Trend-O-Mat(GitHub).

Feburary 9, 2014: v1.4.0-b6: Fixed the bug of RGetBool/RGetInteger(Github).

Feburary 9, 2014: v1.4.0-b5: Fixed the bug of RAssignString(Github).

Feburary 7, 2014: v1.4.0-b1: Changed MQL file encoding to UTF-16

Feburary 6, 2014: v1.4.0-b0: Initial snpashot

Source:

Source codes are distributed at a .

Note:

  • Testing is not enough
  • I had only confirmed that it seems work good with R-3.0.2 on Windows 2012 R2.
  • Performance may be slightly worse, because wide string in arguments is always converted to ansi string.

MySQL for new MQL4 (tested in build 600)

Author:

Originally created by , then modified by and now forked by

Since build 600 of MT4 was released, it's no longer easy to communicate with DLLs that use ANSI format for strings because strings in MQL4 are now in UNICODE format (read more ).

This library is based on of and uses techniques taken from library and from by

Any contribution appreciated.

Example:

Source:

Source is distributed at . Any contribution is highly appreciated.

HashMap implementation

Description:

This is a HashMap implementation. This allows something like arrays but with string indexes. It maps strings to Objects. The Objects must be a subclass of the HashValue class provided.

The Hash by default will 'adopt' the value objects. In which case it will free the memory when they are no longer in the hash. This can be disabled in the constructor.

Documentation:

125

Below is an example, and it is also used in my class, to represent JSON Objects.

HTTP requests for new MQL4 (tested in build 600)

Description:

Example:

Source:

Source is distributed at . Any contribution is highly appreciated.

Credits: