Indicators: Next price predictor using Neural Network - page 6

 
this is the worst neural network i ever have seen, it seems working randomly.... same code gives many results at same period???
[Deleted]  

The following was posted in the wrong section and removed by me. I am replicating it here as a "pocket" for the user in question, namely Earthy Stag beetle.

Forum on trading, automated trading systems and testing trading strategies

Deleted topic "Next Price Neural Predictor & DLL trauma..."

Earthy Stag beetle, 2025.10.16 14:55

Hello All,

I have an interest in ML and found Next Price Neural Predictor, thanks & respect to Vladimir for this, I was going to use it as a working learning framework. gpwr released copyrighted source - I am very grateful. The indicator makes use of a dll with which I have little experience - however, I downloaded Visual Studio 2022 Community and rolled up my sleeves.

What could go wrong? 😂

I tried using the original compiled BPNN.dll first, but MT5 complained that it was a 32 bit dll, so I had to rebuild it to operate in today's MT5. I made a few changes to BPNN source, and rebuilt the DLL. Ace!

So I made a stab at porting the indicator to MQL5 - again something with which I am not familiar, but that went OK.

Next step was to try & run the MT5 indicator port, where i received the following error:

2025.10.16 15:19:36.501    cannot find 'string BPNN64::Train(double&[],double&[],double&[],int,int,double&[],double&[],int,int&[],int,int,int,double)' in module 'BPNN64.dll'

OK, so the indicator was not able to find the functions in the DLL.

So I added some simpler functions to BPNN64 which also return strings, but do nothing useful to see f they would be resolved. Here they are:

#define STATUS_BUF_SZ 80
MT5_EXPFUNC wchar_t* __stdcall GetStringValue(wchar_t *spar)

{
        static wchar_t status[STATUS_BUF_SZ];

        swprintf_s(status, STATUS_BUF_SZ, L"%s %s", spar, (wchar_t*)L" it ...");

        return(status);

}
MT5_EXPFUNC int __stdcall SetIntArrayValValue(const int *constLSz, const int constLSzSize,  int *lSz, const int lSzSize, int val)

{
        if (lSzSize < 1)
                return -1;
        lSz[0] = val;
        return(lSz[0]);

}

And both these functions worked, by now I had knocked up a simple script which looks like this:

//+------------------------------------------------------------------+
//|                                                            dll_test.mq5 |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Tests dll import                                                        |
//+------------------------------------------------------------------+
#property script_show_inputs

input string in_string ="Hello world"; // String to add
input int in_int       =10;            // int to return

#import "BPNN64.dll"
string GetStringValue(string);
int SetIntArrayValValue(const int &constlSz[], const int constlSzSize, int &lSz[], const int lSzSize, int val);
#import

void OnStart()
{
   string s = in_string;
   string sret;
   int lSz[80];
   
   lSz[0] = in_int;
   int int_ret;

   //--- simple dll-functions call
   sret=GetStringValue(s);
   printf("%s[%d], %s: Orig string=%s, after GetStringValue=%s",
      __FILE__, __LINE__, __FUNCTION__, s, sret);

   int_ret = SetIntArrayValValue(constlSz, (const int)sizeof(constlSz), lSz, sizeof(lSz)/sizeof(lSz[0]), in_int);
   printf("%s[%d], %s: input int=%d, after SetIntArrayValValue=%d, sizeoflSz[]=%d",
      __FILE__, __LINE__, __FUNCTION__, in_int, int_ret, sizeof(lSz)/sizeof(lSz[0]));

}
//+------------------------------------------------------------------+

It worked! But that it worked puzzled me. I wrote a new dll containing just function calls of the form used in BPNN, called ParamsTest.

I wrote a new script to try and work out what is going on, and this is the debug I receive:

2025.10.16 15:42:42.585 dll_simple_import_test.mq5[48], OnStart: Orig string=Hello world, after GetStringValue=Hello world  it ...
2025.10.16 15:42:42.585 dll_simple_import_test.mq5[52], OnStart: input int=10, after SetIntArrayValValue=10, sizeoflSz[]=80
2025.10.16 15:42:42.585 dll_simple_import_test.mq5[54], OnStart: Executed Param1 successfully
2025.10.16 15:42:42.585 dll_simple_import_test.mq5[56], OnStart: Executed Params2 successfully
2025.10.16 15:42:42.585 dll_simple_import_test.mq5[58], OnStart: Executed Params3 successfully
2025.10.16 15:42:42.585 dll_simple_import_test.mq5[60], OnStart: Executed Params4 successfully
2025.10.16 15:42:42.585 dll_simple_import_test.mq5[62], OnStart: Executed Params5 successfully
2025.10.16 15:42:42.585 dll_simple_import_test.mq5[64], OnStart: Executed Params6 successfully
2025.10.16 15:42:42.585 cannot find 'string ParamsTestDll::Params7(const double&[],const double&[],double&[],int,int,const double&[],double&[])' in module 'ParamsTestDll.dll'
2025.10.16 15:42:42.585 unresolved import function call in 'dll_simple_import_test.mq5' (1,1)

I can't move any further until I understand why this is bombs out. So the following works OK:

string Params6(const double& dblArray1[],const double& dblArray2[],double& dblArray3[],int int1,int int2,const double& dblArray4[]);

But this doesn't:

string Params7(const double& dblArray1[],const double& dblArray2[],double& dblArray3[],int int1,int int2,const double& dblArray4[],double& dblArray5[]);

From the DLL:

MT5_EXPFUNC wchar_t* __stdcall Params6(
        const double* dblArray1,
        const double* dblArray2,
        double* dblArray3,
        int     int1,
        int     int2,
        const double* dblArray4)
{
        return((wchar_t*)L"Params6");
}
MT5_EXPFUNC wchar_t* __stdcall Params7(
        const double* dblArray1,
        const double* dblArray2,
        double* dblArray3,
        int     int1,
        int     int2,
        const double* dblArray4,
        double* dblArray5)
{
        return((wchar_t*)L"Params7");
}

I would be very grateful for soeone's insight please. I'm formally stuck.

Source is attached,

 
Earthy Stag beetle:

Hello All,

I have an interest in ML and found Next Price Neural Predictor, thanks & respect to Vladimir for this, I was going to use it as a working learning framework. gpwr released copyrighted source - I am very grateful. The indicator makes use of a dll with which I have little experience - however, I downloaded Visual Studio 2022 Community and rolled up my sleeves.

What could go wrong? 😂

I tried using the original compiled BPNN.dll first, but MT5 complained that it was a 32 bit dll, so I had to rebuild it to operate in today's MT5. I made a few changes to BPNN source, and rebuilt the DLL. Ace!

So I made a stab at porting the indicator to MQL5 - again something with which I am not familiar, but that went OK.

Next step was to try & run the MT5 indicator port, where i received the following error:

OK, so the indicator was not able to find the functions in the DLL.

So I added some simpler functions to BPNN64 which also return strings, but do nothing useful to see f they would be resolved. Here they are:

And both these functions worked, by now I had knocked up a simple script which looks like this:

It worked! But that it worked puzzled me. I wrote a new dll containing just function calls of the form used in BPNN, called ParamsTest.

I wrote a new script to try and work out what is going on, and this is the debug I receive:

I can't move any further until I understand why this is bombs out. So the following works OK:

But this doesn't:

From the DLL:

I would be very grateful for soeone's insight please. I'm formally stuck.

Source is attached,

Code Base

BPNN MQL Predictor Demo with library

Stanislav Korotky, 2019.12.18 16:24

This is a demo indicator with BPNN neural network library ported from C++ to MQL.
 
Ryan L Johnson #:

Thank you Ryan! I missed this, will have a try.

With my best regards, ESB.

 
Earthy Stag beetle #:

Thank you Ryan! I missed this, will have a try.

With my best regards, ESB.

You're welcome, ESB.

Things can be tough to find. I started out at mql4.com in 2011, and I migrated over to mql5.com in 2015. When I need something here, I do a web browser search for "mql5" and the name or subject of the thing. It's quite reliable.