This project is read-only.

Model Project

Model Project is set of examples giving you understanding how to develop you own Experts, Indicators or Scripts with .NET. Given examples are in C# and located under 'Source Code'.

Model Project includes following examples:
  • Mechanical trading system based on moving averages.
  • Custom indicator showing previous day highest and lowest price.
  • Script that imports order and account information to SQL database using Entity Framework.
  • Script that sends email by using .NET classes.
  • Script that runs test classes for MQL functions.
  • Custom MQL call handler which meant to count tick execution time.

Common development process

Regular development approach is following:
  • Create new Class Library in Visual Studio 2012. Add references to following assemblies:
    • TradePlatform.MT4.CodeBase.dll
    • TradePlatform.MT4.Data.dll
    • TradePlatform.MT4.SDK.dll
  • Create new class and inherit one from TradePlatform.MT4.SDK.ExpertAdvisor base abstraction.
  • Implement 3 abstract methods: Init(), Start() and DeInit() in a same way like MQL scripts do.
  • Add using directives:
    • using TradePlatform.MT4.SDK;
    • using TradePlatform.MT4.SDK.MQL;
    • using TradePlatform.MT4.SDK.MQL.API;
  • You can access MQL function via 'this' keyword. (ex. this.AccountNumber();)
  • After compiling your implementation of .NET ExpertAdvisor, place output assembly to Gateway Directory.
  • Configure Gateway Configuration and restart .NET Gateway. See details .NET Gateway 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.
  • Track execution results in .NET Gateway console.

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

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

Last edited Sep 24, 2012 at 1:39 PM by vladkalos, version 8


No comments yet.