HELP to Import DLL in MQL5 - Unhandled exception 0xE0434352

To add comments, please log in or register

I did a DLL in order to comunicate MT5 with ENCOG using SVM, but when I run the MQL5 I get "Unhandled exception 0xE0434352"

I did a C# program in order to check the problem but C# is running perfectly with the same DLL.

The MQL5 program now it is very simple. I get "Call to Encog DLL" message and after that I get the "Unhandled exception 0xE0434352"

//|                                                   EncogFelix.mq5 |
//|                           Copyright 2011, |
//|                                     http:/ |
#property copyright "Copyright 2011,"
#property link      "http:/"
#property version   "1.00"

#import "ENCOG_MT5.dll"
   int inicio();

int OnInit()
   Print("Call to Encog DLL");
   int Estado = inicio();
   Print("Exit DLL");

The C# program also it is very simple and I get the message "Ok DLL Encog..."

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Runtime.InteropServices;

namespace ConsoleApplication_Test


class Program


  [DllImport("ENCOG_MT5.dll", EntryPoint = "inicio")]

  public static extern int inicio();

  static void Main(string[] args)


    int estado = inicio();

    if (estado == 0)

       Console.WriteLine("Ok DLL encog...");


       Console.WriteLine("Problems in DLL encog...");






Did you follow my article ?

You can send me a private message I will try to help



Using MetaTrader 5 Indicators with ENCOG Machine Learning Framework for Timeseries Prediction
  • 2011.04.25
  • investeo
This article presents connecting MetaTrader 5 to ENCOG - Advanced Neural Network and Machine Learning Framework. It contains description and implementation of a simple neural network indicator based on a standard technical indicators and an Expert Advisor based on a neural indicator. All source code, compiled binaries, DLLs and an exemplary trained network are attached to the article.

Thanks, I sent all for your help.


Thank again.




Thanks, I sent all for your help.


Thank again.




I have the same problem and could not resolve it.

I read the article and did exactly as it was described, but it could not help me.

OS - Win 7 64bit, MT 5, .Net 3.5 / 4.0, Visual studio 2010. 

Can you help me? 




I have the same Problem ,


I can import the dll successfully in my MQL 5 code , and can call a simple method that just return an integer successfully ,

but when i am trying to call the method that creates the neural network i got the following  exception

"2013.08.17 22:35:40 NeuralEncogIndicator (EURUSD,H1) Unhandled exception 0xE0434352"

what could be the reason ? and how can i trace the dll functions ??





i think I have the same problem.

This is the output:

KF    0    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)    C:\Users\*****\AppData\Roaming\MetaQuotes\Terminal\B07D12355A3C9AC10EE966FE7D0D719A\MQL5\Files\
KO    2    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)    Unhandled exception 0xE0434352
CF    2    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)                  000007FEFD7593D0 4881ECC8000000    sub        rsp, 0xc8
HH    2    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)                  000007FEFD7593D7 83E201            and        edx, 0x1
GH    2    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)                  000007FEFD7593DA 488D05EFFFFFFF    lea        rax, [rip-0x11]
GF    2    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)                  000007FEFD7593E1 894C2420          mov        [rsp+0x20], ecx
JI    2    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)                  000007FEFD7593E5 33C9              xor        ecx, ecx
IH    2    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)                  000007FEFD7593E7 4889442430        mov        [rsp+0x30], rax
RF    2    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)                  000007FEFD7593EC 89542424          mov        [rsp+0x24], edx
FG    2    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)                  000007FEFD7593F0 48894C2428        mov        [rsp+0x28], rcx
CK    2    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)                  000007FEFD7593F5 4D85C9            test       r9, r9
DE    2    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)                  000007FEFD7593F8 0F85AA180000      jnz        dword 0x7fefd75aca8
IE    2    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)   
HS    2    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)                  000007FEFD7593FE 894C2438          mov        [rsp+0x38], ecx
NL    2    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)                  000007FEFD759402 488D4C2420        lea        rcx, [rsp+0x20]
DR    2    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)                  000007FEFD759407 FF15931E0400      call       qword near [rip+0x41e93]  ; NlsUpdateLocale (kernelbase.dll)
GQ    2    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)       crash -->  000007FEFD75940D 4881C4C8000000    add        rsp, 0xc8
NR    2    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)                  000007FEFD759414 C3                ret       
CS    2    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)   
DI    2    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)                  000007FEFD759415 90                nop       
CF    2    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)   
NM    2    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)    00: 0x000007FEFD75940D
KD    2    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)    01: 0x000007FEF73C56E4
KN    2    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)    02: 0x0000000077920C51
QI    2    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)    03: 0x000007FEF7551A7A
PS    2    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)    04: 0x000007FEF7551586
FJ    2    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)    05: 0x000007FEF74FA8DB
RD    2    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)    06: 0x000007FEF7491B5A
GP    2    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)    07: 0x000007FE97E300D5
MI    2    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)    08: 0x000000001B835ED8
PO    2    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)    09: 0x0000000036927FA4

GH    2    22:43:47.892    NeuralEncogIndicator (EURUSD,M15)

I use Windows 7 Home Premium 64 Bit.

Can somebody help me, please?



I also have the same problema that last user.

What can I do to fix IT?

MT5 is now available for brazillians and I'm trying to embed encog to my trade systems.


Stanislav Korotky
Stanislav Korotky  
Are you sure that ENCOG_MT5.dll uses wchar type for those method parameters which are strings in MQL5? If it's char, the dll should be recompiled.
Are you sure that ENCOG_MT5.dll uses wchar type for those method parameters which are strings in MQL5? If it's char, the dll should be recompiled.

Function declaration on C#

      [DllExport("initializeTrainedNN", CallingConvention = CallingConvention.StdCall)]
      static int initializeTrainedNN([MarshalAs(UnmanagedType.LPWStr)]string nnPath)
          neuralnet = new NeuralNET(nnPath);

          if ( != null) return 0;
          else return -1;


Reference on MQL5

#import "EncogNNTrainDLLVS2010.dll"
   int initializeTrainedNN(string nnFile);
   int computeNNIndicator(double& ind1[],
                          double& ind2[],
                          double& ind3[],
                          double& ind4[],
                          double& ind5[],
                          double& ind6[],
                          double& ind7[],
                          int size,
                          double& result[],
                          int rates); 


somebody fix the error of neuroencog of article 252   "Unhandled exception 0xE0434352"? i have this error in one terminal, and in another i have other error that is "   Access violation at 0x00007FF938E298C5 read to 0x0000000000000000"



Anybody could help me please? in one or another or in both,  the most easy to solve.



Vladimir Belozercev
Vladimir Belozercev  

I have the same (or similar) problem with call DLL-function (my own DLL for another LIB)

Win7 64 bit

MT5, v 5.00 build 1340, 64bit


_HLOC (EURUSD,M5)       00: 0x000007FEFD509E5D
_HLOC (EURUSD,M5)       
_HLOC (EURUSD,M5)                     000007FEFD509E65 90                nop        
_HLOC (EURUSD,M5)       
_HLOC (EURUSD,M5)                     000007FEFD509E64 C3                ret        
_HLOC (EURUSD,M5)          crash -->  000007FEFD509E5D 4881C4C8000000    add        rsp, 0xc8
_HLOC (EURUSD,M5)                     000007FEFD509E57 FF1543140400      call       qword near [rip+0x41443]  ; NlsUpdateLocale (kernelbase.dll)
_HLOC (EURUSD,M5)                     000007FEFD509E52 488D4C2420        lea        rcx, [rsp+0x20]
_HLOC (EURUSD,M5)                     000007FEFD509E4E 894C2438          mov        [rsp+0x38], ecx
_HLOC (EURUSD,M5)       
_HLOC (EURUSD,M5)                     000007FEFD509E48 0F853A0A0000      jnz        dword 0x7fefd50a888
_HLOC (EURUSD,M5)                     000007FEFD509E45 4D85C9            test       r9, r9
_HLOC (EURUSD,M5)                     000007FEFD509E40 48894C2428        mov        [rsp+0x28], rcx
_HLOC (EURUSD,M5)                     000007FEFD509E3C 89542424          mov        [rsp+0x24], edx
_HLOC (EURUSD,M5)                     000007FEFD509E37 4889442430        mov        [rsp+0x30], rax
_HLOC (EURUSD,M5)                     000007FEFD509E35 33C9              xor        ecx, ecx
_HLOC (EURUSD,M5)                     000007FEFD509E31 894C2420          mov        [rsp+0x20], ecx
_HLOC (EURUSD,M5)                     000007FEFD509E2A 488D05EFFFFFFF    lea        rax, [rip-0x11]
_HLOC (EURUSD,M5)                     000007FEFD509E27 83E201            and        edx, 0x1
_HLOC (EURUSD,M5)                     000007FEFD509E20 4881ECC8000000    sub        rsp, 0xc8
_HLOC (EURUSD,M5)       Unhandled exception 0xC06D007E

I'm still looking for solution...

To add comments, please log in or register