Discussion of article "Manual charting and trading toolkit (Part III). Optimization and new tools"

 

New article Manual charting and trading toolkit (Part III). Optimization and new tools has been published:

In this article, we will further develop the idea of drawing graphical objects on charts using keyboard shortcuts. New tools have been added to the library, including a straight line plotted through arbitrary vertices, and a set of rectangles that enable the evaluation of the reversal time and level. Also, the article shows the possibility to optimize code for improved performance. The implementation example has been rewritten, allowing the use of Shortcuts alongside other trading programs. Required code knowledge level: slightly higher than a beginner.

The first feature is related to the line shift effect on smaller timeframes. If you draw lines in a usual way, then something like this will appear when you switch between timeframes:

D1 line ends H4 line ends

The left edge of the line which exactly coincides with an extremum at D1 is shifted to the left at H4 and thus it does not coincide with the extremum. This is an obvious effect because the extremum of a day does not have to fall on the day beginning. If you need higher accuracy, when drawing manually, you can plot the line approximately and then switch to lower timeframes in order to adjust the edges.

This solution can be utilized if you have one or two charts. What if you have 20 of them? Or even 100? This can be annoying.

Since the program has an automated drawing function, we can entrust this chore to the program when drawing every object.

Author: Oleh Fedorov

 

There are some problems can be for compiling English version. In file "Utilites.mqh" translator change space symbol by something else.

So, if you see error "Declaration without type" due compilation, make double click on string with this message - IDE will opening this string in editor. Then you need for select ONE wrong symbol (as usual it will be between main code and comments) and press Ctrl+H or select Search -> Replace in main menu.

In the top line (Search) IDE will insert "wrong" symbol, and in bottom line (replace) you will need to insert simple space. Then press "Replace all" button...

Well, last operation will be Compile (Ctrl+F7).

How to fix errors ""

And I will try to send right file to moderator as soon as possible.

 

Hi. Great tool you have created. I am also a manual and was looking for such a one.

But I usually have several windows (timeframes) of one tool open on several monitors.

Is there any possibility for MQL to make these
drawn objects appear on all open windows of a tool? For example, as it is done in Tigertrade and other platforms.

For example, you have drawn at 5m, and the same level appears in the window with 1m.

I am surprised that there are no such tools in MQL


Thank you very much

 
okskreen61 #:

Hi. Great tool you have created. I'm also a tiller and was looking for one of these.

But I usually have several windows (timeframes) of one tool open on several monitors.

Is there any possibility for MQL to make these
drawn objects appear on all open windows of a tool? For example, as it is done in Tigertrade and other platforms.

For example, I drew a level at 5m, and the same level appears in the window with 1m.

It is surprising that there are no such tools in MQL


Thank you very much.

The simplest way is to make a template. Besides, I saw something similar somewhere in kodobase (either in the form of an indicator or a script)...
 

The file "Utilites.mqh" has 101 errors, of which the following are errors:

'New_Bar_First_Start' - declaration without type Utilites.mqh 80 5

'mode' - comma expected Utilites.mqh 80 25

'New_Bar_First_Start' - declaration without type Utilites.mqh 1491 26

'mode' - comma expected Utilites.mqh 1491 46

'mode' - undeclared identifier Utilites.mqh 1511 18

'Is_Select_On_Create' - undeclared identifier Graphics.mqh 307 45

'Print_Warning_Messages' - undeclared identifier Graphics.mqh 249 8

'Print_Warning_Messages' - undeclared identifier Graphics.mqh 361 8

'CMouse' is not a class, struct or union Graphics.mqh 940 26

'Bar' - undeclared identifier Graphics.mqh 940 34

'Bar' - some operator expected Graphics.mqh 940 34

'(' - semicolon expected Graphics.mqh 940 37

')' - expression expected Graphics.mqh 940 38

'allPrefixes' - undeclared identifier Graphics.mqh 944 37

'[' - array required Graphics.mqh 944 48

'CMouse' is not a class, struct or union Graphics.mqh 959 6

'Below' - undeclared identifier Graphics.mqh 959 14

'Below' - some operator expected Graphics.mqh 959 14

'(' - unbalanced left parenthesis Graphics.mqh 959 5

')' - expression expected Graphics.mqh 959 20

')' - unexpected token Graphics.mqh 959 21

illegal 'else' without matching 'if' Graphics.mqh 968 3

variable 'tmp_price' not used Graphics.mqh 950 3

variable 'tmp_time' not used Graphics.mqh 954 3

'Simple_Vertical_Style' - undeclared identifier Graphics.mqh 420 26

'Simple_Vertical_Width' - undeclared identifier Graphics.mqh 422 26

'Simple_Horizontal_Style' - undeclared identifier Graphics.mqh 430 28

'Simple_Horizontal_Width' - undeclared identifier Graphics.mqh 432 28

'CMouse' is not a class, struct or union Graphics.mqh 434 14

'Window' - undeclared identifier Graphics.mqh 434 22

'Window' - some operator expected Graphics.mqh 434 22

')' - unexpected token Graphics.mqh 434 29

'Print_Warning_Messages' - undeclared identifier Graphics.mqh 439 10

'DEBUG_MESSAGE_PREFIX' - undeclared identifier Graphics.mqh 442 15

'allPrefixes' - undeclared identifier Graphics.mqh 451 9

'[' - array required Graphics.mqh 451 20

'Print_Warning_Messages' - undeclared identifier Graphics.mqh 462 10

'DEBUG_MESSAGE_PREFIX' - undeclared identifier Graphics.mqh 464 15

'CMouse' is not a class, struct or union Graphics.mqh 469 39

'Price' - undeclared identifier Graphics.mqh 469 47

'Price' - some operator expected Graphics.mqh 469 47

'(' - ':' colon sign expected Graphics.mqh 469 52

')' - expression expected Graphics.mqh 469 53

':' - unexpected token Graphics.mqh 469 55

'(' - expression expected Graphics.mqh 469 52

'=' - operand expected Graphics.mqh 469 24

expression has no effect Graphics.mqh 469 57

'CMouse' is not a class, struct or union Graphics.mqh 470 37

'Time' - undeclared identifier Graphics.mqh 470 45

'Time' - some operator expected Graphics.mqh 470 45

'(' - ':' colon sign expected Graphics.mqh 470 49

')' - expression expected Graphics.mqh 470 50

':' - unexpected token Graphics.mqh 470 52

'(' - expression expected Graphics.mqh 470 49

'=' - operand expected Graphics.mqh 470 23

expression has no effect Graphics.mqh 470 54

possible use of uninitialized variable 'Current_Object_Time' Graphics.mqh 478 5

possible use of uninitialized variable 'Current_Object_Price' Graphics.mqh 479 5

'Print_Warning_Messages' - undeclared identifier Graphics.mqh 516 8

'DEBUG_MESSAGE_PREFIX' - undeclared identifier Graphics.mqh 518 13

'DEBUG_MESSAGE_PREFIX' - undeclared identifier Graphics.mqh 573 11

'DEBUG_MESSAGE_PREFIX' - undeclared identifier Graphics.mqh 610 11

'allPrefixes' - undeclared identifier Graphics.mqh 672 37

'[' - array required Graphics.mqh 672 48

'allPrefixes' - undeclared identifier Graphics.mqh 674 39

'[' - array required Graphics.mqh 674 50

implicit conversion from 'unknown' to 'string' Graphics.mqh 674 39

'CMouse' is not a class, struct or union Graphics.mqh 676 19

'Bar' - undeclared identifier Graphics.mqh 676 27

'Bar' - some operator expected Graphics.mqh 676 27

'(' - semicolon expected Graphics.mqh 676 30

')' - expression expected Graphics.mqh 676 31

'CMouse' is not a class, struct or union Graphics.mqh 681 6

'Below' - undeclared identifier Graphics.mqh 681 14

'Below' - some operator expected Graphics.mqh 681 14

'(' - unbalanced left parenthesis Graphics.mqh 681 5

')' - expression expected Graphics.mqh 681 20

')' - unexpected token Graphics.mqh 681 21

illegal 'else' without matching 'if' Graphics.mqh 687 3

variable 'levels_descriptions' not used Graphics.mqh 666 10

variable 'time1' not used Graphics.mqh 675 12

variable 'time2' not used Graphics.mqh 675 19

'Pitchfork_Shiff_Colour' - undeclared identifier Graphics.mqh 771 23

'Pitchfork_Shiff_Width' - undeclared identifier Graphics.mqh 772 23

'Pitchfork_Shiff_Style' - undeclared identifier Graphics.mqh 773 23

'Pitchfork_Reverce_Colour' - undeclared identifier Graphics.mqh 779 25

'Pitchfork_Reverce_Width' - undeclared identifier Graphics.mqh 780 25

'Pitchfork_Reverce_Style' - undeclared identifier Graphics.mqh 781 25

'Pitchfork_Main_Colour' - undeclared identifier Graphics.mqh 787 25

'Pitchfork_Main_Width' - undeclared identifier Graphics.mqh 788 25

'Pitchfork_Main_Style' - undeclared identifier Graphics.mqh 789 25

'CMouse' is not a class, struct or union Graphics.mqh 824 26

'Price' - undeclared identifier Graphics.mqh 824 34

'Price' - some operator expected Graphics.mqh 824 34

'(' - semicolon expected Graphics.mqh 824 39

')' - expression expected Graphics.mqh 824 40

'CMouse' is not a class, struct or union Graphics.mqh 825 21

'Bar' - undeclared identifier Graphics.mqh 825 29

'Bar' - some operator expected Graphics.mqh 825 29

'(' - semicolon expected Graphics.mqh 825 32

')' - expression expected Graphics.mqh 825 33

'CMouse' is not a class, struct or union Graphics.mqh 829 6

'Below' - undeclared identifier Graphics.mqh 829 14

'Below' - some operator expected Graphics.mqh 829 14

'(' - unbalanced left parenthesis Graphics.mqh 829 5

')' - expression expected Graphics.mqh 829 20

')' - unexpected token Graphics.mqh 829 21

illegal 'else' without matching 'if' Graphics.mqh 833 3

variable 'base' not used Graphics.mqh 827 19

'Short_Level_Length_In_Pixels' - undeclared identifier Graphics.mqh 1050 6

'Short_Level_Length_Pix' - undeclared identifier Graphics.mqh 1053 20

101 errors, 11 warnings 101 12


 
This code, unfortunately, is a single unit, so you won't be able to use the Utilites.mqh file unless you previously link GlobalVariables.mqh and Mouse.mqh. This can be done directly in the Utilites.mqh file or in the code that will use the necessary classes. Bear in mind that the input variables are also included in GlobalVariables.mqh. If you don't want to see these parameters while your code is running, you can remove the word "input" before them, but the variables themselves must remain.