MarketBookRelease
MarketBookRelease
提供所选交易品种的收盘市场报价信息,并取消预定接收DOM转变的通知。
bool MarketBookRelease(
string symbol // 交易品种
);参量
- 交易品种
[in] 交易品种名称。
返回值
如果成功关闭是真值,否则是错误值。
注意
通常,该函数需要调用OnDeinit()函数才能启用,如果在OnInit()函数中调用类似于 MarketBookAdd()函数,就会调用分类解构函数,从分类解构函数中调用类似于MarketBookAdd()的函数。
示例:
#define SYMBOL_NAME "GBPUSD"
//+------------------------------------------------------------------+
//| EA交易初始化函数 |
//+------------------------------------------------------------------+
void OnStart()
{
//--- 打开SYMBOL_NAME交易品种的市场深度
if(!MarketBookAdd(SYMBOL_NAME))
{
PrintFormat("MarketBookAdd(%s) failed. Error ", SYMBOL_NAME, GetLastError());
return;
}
//--- 将成功打开市场深度的消息发送到日志
PrintFormat("The MarketBook for the '%s' symbol was successfully opened and a subscription to change it was received", SYMBOL_NAME);
//--- 等待2秒
Sleep(2000);
//--- 完成后,取消订阅打开的市场深度
//--- 将有关成功取消订阅市场深度或有关错误的消息发送到日志
ResetLastError();
if(MarketBookRelease(SYMBOL_NAME))
PrintFormat("MarketBook for the '%s' symbol was successfully closed", SYMBOL_NAME);
else
PrintFormat("Error %d occurred when closing MarketBook using the '%s' symbol", GetLastError(), SYMBOL_NAME);
/*
result:
The MarketBook for the 'GBPUSD' symbol was successfully opened and a subscription to change it was received
MarketBook for the 'GBPUSD' symbol was successfully closed
*/
}另见