This project is read-only.

Common development process

  • Create new Class Library in Visual Studio 2012. Add references to following assemblies:
    • TradePlatform.MT4.Data.dll
    • TradePlatform.MT4.Core.dll
    • TradePlatform.MT4.SDK.API
  • Create new class and inherit one from TradePlatform.MT4.Core.ExpertAdvisor base abstraction.
  • Implement your Expert, Indicator or Script according to following example:



using System;
using TradePlatform.MT4.SDK.API;
using TradePlatform.MT4.Core;

    public class MyExpert : ExpertAdvisor
        protected override int Init()
            return 1;

        protected override int Start()
            double fastMA = this.iMA(this.Symbol(), TIME_FRAME.PERIOD_H1, 3, 0, MA_METHOD.MODE_EMA, APPLY_PRICE.PRICE_CLOSE, 0);
            double slowMA = this.iMA(this.Symbol(), TIME_FRAME.PERIOD_H1, 5, 0, MA_METHOD.MODE_EMA, APPLY_PRICE.PRICE_CLOSE, 0);

            fastMA = Math.Round(fastMA, this.Digits());
            slowMA = Math.Round(slowMA, this.Digits());

            this.OrderSend(this.Symbol(), ORDER_TYPE.OP_BUY, 0.1, this.Ask(), 3, this.Bid() - 100 * this.Point(), this.Bid() + 100 * this.Point());

            return 1;

        protected override int DeInit()
            return 1;



  • After compiling your implementation of .NET ExpertAdvisor, place output assembly to application directory which hosts .NET Bridge. (default Shell.exe)
  • Setup Bridge Configuration in application config file and restart host application. See details Bridge Configuration).
  • Configure MetaTrader's Expert_NET, Indicator_NET or Script_NET (depends on way you want to use your .NET ExpertAdvisor). See details MetaTrader 4 expert configuration.
  • If you host your application in .NET Shell you can observe results in console application. Otherwise, same logs are visible in Debug output.

Notice. You easily your application by attaching Visual Studio to Shell.exe process.

Notice: All TradePlatform.MT4.Core.ExpertAdvisor derived classes can act like Experts, Indicators or Scripts on MetaTrader's side.

Input Prameters

you can use input parameter for yours .NET ExpertAdvisor in same purposes as you have in MQL.
To declare one in .NET ExpertAdvisor create a public property in your class


public int TestProperty { get; set; }

and you can set it up in .NET Bridge configuration section


<Handler name="name" typeName="fullClassName" assemblyName="assemblyName">
      <Parameter propertyName="TestProperty" propertyValue="25" />

Indicator development

Developing Indicator with TradePlatform.NET is a bit different thing due to nature MQL approach for this. TradePlatform.NET (for now) do not support passing arrays, so program complete indicator in C# is impossible. Suggested approach is extension method for MQL buffers you need and set value via them. For details see PrevDayHighLowIndicator sample implementation.

Last edited Nov 5, 2012 at 2:22 PM by vladkalos, version 7


abhacid Aug 28, 2014 at 7:21 PM 
The procedure don't work!!!

Guitar Jan 3, 2013 at 3:24 PM 
in particular, what means: "place output assembly to application directory which hosts .NET Bridge. (default Shell.exe)"
what is "output assembly"?

Guitar Jan 3, 2013 at 3:19 PM 
advice please
I couldn't start debugging using this incomplete manuals, can you create step by step instructions? This would be very useful for all C# novices
Thanks a lot Vladkalos!