MetaTrader4 ManagerAPI .NET Wrapper

This is a library for .NET, a wrapper for native MetaQuotes Manager API to work with MT4 server using any language that supports .NET. We all know that time is money. Using .NET you can develop applications much faster than using C++.
You can develop web applications on ASP.NET with no need in any third-party Web API (it saves your time and money)
In addition, you can automate any business process in a brief period using PowerShell/Python scripting.

You can get access to your MT4 server using any of these great languages:

  • C#
  • Visual Basic .NET
  • JScript .NET
  • C++/CLI (Managed C++)
  • F#
  • J#
  • PowerShell
  • Python for .NET (pythonnet)

Important feature is that you can use it when you develop web-application using ASP.NET framework, for example. You can use our wrapper directly from your web-site with no need to pay extra money to buy any Web API.
You can develop internal management and analytic system, you can write scripts to automate everyday routines easily, you can do even more tasks using our wrapper.

Usage examples

Deposit money using PowerShell script right from windows command line

All you need to start is our Wrapper and PowerShell that (usually) integrated within modern Windows OS.  For best experience you can use PowerShell ISE.
The script below shows depositing money, a hundred USD to the '1000' account. Put your MT4 server IP/Login and password.
Wrapper uses NLog, so you will need it at least version 4.0.
[Reflection.Assembly]::LoadFile($PSScriptRoot + "\NLog.dll")
[Reflection.Assembly]::LoadFile($PSScriptRoot + "\CPlugin.PlatformWrapper.MetaTrader4.dll")

$man = New-Object 'CPlugin.PlatformWrapper.MetaTrader4.Manager' -ArgumentList "127.0.0.1:443", "1", "manager"

try {
    $result = $man.Connect()
    if($result -ne 'Ok') {
        $result
        exit
    }
    
    $tti = New-Object CPlugin.PlatformWrapper.MetaTrader4.Classes.TradeTransInfo    
    $tti.TradeCommand = [CPlugin.PlatformWrapper.MetaTrader4.Classes.TradeCommand]::Balance # trade command
    $tti.TradeTransactionType = [CPlugin.PlatformWrapper.MetaTrader4.Classes.TradeTransactionType]::BrBalance # transaction type
    $tti.OrderBy = 1000 # account login
    $tti.Price = 100 # amount
    $tti.Comment = "Deposit" # trade comment
    
    $man.TradeTransaction([ref] $tti);

} finally {
    $man.Disconnect()
}

Same, but using C#

CPlugin.PlatformWrapper.MetaTrader4.Manager man = null;

try
{
	man = new CPlugin.PlatformWrapper.MetaTrader4.Manager
	{
		Server = "127.0.0.1",
		Login = "1",
		Password = "Password"
	};

	var tti = new TradeTransInfo
	{
		radeCommand = TradeCommand.Balance,
		TradeTransactionType = TradeTransactionType.BrBalance,
		OrderBy = 1000,
		Price = 100,
		Comment = "Deposit"
	};

	var result = man.TradeTransaction(ref tti);
        // in 'tti' you will receive order id
}
finally
{
	if(man != null)
		man.Disconnect();
}