![見出し画像](https://assets.st-note.com/production/uploads/images/153085936/rectangle_large_type_2_e6990528677c6c63a697c25a02744e25.png?width=1200)
Photo by
nurugamer_g
(応用)定期的にMT5の生存通知を行う(LINE通知)
うわ、『Update切るの忘れて、シャットダウンされてる!!』とか、『あ、止まってるやん』って場合ありませんか?
定期的にLINE通知させて、生きているかどうか確認しましょー
※上記のnoteで作成したIncludeを利用するので、先に読んでくださいね
heartbeat_notification.mq5
#include <WinAPI\LineNotify.mqh>
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- create timer
EventSetTimer(1800);//30分毎にOntimerを呼び出す
string message = "All that matters is that I win!";
SendLineNotification(message); // LineNotify.mqhで定義された関数を呼び出す
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//--- destroy timer
EventKillTimer();//タイマー解除
}
//+------------------------------------------------------------------+
//| Timer function |
//+------------------------------------------------------------------+
void OnTimer()
{
string message = "My heartbeat is like a burning heat, still trading with passion!";
SendLineNotification(message); // LineNotify.mqhで定義された関数を呼び出す
}
//+------------------------------------------------------------------+
後はLINE通知されてるか、チェックしてくださいねー
お疲れさまでした( ^^) _U~~
MQL5コード一覧はコチラ