【小ネタ】MT4アラートが表示されている間、音を鳴らすインジケータ
気付かない時がありますよね?
で、アラートダイアログが表示されている間、
音を鳴らすインジケータです。
単純にアラートダイアログが表示されているかどうかだけで
判断しているので、いくつもMT4を起動している場合、
どのアラートダイアログにも反応します。
// AlertAlert.mq4
#include <WinUser32.mqh>
#property indicator_chart_window
extern string WindowClass = "#32770";
extern string WindowCaption = "警告";
extern string SoundFile = "expert.wav";
int init(){return(0);}
int deinit(){return(0);}
int start()
{
int counted_bars=IndicatorCounted();
if(Bars == counted_bars + 1){
int hWnd = FindWindowA(WindowClass, WindowCaption);
if(hWnd != 0)
if(IsWindowVisible(hWnd) != 0)
PlaySound(SoundFile);
}
return(0);
}
こちらは動作確認用のインジです。
// AlertAlertTest.mq4
#property indicator_chart_window
int init()
{
Alert("AlertAlert test");
return(0);
}
int deinit(){return(0);}
int start(){return(0);}
MeteEditorはメニューのTools-Options-FontsでScriptを日本語にして
FontをMSゴシック等にしないと日本語が文字化けします。
