Discussion of article "Drawing Dial Gauges Using the CCanvas Class"

 

New article Drawing Dial Gauges Using the CCanvas Class has been published:

We can find dial gauges in cars and airplanes, in industrial production and everyday life. They are used in all spheres which require quick response to behavior of a controlled value. This article describes the library of dial gauges for MetaTrader 5.

It all started when I first acquainted myself with the CCanvas class. When it came to practice, I stumbled upon an idea to draw a gauge indicator. My first gauges were pretty crude, but eventually they have been supplemented by new elements and become visually pleasing. And as a result, I have a small library now which allows to add a dial gauge to an indicator or an EA in a simple and easy manner. In this article, we will give consideration to structure of gauges, get acquainted with functions necessary for drawing and setting visual appearance, and assess resource intensity.

1. Coordinates and Anchor

There are two types of positioning a gauge on a chart: absolute and relative.

In case of absolute positioning, coordinates represent distances in pixels from an anchor corner along X and Y axis.

In case of relative positioning, local origin of coordinates is created according to the specified type of the relative positioning. When the vertical type is selected, the origin is located below or above a reference object (if an upper or a lower anchor corner is selected respectively). When the vertical type is selected, it is located on the left or on the right in the direction from the anchor corner. In this case, specified coordinates represent an offset from their local origin. Positive offsets lead to moving an object away from the reference object. In case of negative offsets, the object will encroach on the reference one.

The reference object can be represented only by an object of another gauge. It is essential that both objects will have the same anchor corner.

Fig. 2 depicts an example of relative positioning.

Relative positioning

Fig.2. Relative positioning of gauges

Author: Serhii Shevchuk

 
Awesome idea, as many people drive and are used to seeing round gauges and meters.  Gives a new way to see standard indicators in a new format if they are willing to put the work into making them look like this.
 
MetaQuotes Software Corp.:

New article Drawing Dial Gauges Using the CCanvas Class has been published:

Author: Serhii Shevchuk

JD4:
Awesome idea, as many people drive and are used to seeing round gauges and meters.  Gives a new way to see standard indicators in a new format if they are willing to put the work into making them look like this.
Well, It's very nice JD4, that you see this idea as great. Thank you for your contribution,Serhii, and for your time into my childhood fascinations.
 

great atricle,

i've been thinkin about some indicators in this format but didnt have the time to learn how to.., you made it very easy to learn..

 

Great article...

 
Fantastic

I have got more information + new ideas has been came

Thanks
 

Hi

can you create this indicator for me? (for mt5)

for display price position in daily price limit.

max daily limit and min daily limit set by user.




 
Very interesting article. It means that we can do every thing in mql5. Thanks for writer and also translator from Russian.
Reason: