Loading expert

Oct 24, 2012 at 2:59 AM

Hey,

I've created a small test EA from the documentation/step-by-step guide, but it seems like I'm missing some information as running the EA through the gateway gives this response on all Init/DeInit/Start calls: 

 24-10-2012 04:42:05 > 127.0.0.1:51655 : Connection opened 24-10-2012 04:42:05 > 127.0.0.1:51655 :  --> 133003EURUSDTraPlaTes|TraPlaTes|Start|

 24-10-2012 04:42:05 > 127.0.0.1:51655 : Can't load expert: Can't create intance of expert.. Failure Context: [ApplicationName=TraPlaTes, Discriminator=133003EURUSDTraPlaTes].Start() 24-10-2012 04:42:05 > 127.0.0.1:51655 : Connection closed

 

When testing with a direct copy of the MACrossExpert, no errors pop.

In the process of looking for differences, I see the documentation don't describe what namespace to use and MACrossExpert inherits from ExtendedExpertAdvisor rather than ExpertAdvisor as the documentation states.

If ExtendedExpertAdvisor is the prefered alternative, a reference to TradePlatform.MT4.Model is needed but not documented.

Making the above changes don't solve the issue either way.

The dll is named TraPlaTes.dll and the code is as follows:

namespace TradePlatform.MT4.Model.Experts
{

    using System;

    //using TradePlatform.MT4.SDK;                  // for meget i beskrivelsen. ikke med i sample MA Xover
    using TradePlatform.MT4.SDK.MQL;
    using TradePlatform.MT4.SDK.MQL.API;
    using TradePlatform.MT4.Model.ScrtiptHandlers;  // manglede i beskrivelsen og som reference.

    
    // public class TraPlaTes : TradePlatform.MT4.SDK.ExpertAdvisor  // var f�r
    public class TraPlaTes : ExtendedExpertAdvisor  
    {
        protected override int Init()
        {
            Console.WriteLine(this.AccountCompany());
            Console.WriteLine(this.AccountBalance());

            return 1;
        }

        protected override int DeInit()
        {
            Console.WriteLine("Bye.");

            return 0;
        }


        protected override int Start()
        {
            Console.WriteLine(this.Bid());
            return 1;
        }
 
    }
}

The config file lines for the experts are like this:

      <!-- Experts -->
	  <Application applicationName="TraPlaTes" className="TradePlatform.MT4.Model.Experts.TraPlaTes" assemblyName="TradePlatform.MT4.Model" />
	  
      <Application applicationName="MACrossExpert" className="TradePlatform.MT4.Model.Experts.MACrossExpert" assemblyName="TradePlatform.MT4.Model" />

Hope you can give me some insight on this.

 

-Filip

Coordinator
Oct 24, 2012 at 7:20 AM

if "The dll is named TraPlaTes.dll"

then configuration should be like

<Application applicationName="TraPlaTes" className="TradePlatform.MT4.Model.Experts.TraPlaTes" assemblyName="TraPlaTes.dll" />
Coordinator
Oct 24, 2012 at 7:31 AM

Regarding other questions:

"Can't load expert: Can't create instance of expert." - error means then is' unable to load your expert due to incorrect assembly definition in configuration.

"I see the documentation don't describe what namespace to use" - you can use any namespaces structure you desire, just make sure you configure it right.

ExtendedExpertAdvisor - is not preferred, it just has additional methods to init, start, deinit. Documentation describes how these additional abstraction have to implemented in Advanced development.

TradePlatform.MT4.Model assembly included in gateway directory by default.