找回密码
 立即注册

MQL4>MQL5:图表操作

2024-5-1 21:16| 发布者: admin| 查看: 226| 评论: 0|来自: 文章来源MQL5官网

摘要: 文章来源MQL5官网
 
MQL4
 MQL5说明
void HideTestIndicators(bool hide)
-HideTestIndicators
函数设置一个用于隐藏 EA 交易程序所调用的指标的标记。
int Period()
ENUM_TIMEFRAMES  Period()
Period
返回确定使用的周期(图表时间框架)的分钟数。
Period
bool RefreshRates()
-RefreshRates
刷新预定义的变量和序列数组中的数据。
string Symbol()
string Symbol()
Symbol
返回含有当前金融工具的名称的文本字符串。
Symbol
int WindowBarsPerChart()
int ChartGetInteger(0,CHART_VISIBLE_BARS,0)
WindowBarsPerChart
函数返回在图表上显示的柱的数量。
ChartGetInteger
string WindowExpertName()
string MQLInfoString(MQL5_PROGRAM_NAME)
WindowExpertName
视 MQL4 程序而定,返回调用该函数的所执行 EA 交易程序、脚本、自定义指标或库的名称。
MQLInfoString

int WindowFind(string name)
int WindowFindMQL4(string name)
  {
   int window=-1;
   if((ENUM_PROGRAM_TYPE)MQLInfoInteger(MQL5_PROGRAM_TYPE)==PROGRAM_INDICATOR)
     {
      window=ChartWindowFind();
     }
   else
     {
      window=ChartWindowFind(0,name);
      if(window==-1) Print(__FUNCTION__+"(): 错误 = ",GetLastError());
     }
   return(window);
  }
WindowFind
如果找到具有指定名称的指标,则函数返回包含此指定指标的窗口索引,否则返回 -1。
ChartWindowFindMQLInfoInteger
int WindowFirstVisibleBar()
int ChartGetInteger(0,CHART_FIRST_VISIBLE_BAR,0)
WindowFirstVisibleBar
函数返回当空图表窗口中第一个可见柱的编号。
ChartGetInteger
int WindowHandle(string symbol,
                 int timeframe)
int WindowHandleMQL4(string symbol,
                     int tf)
  {
   ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
   long currChart,prevChart=ChartFirst();
   int i=0,limit=100;
   while(i<limit)
     {
      currChart=ChartNext(prevChart);
      if(currChart<0) break;
      if(ChartSymbol(currChart)==symbol
         && ChartPeriod(currChart)==timeframe)
         return((int)currChart);
      prevChart=currChart;
      i++;
     }
   return(0);
  }
WindowHandle
返回指定图表的系统窗口句柄。
ChartFirstChartNextChartSymbolChartPeriod
bool WindowIsVisible(int index)
bool ChartGetInteger(0,CHART_WINDOW_IS_VISIBLE,index)
WindowIsVisible
如果图表子窗口可见,则返回 TRUE,否则返回 FALSE。
ChartGetInteger
int WindowOnDropped()
int ChartWindowOnDropped()
WindowOnDropped
返回 EA 交易程序、自定义指标或脚本所在的窗口的索引。
ChartWindowOnDropped
double WindowPriceMax(int index=0)
double ChartGetDouble(0,CHART_PRICE_MAX,index)
WindowPriceMax
返回当前图表的指定子窗口的垂直刻度的最大值(0-主图表窗口,指标的子窗口从 1 开始编号)。
ChartGetDouble
double WindowPriceMin(int index=0)
double ChartGetDouble(0,CHART_PRICE_MIN,index)
WindowPriceMin
返回当前图表的指定子窗口的垂直刻度的最小值(0-主图表窗口,指标的子窗口从 1 开始编号)。
ChartGetDouble
double WindowPriceOnDropped()
double ChartPriceOnDropped()
WindowPriceOnDropped
返回 EA 交易程序或脚本所在的图表点的价格部分。
ChartPriceOnDropped
void WindowRedraw()
void ChartRedraw(0)
WindowRedraw
强制重绘当前图表。
ChartRedraw
bool WindowScreenShot(string filename,
                      int size_x,
                      int size_y,
                      int start_bar=-1,
                      int chart_scale=-1,
                      int chart_mode=-1)
bool WindowScreenShotMQL4(string filename,
                          int size_x,
                          int size_y,
                          int start_bar=-1,
                          int chart_scale=-1,
                          int chart_mode=-1)
  {
   if(chart_scale>0 && chart_scale<=5)
      ChartSetInteger(0,CHART_SCALE,chart_scale);
   switch(chart_mode)
     {
      case 0: ChartSetInteger(0,CHART_MODE,CHART_BARS);
      case 1: ChartSetInteger(0,CHART_MODE,CHART_CANDLES);
      case 2: ChartSetInteger(0,CHART_MODE,CHART_LINE);
     }
   if(start_bar<0)
      return(ChartScreenShot(0,filename,size_x,size_y,ALIGN_RIGHT));
   else
      return(ChartScreenShot(0,filename,size_x,size_y,ALIGN_LEFT));
  }
WindowScreenShot
作为 GIF 文件保存当前图表屏幕的截图。
ChartSetIntegerChartScreenShot
datetime WindowTimeOnDropped()
datetime ChartTimeOnDropped()
WindowTimeOnDropped
返回 EA 交易程序或脚本所在的图表点的时间部分。
ChartTimeOnDropped
int WindowsTotal()
int ChartGetInteger(0,CHART_WINDOWS_TOTAL)
WindowsTotal
返回图表上指标窗口的数量(包括主图表)。
ChartGetInteger
int WindowXOnDropped()
int ChartXOnDropped()
WindowXOnDropped
返回 EA 交易程序或脚本所在的图表窗口客户端区域点的 X 轴的值(以像素为单位)。
ChartXOnDropped
int WindowYOnDropped()
int ChartYOnDropped()
WindowYOnDropped
返回 EA 交易程序或脚本所在的图表窗口客户端区域点的 Y 轴的值(以像素为单位)。
ChartYOnDropped

路过

雷人

握手

鲜花

鸡蛋

QQ|Archiver|小黑屋|www.mtctp.com |

GMT+8, 2024-10-22 16:39 , Processed in 0.032845 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

返回顶部