fc2ブログ

05 « 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.30.» 07

不労所得で生活できるのか?

主にMT4関連のツールやEAを作ってます。 夢の自動集金マシン(?)は存在するのか・・・。

【小ネタ】MT4アラートが表示されている間、音を鳴らすインジケータ 

MT4のアラートって音が1回しか鳴らないので

気付かない時がありますよね?

で、アラートダイアログが表示されている間、

音を鳴らすインジケータです。

単純にアラートダイアログが表示されているかどうかだけで

判断しているので、いくつも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ゴシック等にしないと日本語が文字化けします。

いつも応援ありがとうございます。m(__)m
スポンサーサイト



2011/10/21 Fri. 04:42 | trackback: -- | comment: -- | edit