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

Moderator
182534
2015.07.21 12:34

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.

Fig.2. Relative positioning of gauges

Author: Serhii Shevchuk

1101
2015.07.21 20:46
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.
3342
2015.07.26 12:02
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.
1717
2015.08.03 18:01

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..

225
2015.09.03 04:58

Great article...

27296
2015.09.14 20:37
Fantastic

Thanks
5
2017.01.02 11:38

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.

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