+44 12 2858 8888 info@cplugin.com
Failed to load licensing components!

Please RE-INSTALL / REPAIR Module! DO NOT UNINSTALL MODULE which will cause unrecoverable data loss!

MetaTrader4 ManagerAPI .NET Wrapper

This is a library for .NET, a wrapper for native MetaQuotes ManagerAPI 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++.
Furthermore, you can develop web applications on ASP.NET with no need in any third-party WebAPI (it saves your time and money)
In addition, you will be able to automate any business process in short period using PowerShell/Python scripting.

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
  • 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 very 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 working with MT4 server is our Wrapper and PowerShell interpreter that (usually) integrated within modern Windows OS.  For best experience you might want 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: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()
}

Very 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();
}