+44 12 2858 8888 info@cplugin.com

MetaTrader4 ManagerAPI .NET Wrapper

This is a .NET library, a wrapper for native MetaQuotes ManagerAPI to work with MT4 server using any language that supports .NET (it makes development happier)
Furthermore, you can develop web applications using ASP.NET with no need in any third-party WebAPI (it saves your money)
In addition, you will be able to automate any business process in short period using PowerShell scripting (it saves your time)

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

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

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 very easily, you can do even more tasks using our wrapper.

Examples of use

Deposit money using PowerShell script from windows command line

All you need to start working with MT4 server is our Wrapper and PowerShell interpreter that (usually) integrated within modern Windows OS.  For better experience you might try to use PowerShell ISE.
The script below shows the process of depositing money, a hundred USD to the '1000' account. Put your MT4 server IP/Login and password as well.
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:1443", "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()
}

Deposit money 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
	          {
		          TradeCommand = TradeCommand.Balance,
		          TradeTransactionType = TradeTransactionType.BrBalance,
		          OrderBy = 1000,
		          Price = 100,
		          Comment = "Deposit"
	          };

	var result = man.TradeTransaction(ref tti);
}
finally
{
	if(man != null)
		man.Disconnect();
}