MQL4参考 图表操作 WindowHandle

WindowHandle

Returns the system handle of the chart window.

int  WindowHandle(
   string       symbol,     // symbol
   int          timeframe   // timeframe
   );

Parameters

symbol

[in]  Symbol.

timeframe

[in]  Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.

Returned value

Returns the system handle of the chart window. If the chart of symbol and timeframe has not been opened by the moment of function calling, 0 will be returned.

Example:

  int win_handle=WindowHandle("USDX",PERIOD_H1);
  if(win_handle!=0)
    Print("Window with USDX,H1 detected. Rates array will be copied immediately.");