How can i build a test version of my EA after developing

 

I'm wondering how i can export my EA bot, i want to send it to someone for testing  before i can consider publishing to the market.

So is there a way to build a test version that someone else can install on there own meta trader 5 account, like building a file that i can lay my hands on and install

 
5000543585:

I'm wondering how i can export my EA bot, i want to send it to someone for testing  before i can consider publishing to the market.

So is there a way to build a test version that someone else can install on there own meta trader 5 account, like building a file that i can lay my hands on and install

Create a mini version of  the entire EA, limiting it to maybe a particular TF and/or Symbol. Publishing the EA automatically creates a demo, with some restriction like working only in tester etc

 
Thank-god Avwerosuoghene Odukudu #:

Create a mini version of  the entire EA, limiting it to maybe a particular TF and/or Symbol. Publishing the EA automatically creates a demo, with some restriction like working only in tester etc

Sorry what do you mean by that, my EA Project  contains about three files one ea and other two libraries i created so how wil i make it a  mini version

.
Should i copy the libraries into the EA file or what i dont understand
 
5000543585: I'm wondering how i can export my EA bot, i want to send it to someone for testing  before i can consider publishing to the market.

So is there a way to build a test version that someone else can install on there own meta trader 5 account, like building a file that i can lay my hands on and install

To make a test version, simply add some restrictions (like the account number, broker name or only demo accounts, etc.), and then compile it (with MQL Cloud protection), giving only the final executable file to your beta testers.

Forum on trading, automated trading systems and testing trading strategies

Account restriction

Fernando Carreiro, 2016.05.14 13:13

Here is some sample code for various restrictions to be applied on an EA, including that of a Account number. Just set the variables according to your requirements:

//+------------------------------------------------------------------------------------+
//      Variables for Handling of Licensing Restrictions
//+------------------------------------------------------------------------------------+
bool
   boolRestrictExpiration     = false, // Set to true, to use an Expiration Date
   boolRestrictAccountNumber  = false, // Set to true for Restricting by Account Number
   boolRestrictAccountName    = false, // Set to true for Restricting by Account Name
   boolRestrictAccountServer  = false, // Set to true for Restricting by Account Server
   boolRestrictAccountCompany = false, // Set to true for Restricting by Account Company
   boolRestrictDemoAccount    = false, // Set to true, to only allow Demo Accounts
   boolRestrictSymbols        = false, // Set to true, to only allow certain Symbols
   boolRestrictAlert          = true;  // Display Alert Message when Restrictions apply
datetime
   dtRestrictExpiration       = D'2016.12.31';  // Restricted by Expiration Date
long
   longRestrictAccountNumber  = 123456789;      // Restricted by Account Number
string
   strRestrictAccountName     = "Client Name",  // Restricted by Account Name
   strRestrictAccountServer   = "Server Name",  // Restricted by Account Server
   strRestrictAccountCompany  = "Company Name", // Restricted by Account Company
   strRestrictSymbols[]       = { "EURUSD", "GBPJPY", "NZDCAD" }, // Restricted Symbols
   strRestrictAlertCaption    = "Restrictions", // Alert Message Box Caption
   strRestrictAlertMessage    =
      "ATTENTION! Due to Licensing Restrictions, code execution has been blocked!";
      // Message to be used when Restrictions have been detected

//+------------------------------------------------------------------------------------+
// Function to Test Restrictions during Initialisation   
//+------------------------------------------------------------------------------------+
bool boolRestrictOnInit()
{
   if( boolRestrictAccountNumber )
      { if( AccountInfoInteger( ACCOUNT_LOGIN )      != longRestrictAccountNumber )
         { voidRestrictAlert(); return( true ); } }
   if( boolRestrictAccountName )
      { if( AccountInfoString( ACCOUNT_NAME )        != strRestrictAccountName    )
         { voidRestrictAlert(); return( true ); } }
   if( boolRestrictAccountServer )
      { if( AccountInfoString( ACCOUNT_SERVER )      != strRestrictAccountServer  )
         { voidRestrictAlert(); return( true ); } }
   if( boolRestrictAccountCompany )
      { if( AccountInfoString( ACCOUNT_COMPANY )     != strRestrictAccountCompany )
         { voidRestrictAlert(); return( true ); } }
   if( boolRestrictDemoAccount )
      { if( AccountInfoInteger( ACCOUNT_TRADE_MODE ) != ACCOUNT_TRADE_MODE_DEMO   )
         { voidRestrictAlert(); return( true ); } }
   if( boolRestrictSymbols() )
      { voidRestrictAlert(); return( true ); }
   return( boolRestrictOnTick() );
}

//+------------------------------------------------------------------------------------+
// Function to Test Variations of Restricted Symbols
//+------------------------------------------------------------------------------------+
bool boolRestrictSymbols()
{
   if( boolRestrictSymbols )
   {
      int intSymbolCount = ArraySize( strRestrictSymbols );
      if( intSymbolCount == 0 ) return( false );
      for( int i = 0; i < intSymbolCount; i++ )
      {
         if( StringFind( _Symbol, strRestrictSymbols[i] ) != EMPTY ) return( false );
         int
            intLen  = StringLen( strRestrictSymbols[i] ),
            intHalf = intLen / 2;
         string
            strLeft  = StringSubstr( strRestrictSymbols[i], 0, intHalf ),
            strRight = StringSubstr( strRestrictSymbols[i], intHalf, intLen - intHalf );
         if( ( StringFind( _Symbol, strLeft  ) != EMPTY ) && 
             ( StringFind( _Symbol, strRight ) != EMPTY )    )
            return( false );
      }
      return( true );
   }
   return( false );
}

//+------------------------------------------------------------------------------------+
// Function to Test Expiration during Tick Events
//+------------------------------------------------------------------------------------+
bool boolRestrictOnTick()
{
   if( boolRestrictExpiration )
      { if( TimeCurrent() >= dtRestrictExpiration )
         { voidRestrictAlert(); return( true ); } }
   return( false );
}

//+------------------------------------------------------------------------------------+
// Function to Alert User of Licensing Restrictions and Remove Code from Execution
//+------------------------------------------------------------------------------------+
void voidRestrictAlert()
{
   if( boolRestrictAlert )
      MessageBox( strRestrictAlertMessage, strRestrictAlertCaption, MB_ICONERROR );
   ExpertRemove();
}

//+------------------------------------------------------------------------------------+
// Initialisation Event Function
//+------------------------------------------------------------------------------------+
int OnInit()
{
   // Check Licensing Restrictions
   if( boolRestrictOnInit() ) return( INIT_FAILED );

   // ... other code ...

   return( INIT_SUCCEEDED );  // Initialisation complete
}

//+------------------------------------------------------------------------------------+
// Tick Event Function
//+------------------------------------------------------------------------------------+
void OnTick()
{
   // Check Licensing Restrictions
   if( boolRestrictOnTick() ) return;

   // ... other code ...
}

//+------------------------------------------------------------------------------------+