Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1100

 
Andrey Sokolov:

Can you please tell me how horizontal levels are calculated for the grid in mt4 and in mt5? If the scale is not fixed, they shift when you scroll the chart, and they shift inmt4 and in mt5 a bit differently. Maybe somebody knows how it is calculated, not to guess with indentations, bindings and other stuff.

If you do not know anything, you may try to determine them programmatically; it seems that there is a function for working with chart that returns the pixel colour; if so, you should find several horizontal pixels of the required colour and calculate the chart grid and so on all lines

then you will only need to keep track of the scrolling chart event

it is easier to remove the chart grid and draw your own one - in the past they drew it using circular levels, I think Prival put such an indicator in bio.


Seric29:

I think Prival has posted such an indicator in KB. The functions should be virtual - simple ones are impossible.

Virtual means their new implementation can be in the descendants , in my example in the base class calc()=0; - this is on purpose, so the compiler warns when inheriting that there is no implementation of this function, you can write the implementation in the base class, and then add the keyword overload in the descendants .... All in all, these are all subtleties, write tests, figure it out, maybe this will help)))

 
Andrey Sokolov:

https://photos.app.goo.gl/exifpepDF3hN2yxn7

It's not changing for me!

 
Igor Makanu:

but you can try to define them programmatically, I think there was a function for working with the chart which returned a pixel colour, if so, find a few horizontal pixels of the desired colour and consider it a chart grid, and so on all lines

then you will only need to track the scrolling chart event

i.e., if you do not know what you will get from the aesthetic side - it is easier to remove the chart grid and draw your own one - this is how they used to draw the circular levels, I think Prival showed such an indicator in bio.

I am making a "snake" game with crawling background. The idea is that the user could play without minimizing the chart he is following. I would like it to move exactly on the existing grid.

The "programmatically define" - only the colour of the grid has been found so far. I have found only the color of the grid. In general, please advise how to determine the levels of the grid if you know how.

 
Andrey Sokolov:

I would like it to move along the existing grid.

Draw a transparent canvas over the whole chart and draw your grid on it, it will be very believable, even bars will be visible under the canvas and the mice will be scrolling

Do you want to stick to small squares in the chart grid? That would be unreliable in my opinion because the grid may jump during scrolling, no? - What will you do?

levels chart grid I do not know how to determine - in my opinion not a standard and wasteful in resources task, although I could be wrong - I never thought of such a thing

 
Andrey Sokolov:

I can also find points where it doesn't change, but it's better to take questions as they are, so as not to litter the forum with vludes.

I wasn't looking for anything... I'm on all fumes like that. And about "littering the forum with vlood" start with yourself.
 
Igor Makanu:

"the grid can jump when scrolling, can't it? - what will you do? " - if the number of squares changes, the game will restart. If it doesn't, only the layout will be recalculated.

"draw ..." - I wanted not to interfere with what the user has on the chart.

"I think it's not standard and waste resources task, although I could be wrong" - most likely, there's min and max visible, and it's divided by 30-something pixels with rounding and pegging to levels, the question is how, because they can even be slightly different in height.

 
How do I know whether an order was closed by hand or by a robot?
 

Can MQL4/MQL5 stretch a BMP image to full screen?

 
Yevhenii Levchenko:
How do I know who closed the order, hand or robot?

Probably by the magazine.

 
Andrey Sokolov:

Possibly by the logbook.

Screenshot please, never seen a mark in the logbook as the closure/deletion happened