Websocket how? - page 20

 
Fedor Arkhipov:

I tried to apply the library to MT4, EA file compiles without errors,

But when i attach it to chart i get error "Global initialization failed" if i use method that returns simple type.

If I try to get a structure, I get "Invalid ex4 file (8)

Maybe it would work if you throw out all the structures.

or we have to fiddle with IL or com ports

I would recommend taking your time. First it's worth bringing everything up to speed, debug it on MT5, then transfer it to MT4, it won't take more than 5 minutes.

Connection to the socket is only the beginning. We also need to decode the response, as the server sends everything in archived form. Also, we need to create a mechanism of ping-pong, which the server plays. That is, at regular intervals server sends ping to clients and if the client does not respond within certain time pong, then server disconnects the client.

We need to implement methods to receive quotes history and subscribe for ticks in online mode.

As soon as we will be able to manage it all from MT5, then we will switch the library to MT4.

There is a request for the same quotes broadcasting for Binance exchange

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

There is a request for the same quote broadcast for the Binance exchange

Yes, but there it is necessary to form a request according to houbi

Maxim did it

json: { "sub": "market.btcusdt.kline.1min", "id": "1122" }

 
Fedor Arkhipov:

Yes, but you have to form a query on the "muzilla" houbi

here's what Maxim did

json: { "sub": "market.btcusdt.kline.1min", "id": "1122" }

So? Didn't understand the difficulty.

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

So? I didn't understand the difficulty.

I don't think there is any complexity, you need to look at the structure of the query, I'm looking for
 

this Candle Time is the id in seconds from 1 January 1970. i.e. as in Metatrader


 

Fedor, I suggest you think again about the structure and possibilities of our library.

What is our ultimate goal?

 
Fedor Arkhipov:

this candlestick time is the id in seconds from january 1, 1970. i.e. as in metatrader


Not really. Count the number of digits in the ts field and you will see that it is not the number of seconds as in MT, it is the number of ticks, i.e. 1000 times more.

 
Fedor Arkhipov:

here it is, only I haven't figured out how to get a candle in time


no way :-) the specific candlestick is in rest api

or you need to remember all/some of the previous candlesticks in the interval.

Understand correctly - WebSocket and threads through it, it's the data coming in quickly. You can't go any faster than that. That's what makes it valuable

When digging is needed, Rest is accessed separately, but there are limits on the rate of requests (response volume)

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

Fedor, I suggest you think again about the structure and possibilities of our library.

What is our ultimate goal?

In general, I would like to transfer the price history and the tick price. But it would be good to get one candle now, I think I can do a request for old prices in the loop later.
 
Maxim Kuznetsov:

but you can't :-) the specific candlestick is in the rest api


So there is no way to request old candlesticks via websocket?

only ticks?