Different library search path for tester?

 

Hi!

I'm having problems with loading external dll when running EA under tester.

When attached to a chart the expert is loading the library from %APPDATA%/MetaQuotes/Terminal/0DE...0/MQL5/Libraries/ (the library is linked against another library that is located in Windows\system32\) without any problems and the EA works.

When run under tester I got Cannot open (126) error.

Is there a different library search path or binding used under tester?

Observed under: MetaTrader build 344 x64 version.

 
emsi:

Hi!

I'm having problems with loading external dll when running EA under tester.

When attached to a chart the expert is loading the library from %APPDATA%/MetaQuotes/Terminal/0DE...0/MQL5/Libraries/ (the library is linked against another library that is located in Windows\system32\) without any problems and the EA works.

When run under tester I got Cannot open (126) error.

Is there a different library search path or binding used under tester?

Observed under: MetaTrader build 344 x64 version.


It would better if you attached all sourses.

I tried to run this expert (placed in Experts folder)

//+------------------------------------------------------------------+
//|                                                       TmpExp.mq5 |
//|                        Copyright 2010, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2010, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"
#import "tmp.ex5"
int GetData(void);
#import 
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnInit()
  {

  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnTick()
  {
   Print(tmp::GetData());
  }
//+------------------------------------------------------------------+

with this library (placed in Libraries folder)

//+------------------------------------------------------------------+
//|                                                          tmp.mq5 |
//|                        Copyright 2010, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property library
#property copyright "Copyright 2010, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"
#import "kernel32.dll"
int GetLastError(void);
#import 
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int GetData() export
  {
   return(kernel32::GetLastError());
  }
//+------------------------------------------------------------------+

It worked in tester fine.

 

Thank you for your response.

The expert I'm experiencing the issue with is very simple:


//+------------------------------------------------------------------+
//|                                                         Test.mq5 |
//|                                                 Mariusz Woloszyn |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Mariusz Woloszyn"
#property link      ""
#property version   "1.00"
#include <Fann2MQL.mqh>
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   f2M_parallel_init();
//---
   return(0);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   f2M_parallel_deinit();
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   
  }
//+------------------------------------------------------------------+


It is using Fann2MQL package from http://fann2mql.wordpress.com/download/ (actually the 64 bit: Fann2MQL 0.1.4_x64-beta2.msi). You have to install it into MetaTrader's  'Data Folder'\MQL5\ (it will put Fann2MQL.dll into its Library subfolder and Fann2MQL.mqh into includes as well as fanndoubleMT.dll into system32 folder.

On the chart  it reports:

2010.10.19 13:41:25    Experts    expert Test (USDCHF,H4) loaded successfully

While in tester I got:

2010.10.19 13:36:55    Core 1    2010.01.01 00:00:00   Cannot open 'Fann2MQL.dll' (126)

I'm pretty sure the problem is with loading fanndoubleMT.dll and not the Fann2MQL.dll itself.

Download
  • fann2mql.wordpress.com
Installation packages (containing source code) Stable version: Built with TBB 3.0 and Fann 2.2: 32 bit: Fann2MQL 0.1.5.msi 64 bit (can be used with 64bit version of MetaTrader 5 only!): Fann2MQL 0....
 

Add this line in your EA code. It should solve your problem.

#property tester_library "Fann2MQL.dll"

https://www.mql5.com/en/docs/basis/preprosessor/compilation

Documentation on MQL5: Language Basics / Preprocessor / Program Properties (#property)
  • www.mql5.com
Language Basics / Preprocessor / Program Properties (#property) - Documentation on MQL5
 

Thank you, it solved the problem.

However I do not understand the purpose of this property. The documentation says: "Libraries that require testing are defined automatically. However, if any of libraries is used by a custom indicator, this property is required" but there is no custom indicator in this case.

 
emsi:
The documentation says: "Libraries that require testing are defined automatically. However, if any of libraries is used by a custom indicator, this property is required" but there is no custom indicator in this case.

Yes, you are right.

We've been working on it.

 
emsi:

Thank you, it solved the problem.

However I do not understand the purpose of this property. The documentation says: "Libraries that require testing are defined automatically. However, if any of libraries is used by a custom indicator, this property is required" but there is no custom indicator in this case.

hi emsi, it work on Strategy Tester (build 344 Windows 7 x32) but very slow when re-train new pattern. I also try run on Windows 7 x64 MT5 Build 346 but disconnected by message " DLL loading is not allowed"
 
haidzatul:
hi emsi, it work on Strategy Tester (build 344 Windows 7 x32) but very slow when re-train new pattern.

We are working to make testing in much faster then now.

I also try run on Windows 7 x64 MT5 Build 346 but disconnected by message " DLL loading is not allowed"

You should allow loading DLLs in client terminal

Reason: