文章 "手工制图表和交易工具箱(第三部分)。 优化和全新工具"

 

新文章 手工制图表和交易工具箱(第三部分)。 优化和全新工具已发布:

在本文中,我们将深入开发利用键盘快捷键在图表上绘制图形对象的设想。 全新工具已被加到函数库当中了,包括一条贯穿任意顶点绘制的直线,以及一组能够评估逆转时间和价位的矩形。 此外,本文还展示了优化代码从而提高性能的可能性。 实现示例已经重写,能够使用其它交易程序的快捷方式。 所需的代码知识水平:略高于初学者。

首先提供的是在较小时间帧上指标线偏移效应有关。 如果以常规方式画线,则在时间帧之间切换时会出现类似的情况:

D1 线尾端 H4 线尾端

与 D1 上的极值完全重合的直线左边缘在 H4 上向左偏移了,因此它并未与极值重合。 这是一个显而易见的影响,因为某一天的极值未必会落在该日的开始。 如果您需要更高的精度,在手工绘制时,您可以大致绘制一条线,然后切换到较低的时间帧去调整边缘。

如果您有一个或两个图表,就可以采用此解决方案。 如果您有 20 个呢? 甚至 100? 这可能很烦人。

既然该程序具有自动绘图功能,我们可在绘制每个对象时将此任务委托给该程序。

作者:Oleh Fedorov

 

编译英文版时可能会遇到一些问题。在 "Utilites.mqh "文件中,翻译人员将空格符号换成了其他符号。

因此,如果编译时出现 "Declaration without type"(无类型声明)错误,请双击带有此信息的字符串--IDE 会在编辑器中打开此字符串。然后选择一个错误的符号(通常会在主代码和注释之间),按Ctrl+H 或在主菜单中选择 "搜索"->"替换 "。

在顶行(搜索)中,IDE 将插入 "错误 "符号,而在底行(替换)中,你需要插入简单的空格。然后按下 "全部替换 "按钮...

最后一个操作是编译(Ctrl+F7)。

如何修复错误""

我会尽快将正确的文件发送给版主。

 

您创建的工具非常棒。我也是一名手动操作员,一直在寻找这样一个工具。

但我通常会在多个显示器上打开一个工具的多个窗口(时间框架)。

MQL 有没有可能让这些
绘制的对象出现在一个工具的所有打开窗口上?例如,就像在 Tigertrade 和其他平台上所做的那样。

例如,您在 5 米处绘制了水平线,同样的水平线会出现在 1 米处的窗口中。

我很惊讶 MQL 中没有这样的工具。


非常感谢

 
okskreen61 #:

嗨,你创造的工具真棒。我也是手动卡车司机,一直在寻找这样的工具。

但我通常会在多个显示器上打开一个工具的多个窗口(时间框架)。

MQL 有没有可能让这些
绘制的对象出现在一个工具的所有打开窗口上?例如,就像 Tigertrade 和其他平台所做的那样。

例如,我在 5 米处绘制了一个水平线,同样的水平线会出现在 1 米处的窗口中。

令人惊讶的是,MQL 中没有这样的工具。


非常感谢。

最简单的方法就是制作一个模板。此外,我在 kodobase 的某个地方看到过类似的东西(以指标或脚本的形式)...
 

Utilites.mqh 文件有 101 个错误,其中以下为错误:

'New_Bar_First_Start' - 声明无类型 Utilites.mqh 80 5

'mode' - 预期逗号 Utilites.mqh 80 25

'New_Bar_First_Start' - 声明无类型 Utilites.mqh 1491 26

'mode' - 预期逗号 Utilites.mqh 1491 46

'mode' - 未声明标识符 Utilites.mqh 1511 18

Is_Select_On_Create' - 未声明的标识符 Graphics.mqh 307 45

'Print_Warning_Messages' - 未声明的标识符 Graphics.mqh 249 8

'Print_Warning_Messages' - 未声明的标识符 Graphics.mqh 361 8

'CMouse'不是类、结构体或联合体 Graphics.mqh 940 26

'Bar' - 未声明标识符 Graphics.mqh 940 34

'Bar'--某些运算符 Graphics.mqh 940 34

'(' - 预计使用分号 Graphics.mqh 940 37

')'- 表达式预期 Graphics.mqh 940 38

'allPrefixes' - 未声明的标识符 Graphics.mqh 944 37

'[' - 需要数组 Graphics.mqh 944 48

'CMouse'不是类、结构体或联合体 Graphics.mqh 959 6

'Below' - 未声明标识符 Graphics.mqh 959 14

'Below' - 某些运算符预期 Graphics.mqh 959 14

'(' - 左括号不平衡 Graphics.mqh 959 5

')'- 表达式预期 Graphics.mqh 959 20

')'- 意外标记 Graphics.mqh 959 21

不匹配'if'的非法'else' Graphics.mqh 968 3

未使用变量 'tmp_price' Graphics.mqh 950 3

未使用变量 'tmp_time' Graphics.mqh 954 3

Simple_Vertical_Style' - 未声明标识符 Graphics.mqh 420 26

'Simple_Vertical_Width' - 未声明的标识符 Graphics.mqh 422 26

'Simple_Horizontal_Style' - 未声明的标识符 Graphics.mqh 430 28

'Simple_Horizontal_Width' - 未声明的标识符 Graphics.mqh 432 28

'CMouse'不是类、结构体或联合体 Graphics.mqh 434 14

Window' - 未声明标识符 Graphics.mqh 434 22

Window' - 期望使用某个运算符 Graphics.mqh 434 22

')'- 意外标记 Graphics.mqh 434 29

'Print_Warning_Messages' - 未声明标识符 Graphics.mqh 439 10

DEBUG_MESSAGE_PREFIX' - 未声明的标识符 Graphics.mqh 442 15

'allPrefixes' - 未声明的标识符 Graphics.mqh 451 9

'[' - 需要数组 Graphics.mqh 451 20

'Print_Warning_Messages' - 未声明的标识符 Graphics.mqh 462 10

'DEBUG_MESSAGE_PREFIX' - 未声明的标识符 Graphics.mqh 464 15

'CMouse'不是类、结构体或联合体 Graphics.mqh 469 39

'Price' - 未声明标识符 Graphics.mqh 469 47

'Price' - 某些运算符 Graphics.mqh 469 47

'(' - 预计为':'冒号 Graphics.mqh 469 52

')'- 表达式预期 Graphics.mqh 469 53

':'- 意外标记 Graphics.mqh 469 55

'(' - 预期表达式 Graphics.mqh 469 52

'=' - 预期操作数 Graphics.mqh 469 24

表达式不起作用 Graphics.mqh 469 57

'CMouse'不是类、结构体或联合体 Graphics.mqh 470 37

Time' - 未声明标识符 Graphics.mqh 470 45

时间' - 某些运算符 Graphics.mqh 470 45

'(' - 预计为':'冒号 Graphics.mqh 470 49

')'- 表达式预期 Graphics.mqh 470 50

':'- 意外标记 Graphics.mqh 470 52

'(' - 预期表达式 Graphics.mqh 470 49

'=' - 预期操作数 Graphics.mqh 470 23

表达式不起作用 Graphics.mqh 470 54

可能使用了未初始化的变量 'Current_Object_Time' Graphics.mqh 478 5

可能使用了未初始化的变量 'Current_Object_Price' Graphics.mqh 479 5

'Print_Warning_Messages' - 未声明的标识符 Graphics.mqh 516 8

DEBUG_MESSAGE_PREFIX' - 未声明的标识符 Graphics.mqh 518 13

'DEBUG_MESSAGE_PREFIX' - 未声明的标识符 Graphics.mqh 573 11

'DEBUG_MESSAGE_PREFIX' - 未声明的标识符 Graphics.mqh 610 11

'allPrefixes' - 未声明的标识符 Graphics.mqh 672 37

'[' - 需要数组 Graphics.mqh 672 48

'allPrefixes' - 未声明的标识符 Graphics.mqh 674 39

'[' - 需要数组 Graphics.mqh 674 50

从'未知'到'字符串'的隐式转换 Graphics.mqh 674 39

'CMouse'不是类、结构体或联合体 Graphics.mqh 676 19

'Bar' - 未声明标识符 Graphics.mqh 676 27

'Bar'--某些运算符 Graphics.mqh 676 27

'(' - 预期分号 Graphics.mqh 676 30

')'- 表达式预期 Graphics.mqh 676 31

'CMouse'不是类、结构体或联合体 Graphics.mqh 681 6

'Below' - 未声明标识符 Graphics.mqh 681 14

'Below' - 某些运算符预期 Graphics.mqh 681 14

'(' - 左括号不平衡 Graphics.mqh 681 5

')'- 表达式预期 Graphics.mqh 681 20

')'- 意外标记 Graphics.mqh 681 21

不匹配'if'的非法'else' Graphics.mqh 687 3

未使用变量 'levels_descriptions' Graphics.mqh 666 10

未使用变量'time1' Graphics.mqh 675 12

变量'time2'未使用 Graphics.mqh 675 19

'Pitchfork_Shiff_Colour' - 未声明标识符 Graphics.mqh 771 23

Pitchfork_Shiff_Width' - 未声明的标识符 Graphics.mqh 772 23

Pitchfork_Shiff_Style' - 未声明的标识符 Graphics.mqh 773 23

'Pitchfork_Reverce_Colour' - 未声明的标识符 Graphics.mqh 779 25

Pitchfork_Reverce_Width' - 未声明的标识符 Graphics.mqh 780 25

Pitchfork_Reverce_Style' - 未声明的标识符 Graphics.mqh 781 25

Pitchfork_Main_Colour' - 未声明的标识符 Graphics.mqh 787 25

Pitchfork_Main_Width' - 未声明的标识符 Graphics.mqh 788 25

Pitchfork_Main_Style' - 未声明的标识符 Graphics.mqh 789 25

'CMouse'不是类、结构体或联合体 Graphics.mqh 824 26

'Price' - 未声明标识符 Graphics.mqh 824 34

'Price'--某些运算符 Graphics.mqh 824 34

'(' - 预期分号 Graphics.mqh 824 39

')'- 表达式预期 Graphics.mqh 824 40

'CMouse'不是类、结构体或联合体 Graphics.mqh 825 21

'Bar' - 未声明标识符 Graphics.mqh 825 29

'Bar'--某些运算符 Graphics.mqh 825 29

'(' - 预期分号 Graphics.mqh 825 32

')'- 表达式预期 Graphics.mqh 825 33

'CMouse'不是类、结构体或联合体 Graphics.mqh 829 6

'Below' - 未声明标识符 Graphics.mqh 829 14

'Below' - 某些运算符预期 Graphics.mqh 829 14

'(' - 左括号不平衡 Graphics.mqh 829 5

')'- 表达式预期 Graphics.mqh 829 20

')'- 意外标记 Graphics.mqh 829 21

没有匹配 'if' 的非法 'else' Graphics.mqh 833 3

未使用变量'base' Graphics.mqh 827 19

'Short_Level_Length_In_Pixels' - 未声明标识符 Graphics.mqh 1050 6

Short_Level_Length_Pix' - 未声明的标识符 Graphics.mqh 1053 20

101 个错误,11 个警告 101 12


 
不幸的是,该代码是一个单独的单元,因此除非事先链接 GlobalVariables.mqh 和 Mouse.mqh,否则无法使用 Utilites.mqh 文件。这可以直接在 Utilites.mqh 文件中完成,也可以在使用必要类的代码中完成。请注意,输入变量也包含在 GlobalVariables.mqh 中。如果不想在代码运行时看到这些参数,可以删除 它们前面的 "input"(输入)字样,但变量本身必须保留。