Websocket how? - page 14

 
Алексей Барбашин:

Fedor, you're going the wrong way. It doesn't work like that! You have cleanly used the code Volodja gave you. Your task is to get the data from the websocket and pass the ask and bid to mql! While we only returned bid from received data to mql, your task is to return the whole structure to mql and output the information to the log.

Ok. I'm going to try to redo it now.
 
Алексей Барбашин:

Yes, it doesn't. But this problem can be solved. At last stage, when the code is debugged, we just need to implement DLLExport in Sharp's library and everything will work with mt4.

it won't, I've already tested it.

either C++/CLI

or Unmanaged Exports by Robert Giesecke - about the article I'm writing

ZS: maybe with DLLExport will work simple methods return a + b; no more, everything that requires initialization .Net does not work, though.... would be glad to learn something new.

ZZZY: foundhttps://github.com/3F/DllExport , did not use, found something else, but it is the same chip

Please note again, the UnmanagedExports was created by Robert Giesecke. You need visit his page.

But this repository does not related to Robert and generally still being developed by GitHub/3F developer

 

For some reason it returns zeros.


 
Igor Makanu:

it won't, I've already checked

or C++/CLI

or Unmanaged Exports by Robert Giesecke - about the article I'm writing

ZS: maybe with DLLExport will work simple methods return a + b; , nothing more, everything that requires initialization .Net does not work though.... would be happy to give an example, always happy to learn something new


worked.
You need to make the correct changes to the IL code.

I made my own exe, which makes changes after VS compilation.
And then C# methods become visible from C/MQL

plus marshalling.
Haven't used that in a while.

 
Vladimir Suslov:


it worked.
You need to make the right changes to the IL code.

I made my own exe that makes changes after VS compiles.
And then C# methods become visible from C/MQL

Haven't used this in a while

I just updated my post above.

this is the same code I use - code from Robert Giesecke

but you don't have to fix anything manually there, the main problem is dealing with complex data types, I just recently did a data exchange, scratched out a method

  [DllExport("redismtset", CallingConvention = CallingConvention.StdCall)]
        public static void redismtset([MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] byte[] value, int sz, [MarshalAs(UnmanagedType.LPWStr)]string key)
        {
            byte[] tmp = new byte[sz];
            Array.Copy(value, 0, tmp,0, sz);
            if (dbExcPing()) DB.Set(key, tmp);
        }
//----
 [DllExport("redismtget", CallingConvention = CallingConvention.StdCall)]
        public static int redismtget([MarshalAs(UnmanagedType.LPWStr)]string key)
        {
           if (dbExcPing()) db_buffer_byte = DB.Get(key); else db_buffer_byte = null;
            return db_buffer_byte?.Length?? - 1;
        }
I tried to process an array of strings through StringBuilder, it works very unstable and I gave up because it requires constant control of memory allocation for string buffer in both MQL4 and .Net - in general the constant search for when something stops working )))
 
Алексей Барбашин:

When I used that method, I needed to implement DllExport once and then all methods could be declared as exported. This library itself made the necessary changes to the code. But since MT5 began to support Sharp, I stopped "messing around" with it.

I think the question was about MT4?

 
Алексей Барбашин:

That's no big deal. The Dequeue() method takes a record from the queue. You're trying to take two records and different parameters from each of them. Well, first of all, no one guarantees that there will be two records in the queue at the moment of access).

Reworked it this way.

MQL


Doesn't return anything at all now, because I added a check

 
Igor Makanu:

I just updated my post above.

It's the same code I use - code from Robert Giesecke

but there's nothing to hand-correct, the main problem is dealing with complex data types, I just recently did a data exchange, scratched out a method

I didn't have this one working (a few years ago), so I made my own.
It may have been updated now and it works.
But the principle is exactly the same

 
Vladimir Suslov:

This lib didn't work for me (a few years ago) and I made my own.
I may have updated it now and it works.
But the principle is exactly the same

it does not work on russian language Win

But it will definitely work without problems if you install a virtual machine + Win 7 in English - I chose during the installation Win language, tried different ways to install Win7 in Russian switch to English. - Somewhere either in the registry or a folder remains Russian, because of this, the template Robert Giesecke compiled with warnings and will not work export .dll

SZZY: saved an image of the virtual machine 10GB on my hard drive, now without problems I can use the templateRobert Giesecke

 
guys, why do I get zeros back? And the queue is empty?
Reason: