DirectX - page 7

 
Aleksey Vyazmikin:

Cute. What about CPU load when opening an exchange, you know, on Si if you put the market?

Is there a graphical display of open position in the market? This is what I miss in the standard one.

In the previous one the open position is shown with magenta frame around the price with position in red, in the next one it is position in surplus.


 

all on one Canvas

 
Rafil Nurmukhametov:

The processor loads well, in the previous picture you can see the open position, the frame around the price is magenta colour, there position is in minus, in the picture below position is in plus


How about simply limiting the refresh rate - not more than 10 updates per second? The lags will lead to a trading panel frizz, no?

I can see the position state indication - it looks convenient!

 
Aleksey Vyazmikin:

How about simply limiting the refresh rate to no more than 10 times per second? Braking will cause the trading panel to freeze - no?

...

I don't know how Rafil's implementation is exactly, but if cells are redrawn separately from the whole kanvas, it would solve the load problem.

To do this:

1. Each cell should be an independent rectangular label with text on top, with its own coordinates and dimensions in the array.

2. On a value change event, its rectangle (background) is redrawn first, and then the text. The redrawing area is tens of times smaller than the area of the entire canvas, and therefore the load will drop by tens of percent.

 
Реter Konow:

I don't know exactly how Rafil's implementation works, but if the cells are redrawn separately from the whole canvas, this will solve the load problem.

To do this:

1. Each cell should be an independent rectangular label with text on top, with its own coordinates and dimensions in the array.

2. On a value change event, its rectangle (background) is redrawn first, and then the text. The repaint area is tens of times smaller than the area of the entire canvas, and therefore the load drops by tens of percent.

The essence of the glass is that when the price moves, it has to be redrawn as a whole, but the left part of the visualization - yes, there may be options, but I think there is a cluster object (candles?) drawn separately and it is redrawn only when new information comes.

 
Aleksey Vyazmikin:

The essence of the glass is that it has to be redrawn in its entirety when prices move, but the left part of the visualisation - yes, there may be options, but I think there is a separate cluster object (candle?) drawn and it is redrawn only when new information comes in.

Not necessarily. Prices in the market are not changing all at once and some cells periodically stand idle. There is no sense in redrawing the whole canvas.

The same applies to the left part. Although, there is no heavy load there anyway. If only on the chart scrolling and on the current bar. But it is not much.

 
Реter Konow:

Not necessarily at all. Prices don't change all at once and some cells are occasionally idle. There is no sense in redrawing the whole canvas.

It is not necessary, but the price moves and consequently the value in the cells changes - how else? Another thing is if you change coordinates of rectangle with price, but I think it is the same drawing within the kanvas.

 
Aleksey Vyazmikin:

Not necessarily, but the price moves, which means that the value in the cells changes - how else? Another thing is if you change the coordinates of the rectangle with the price, but I think this is also a drawing within the canvas.

The price moves, the glass is centralised and redrawing is required. No one is disputing that. It's about the area of the redraw.

Many cells are idle and do not change value at every cup event. For example - sometimes limit values change only in a few cells, while price and volumes in other cells remain unchanged. In this case, it is a waste of resources to redraw the entire canvas. It is necessary to control the changes in the cells and draw them individually on the event of a new value arrival.

This simple approach will reduce the load many times over.

Also, you can reduce the frequency of outputting values to cells.

Документация по MQL5: Константы, перечисления и структуры / Торговые константы / Виды заявок в стакане цен
Документация по MQL5: Константы, перечисления и структуры / Торговые константы / Виды заявок в стакане цен
  • www.mql5.com
Для биржевых инструментов доступно окно "Стакан цен", в котором можно посмотреть текущие заявки на покупку и продажу. Для каждой заявки указано желаемое направление торговой операции, требуемый объем и запрашиваемая цена. Для получения информации...
 
Реter Konow:

The price moves, the glass is centralised and a redraw is required. No one is arguing that. It's about the area of the redraw.

Many cells are idle and do not change value at every cup event. For example - sometimes limit values change only in a few cells, while price and volumes in other cells remain unchanged. In this case, it is a waste of resources to redraw the entire canvas. It is necessary to control the changes in the cells and draw them individually on the event of a new value arrival.

This simple approach will reduce the load many times over.

Also, you can reduce the frequency of outputting values to cells.

Yes I understand your idea, but price and volume change information can often (assumption) come in sync at market opening.

I remember you wanted to do your own cup - any result?

 
Aleksey Vyazmikin:

Yes I understand your idea, but information about price and volume changes can often come in sync at the opening of the market.

I remember you wanted to make your own market cup - any results?

Yesterday I made an example of the market glass with redrawing cells independently of the canvas of the whole window- https://www.mql5.com/ru/forum/333652/page4.

I have found that a separate redrawing of cells keeps the load within 20% (the video shows more because of video recording), ALWAYS if ALL cells are redrawn at 40 fps. Normal tumbler dynamics with this approach will load 5-10% roughly.

The load is high only if redrawing large area (~500*500 px) at high frequency without pauses (~40+ fps). Any delays or reduction of the redrawing area reduces the load by a factor of two.

DirectX
DirectX
  • 2020.03.13
  • www.mql5.com
Привет, кто-нибудь уже разобрался с directx, там есть DirectCompute...