SymbolIsSynchronized
同步交易品种
该函数检验在客户端中选出来的交易品种数据与交易服务器中的数据是同步的。
bool SymbolIsSynchronized(
string name, // 交易品种名称
);参量
- 名称
[in] 交易品种名称。
返回值
如果数据是 同步的 , 返回true,否则返回false。
示例:
#define SYMBOL_NAME "EURUSD"
//+------------------------------------------------------------------+
//| EA交易初始化函数 |
//+------------------------------------------------------------------+
void OnStart()
{
//--- 使用“SYMBOL_NAME”交易品种获取用于同步程序端数据和服务器数据的标识
bool sync = SymbolIsSynchronized(SYMBOL_NAME);
//--- 根据同步标识创建消息
string text = StringFormat("The data on the '%s' symbol in the terminal is synchronized with the data on the trading server.", SYMBOL_NAME);
if(!sync)
text = StringFormat("The data for the '%s' symbol in the terminal is not synchronized with the data on the trading server.", SYMBOL_NAME);
//--- 将获得的结果发送到日志
Print(text);
/*
result for synchronized data:
The data on the 'EURUSD' symbol in the terminal is synchronized with the data on the trading server.
result for data not yet synchronized:
The data for the 'GBPHKD' symbol in the terminal is not synchronized with the data on the trading server.
*/
}另见