-
Notifications
You must be signed in to change notification settings - Fork 285
Home
Welcome Bonginhlahla Sithole edited this page Jun 3, 2020
·
2 revisions
This documentation was taken from http://mtapi4.net/how-to-use/
MetaTrader API for using with .NET framework
Download executable files from release page https://github.com/vdemydiuk/mtapi/releases
- Install MtApi to program’s folder ( by default “C:\Program Files” ).
- Install MtApi expert into the terminal:
- Metatrader 4
Installer of MtApi try to automaticaly copy file MtApi.ex4 to Data User Folder of MetaTrader 4. If you will not find the expert MetaTrader you can copy it manually from “[MtApi installed folder]\experts\” ( by default “C:\Program Files (x86)\MtApi\experts\” ) to experts folder of MetaTrader 4 (open this folder from menu File–>Open Data Folder).- Metatrader 5
Click on MtApi5.ex5 from “Start -> MtApi5 -> Expert”. Expert will be added to the terminal automatically.
- Setup expert’s options:
- Metatrader 4
Tools -> Options -> Expert Advisors:
- Metatrader 5
Tools -> Options -> Expert Advisors:
- Attach MtApi Expert Advisor to Chart.
- Metatrader 4
- Metatrader 5
-
Set parameters of MtApi Expert:
Port defines a port of connection.
It has default values: 8222 (MT4) or 8228 (MT5). -
Add References to MtApi.dll and Newtonsoft.Json.dll into your project in Visual Studio from installed MtApi folder
-
Enjoy! (see examples for using MtApi).
How to use backtesting (in MetaTrader 4):
- Open Strategy tester (Ctrl+R).
- Select MtApi.ex4. You can set port for connection in Expert properties.
- Set all necessary properties for backtesting (Period, Symbol, dates and other).
- Press Start. MtApi.ex4 will wait on incoming connection from client side.
- Start client side and connect on defined port. MtApi.ex4 will resume backtesting.