MQL4 Reference MQL4命令手册(完整版)
 
 
 
| 
 
| WindowOnDropped int WindowOnDropped( )
 返回智能交易,客户指标和脚本的绑定窗口索引。 只有在智能交易、客户指标或脚本应用鼠标的帮助下,绑定的值是准确的。
 注解:对于客户指标初始化(调用 init()函数),此索引不被定义。
 返回的索引被窗口编码(0为主菜单图表,指标子窗口的开始数字为1 )。 在运行期间客户指标可以创建子窗口,子窗口的编码不同于。
 参见 WindowXOnDropped(), WindowYOnDropped()
 示例:
 if(WindowOnDropped()!=0)
 {
 Print("指标'MyIndicator'必须被主图表窗口接受!");
 return(false);
 }
 
 | 
 | 
|  | 
|
|  | 
|  | 
 
 
| 
 
| WindowPriceMax double WindowPriceMax( void index)
 返回当前图表指定子窗口的最大垂直标度的值(0为主菜单图表,指标子窗口的开始数字为1 )。 如果子窗口没有指定,最大价格标度的值返回图表窗口。
 参见 WindowPriceMin(), WindowFirstVisibleBar(), WindowBarsPerChart()
 参量:
 index   -   图表子窗口索引 (0 -主图表窗口)。
 示例:
 double   top=WindowPriceMax();
 double   bottom=WindowPriceMin();
 datetime left=Time[WindowFirstVisibleBar()];
 int      right_bound=WindowFirstVisibleBar()-WindowBarsPerChart();
 if(right_bound<0) right_bound=0;
 datetime right=Time[right_bound]+Period()*60;
 //----
 ObjectCreate("Padding_rect",OBJ_RECTANGLE,0,left,top,right,bottom);
 ObjectSet("Padding_rect",OBJPROP_BACK,true);
 ObjectSet("Padding_rect",OBJPROP_COLOR,Blue);
 WindowRedraw();
 
 | 
 | 
|  | 
|
|  | 
|  | 
 
 
| 
 
| WindowPriceMin double WindowPriceMin( void index)
 返回当前图表指定子窗口的最小垂直标度的价格值(0为主菜单图表,指标子窗口的开始数字为1 )。 如果子窗口没有指定,最小价格标度的价格值返回图表窗口。
 参见 WindowPriceMax(), WindowFirstVisibleBar(), WindowBarsPerChart()
 参量:
 index   -   图表子窗口索引 (0 - 主图表窗口)。
 示例:
 double   top=WindowPriceMax();
 double   bottom=WindowPriceMin();
 datetime left=Time[WindowFirstVisibleBar()];
 int      right_bound=WindowFirstVisibleBar()-WindowBarsPerChart();
 if(right_bound<0) right_bound=0;
 datetime right=Time[right_bound]+Period()*60;
 //----
 ObjectCreate("Padding_rect",OBJ_RECTANGLE,0,left,top,right,bottom);
 ObjectSet("Padding_rect",OBJPROP_BACK,true);
 ObjectSet("Padding_rect",OBJPROP_COLOR,Blue);
 WindowRedraw();
 
 | 
 | 
|  | 
|
|  | 
|  | 
 
 
| 
 
| WindowPriceOnDropped double WindowPriceOnDropped( )
 返回图表指出的智能交易或脚本价格下滑价格部分。 只有在智能交易、客户指标或脚本应用鼠标的情况下,绑定的值是准确的。注解: 对于客户指标的值是不确定的。
 示例:
 double   drop_price=WindowPriceOnDropped();
 datetime drop_time=WindowTimeOnDropped();
 //---- 可能未指定 (zero)
 if(drop_time>0)
 {
 ObjectCreate("价格下滑水平", OBJ_HLINE, 0, drop_price);
 ObjectCreate("下滑时间", OBJ_VLINE, 0, drop_time);
 }
 
 | 
 | 
|  | 
|
|  | 
|  | 
 
 
| 
 
| WindowRedraw void WindowRedraw( )
 重新画出当前图表。在货币对属性改变之后应用。
 示例:
 //---- 对于货币对设置新属性
 ObjectMove(object_name1, 0, Time[index], price);
 ObjectSet(object_name1, OBJPROP_ANGLE, angle*2);
 ObjectSet(object_name1, OBJPROP_FONTSIZE, fontsize);
 ObjectSet(line_name, OBJPROP_TIME2, time2);
 ObjectSet(line_name, OBJPROP_ANGLE, line_angle);
 //---- 现在重画
 WindowRedraw();
 
 | 
 | 
|  | 
|
|  | 
|  | 
 
 
| 
 
| WindowScreenShot bool WindowScreenShot( string filename, int size_x, int size_y, void start_bar, void chart_scale, void chart_mode)
 以GIF 文件形式保存当前图像。如果失败,返回FALSE。详细错误信息,查看 GetLastError() 函数。
 图像被储存在terminal_dir\experts\files (terminal_dir\tester\files 测试情况下) 目录中或是子目录。
 参量:
 filename   -   屏幕映像文件名称。
 size_x   -   屏幕宽度映像点。
 size_y   -   屏幕高度影响点。
 start_bar   -   I第一个可见柱的屏幕映像。如果价格值设定为 0 ,当前的第一个可见柱 将被除去。如果价格值为负值, 结束图的映像将会产生。
 chart_scale   -   对于屏幕映像水平的图标度。 可以在范围从0到5之间。 如果没有值或者为负值,当前图表将被应用。
 chart_mode   -   图表显示模式。可以是以下价格值: ICHART_BAR (0 是柱的次序), CHART_CANDLE (1 是蜡烛柱的次序),CHART_LINE (2 是收盘价格线)。如果没有价格值或者为负值,图表会以当前模式显示。
 示例:
 int lasterror=0;
 //----测试者平仓或多个仓
 if(IsTesting() && ExtTradesCounter<TradesTotal())
 {
 //---- 使WindowScreenShot 进行检测
 if(!WindowScreenShot("shots\\tester"+ExtShotsCounter+".gif",640,480))
 lasterror=GetLastError();
 else ExtShotsCounter++;
 ExtTradesCounter=TradesTotal();
 }
 
 | 
 | 
|  | 
|
|  | 
|  | 
 
 
| 
 
| WindowTimeOnDropped datetime WindowTimeOnDropped( )
 返回图表指出的智能交易或脚本价格下滑时间部分。 只有在智能交易、客户指标或脚本应用鼠标的帮助下,绑定的值是准确的。
 注解: 对于客户指标的价格值是不确定的。
 示例:
 double   drop_price=WindowPriceOnDropped();
 datetime drop_time=WindowTimeOnDropped();
 //---- 可能未指定 (zero)
 if(drop_time>0)
 {
 ObjectCreate("Dropped price line", OBJ_HLINE, 0, drop_price);
 ObjectCreate("Dropped time line", OBJ_VLINE, 0, drop_time);
 }
 
 | 
 | 
|  | 
|
|  | 
|  | 
 
 
| 
 
| WindowsTotal指标窗口数 int WindowsTotal( )
 返回在图表中指标窗口数(包括主图表)。
 示例:
 Print("窗口数 = ", WindowsTotal());
 WindowXOnDropped
 int WindowXOnDropped( )
 当以映像点X轴图表窗口的客户区域智能交易或脚本下滑时,返回价格值。 只有在智能交易、客户指标或脚本应用鼠标("Drag'n'Drop") 的情况下,绑定的值是准确的。
 参见 WindowYOnDropped(), WindowOnDropped()
 示例:
 Print("智能交易下滑点 x=",WindowXOnDropped()," y=",WindowYOnDropped());
 
 | 
 | 
|  | 
|
|  | 
|  | 
 
 
| 
 
| WindowYOnDropped int WindowYOnDropped( )
 当以映像点Y轴图表窗口的客户区域智能交易或脚本下滑时,返回价格值。 只有在智能交易、客户指标或脚本应用鼠标("Drag'n'Drop")的帮助下,绑定的值是准确的。
 参见 WindowXOnDropped(), WindowPriceOnDropped(), WindowOnDropped()
 示例:
 Print" 被获取智能交易到窗口的点x=",WindowXOnDropped()," y=",WindowYOnDropped());
 
 | 
 | 
|  | 
|
|  | 
|  | 
 
 
| 
 
| Obsolete functions过时的函数 MQL4程序在不断的完善发展中,由于系统化的需要,一些名称被重新命名。旧的功能名称与MetaEditor资料无法连接。有时,编辑器会以适当的途径接纳。不过,我们还是要求使用新名称。
 
 | 
 | 
|  | 
|
|  | 
|  |