#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.
*/
}
|