#define SYMBOL_NAME "GBPUSD"
//+------------------------------------------------------------------+
//| スクリプトプログラム開始関数 |
//+------------------------------------------------------------------+
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);
/*
結果:
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
*/
}
|