What should the price glass be like? - page 13

 
Реter Konow:

1. The programme is written in two languages. The base language is MQL5, and on top of that, my markup language.

2. Distributed in the same way as sent. I mean in the right cells. It's hard to explain in words. I'll send you the code later. Of course, I had to sweat to get the data into the right cells, but this issue was resolved.

3. I will add everything that will be requested and that has sense and importance.

mql5 is good because there will be no problems with compatibility and readability of code.
And how are they sent, we don't know what type of data you took as the basis.
Stream, cast, Json.
If the tiering is done in a for loop, I'd forgo loops.
Any loops have processing time, and that's latency.
There are only about 40 price levels in the tumbler, up and down.
Therefore, for each level I would write its own variable with the desired value, eliminating the loop.

 
Roman:

mql5 is good, there will be no problems with compatibility and readability of code.
And how they are sent, we don't know what type of data you have taken as the basis.
Stream, cast, Json.
If the tiering is done in a for loop, I'd forgo loops.
Any loops have processing time, and that's latency.
There are only about 40 price levels in the tumbler, up and down.
Therefore, for each level I would write its own variable with the desired value, eliminating the loop.

Look at the code on the previous page.

I centralise the incoming data relative to the centre cell of the cup. The closest price to the ask is put in the cell in the centre and then upwards the rest of the prices in ascending order. The same for bid prices and their bids.

 
Roman:

mql5 is good, there will be no problems with compatibility and readability of the code.
And how they are mapped, we don't know what type of data you have.
Stream, cast, Json.
If the tiering is done in a for loop, I'd forgo loops.
Any loops have processing time, and that's latency.
There are only about 40 price levels in the tumbler, up and down.
Therefore, for each level I would write its own variable with the desired value, eliminating the loop.

I don't know how to solve the problem of distributing incoming data without a cycle. Can you give me a hint?

Sometimes there are more than 40 price levels coming in. Some of them don't fit in the cup. So, I made a receiver array of 100 cells. It's impossible to display everything in the picker, but it can be requested from the engine.

 
Roman:

...
For this reason I would prescribe for each level a variable with the necessary value, excluding the cycle.

The data comes in an array in order from the highest price to the lowest. There is no limit to the amount of data. There may be 60 prices with bids, 30 for each side, or there may be 30 prices, all with prices higher than the ask or lower than the bid. So, without a cycle there is no way to solve the problem.

 
Реter Konow:

The data comes in an array in order from the highest price to the lowest. There is no limit to the amount of data. There may be 60 prices with bids, 30 for each side, or there may be 30 prices, all with prices higher than the ask or lower than the bid. So, it is not possible to solve the problem without a cycle.

If indexing of incoming elements in the array is not broken, we can take each element from the array without the loop and assign it to our variable.
And already assign each variable containing the value to its own cell level.
Or, you can assign each element of the array to a level at once.
Then we exclude variables as well, but uninitialized data is not a good coding practice.

 

Another idea came up.
To divide the received array into two arrays Bid and Ask
And think how to use the CopyArray() function.

After implementing both methods, we can measure the speed of processing.
And which one will give the best result, and leave it.
 
Roman:

If indexing of incoming elements in the array is not broken, we can take each element from the array without the loop and assign it into our variable.
And already every variable containing the value is assigned to the cell level.
Or, you can assign each element of the array to a level at once.
Then we exclude variables as well, but uninitialized data is not a good coding practice.

Alas, there are no ordered prices in the array and its indexing does not point to specific cells in the tumbler. The data comes from a higher price to a lower price, but that is where the order ends. There may be one point between the prices, or it may be 10 or 153. The slider shows the last changed order volumes in the whole range on which they are located. If a price over 150 pips from the asc has changed the number of limit orders, it will appear in the array. Therefore, there is no order in the array other than from larger to smaller and the data can't be rearranged otherwise than in a loop.

 
Реter Konow:

Alas, there is no indexing in the array. The data comes from a higher price to a lower one, but that is where the order ends. There may be one point between prices, or there may be 10 or 153. The stack shows the last changed order volumes for the whole range on which they are located. If a price over 150 pips from the asc has changed the number of limit orders, it will appear in the array. Therefore, there is no order in the array other than from more to less, and the data cannot be ordered other than in a loop.

There is indexing by array elements in the receiving array.
The data comes from higher to lower price, they are always sequentially ordered, aren't they?
So, choose any necessary element from the array by index, but without the loop.
And if it's impossible to catch better Bid/Ask because of changing size of incoming data,
then maybe we should think about CopyArray()

 
Roman:

There is indexing by array elements in the receiving array.
The data comes from a higher price to a lower one, they are always ordered sequentially, aren't they?
So select any desired element from the receiving array by index, but without the loop.

Arranged sequentially. But:

  1. More data can come in than there are cup cells.
  2. There is no clear order between the prices. There may be one price above the ask and 7 prices below the bid.
  3. There may be uneven spacing between prices. There may be 1 point between the first and second, and 18 points or 1008 points between the second and third.
That's why you won't know which price is the closest to the Ask and which is the nearest to the Bid, so you will not know which price should be in the middle of the pack without doing the cycle.
 
Реter Konow:

Arranged sequentially. But:

  1. More data can come in than there are cup cells.
  2. There is no clear order between the prices. There may be one price above the ask and 7 prices below the bid.
  3. There may be uneven spacing between prices. There may be 1 point between the first and second, and 18 points or 1008 points between the second and third.
Therefore, without doing a cycle, it is impossible to know which price is closest to the ask and which to the bid and therefore which price should be in the centre of the cup.

Where do you get such crooked data from? ))

1) Define a clear range of selecting data, for example 20 up, 20 down.
and select only this range, and anything else is not important to us.

2. You say that prices come from higher to lower and they are ordered in descending order.
So what may come higher or lower, it does not matter, look not at the prices but at the indexes in the array.

2. If you mean order by distance between price levels, it doesn't matter at all, we have indexing in the receiving array.

Reason: