• 締切済み

MT4サブウインドウの移動線のクロスをアラートに

MetaTrader4のスクリプト初心者です。 サブウインドウに表示している移動線同士が交差したらアラートを出して、メールで知らせるスクリプトの書き方ご存知の方教えていただけないでしょうか? サブウィンドウにMT4標準で罫線分析ツールに入っているStochastic Oscillator(メインとシグナル)とMoving Averageを表示しています。 それぞれの設定は次のとおりです。 Stochastic Oscillator %K 14, %D 3, Slowing 3, Price field Low/High, Sinple, 下限 0, 上限 100 Moving Average 期間 14, 表示移動 0, Exponential, First Indicator's Data (メインウィンドウのFirst Indicatorは、期間 84, 表示移動 0, Simple, Close) 添付画像だと、Stochasticが黄線と赤線、Moving Averageが緑線です 緑線と黄線、緑線と赤線がクロスするときにアラートとメールを送るようにしたいのです。 自分でも探してみたのですが、サブウィンドウにあるStochasticとMoving Averageのクロスを表示するインジケーターらしきものは見つからなかったので、ご存知の方いらっしゃらないでしょうか 参考になるスクリプトでも、もちろん結構です。 よろしくお願いいたします。

みんなの回答

  • Saitar
  • ベストアンサー率41% (192/464)
回答No.1

まず、スクリプトとインジケーターの違いを勉強してから、応用編に進みましょうね。

関連するQ&A

  • MT4のMTF Moving Average

    みんさんこんにちは。 MT4のMTF Moving Averageについて質問があります。 MT4 MTF Moving Averageは異なる時間足の移動平均線を表示することができますが、MTFの設定をすることなく、自動で上位時間の移動平均線を表示してくれるインジケーターはないでしょうか?。 たとえばで言うと、1時間足の表示をしているときに自動で4時間足のMTF Moving Averageが表示されるということです。 4時間足の表示をしているときは日足が表示されるイメージです。 皆さんよろしくお願いします。

  • MT4のインジケーターを探しています

    MT4のインジケーターを探しています 長期移動平均線を抜けている状態で 中期と短期の移動平均線がクロスしたら 矢印やアラートが出るインジケーターってありますか?

  • メタトレーダー4(MT4)のインディケーター

    メタトレーダー4(MT4)のインディケーター 2×5 MA Cross With Sound の アラート表示と音を消したいのですが、どのようにしたらいいのでしょうか? 画面上の編集にはパラメーターの入力にsound onを切り替える箇所もありませんし、 Metaeditorも見ましたがalertTagやPlaySoundとか詳しくないので分かりません。 2×5 MA Cross単体も探しましたが見当たりませんでした。 宜しくお願いします。

  • MT4のカスタムインジケーターがグレーになってしま

    カテゴリー違いだったらすいません。 FXのMT4チャートについてお聞きしたいです。 先日、デモ口座のチャートがそのようになり他のを使っていましたが、今日になり他の3つとも同じことになってしまいました。 表示していたMAが消えてしまったのでカスタムインジケーターを開いて見ましたところ、ムービングアベレージがなくなっていました。 他のインジケーターなど(自分で購入して入れたものも含む)十数種類が黄色からグレーになっていて表示することができません。 ファイルの破損などが考えられるのでしょうか? 一度アンインストールして入れ直しましたが駄目でした。 PC疎いのでわかりやすく解説していただけると助かります。 どうぞよろしくお願いいたします。

  • Average crosses arrows

    https://technical-indicators.com/archives/19511 こちらのAverage crosses arrows or linesというインジケーター。 下の方の、 Arrow on first bars(Fast Shift、Slow Shift) Interpolate in multi time frame mode? というのは、どのような機能なのでしょうか? また、MAがクロス(触れたら)したらアラートでなく、 MAがクロスして、そのローソク足が確定したらアラートが鳴る。 という風にできるのでしょうか? 「Arrow on first bars」 という項目がそれなのでしょうか? よろしくお願いいたします。

  • VT Traderの指標

    VT TraderのMoving Average Double Cross Systemの見方がわかりません。 教えてください。 (初期設定が5,10,20の3本の移動平均線を使用するのですが、どのように理解すればいいのでしょうか)

  • ボタン押下時のアラート表示の残像が残る

    以下のプログラムで、btnUpdateを実行すると、アラート表示されるのですが、 アラートのOKボタンを押さず、ぐりぐりと画面上移動させるとその軌跡が残像として残ります。 どのようにすれば、このような残像が残らないようにする事が出来るでしょうか。 ご存じの方、ご教授願います。 protected void btnUpdate_Click(object sender, EventArgs e) { if(xxxx == aaaa) { 処理A} else {AlertBox("Input Code");}   } //アラート表示 private void AlertBox(String msg) { string startupScript = ""; string strScript = ""; msg = msg.Replace("'", "\""); msg = msg.Replace("\n", " "); strScript = " alert('" + msg + "')"; startupScript = "<script language='JavaScript'>" + strScript + "</script>"; ClientScript.RegisterStartupScript(this.GetType(), "key1", startupScript); }

  • MT4 ストキャスティクス

    下記、MT4ストキャスティクスのプログラムなのですが、下記(1)(2)(3)の条件を満たすには、どのようにプログラムを変更したらよいのでしょうか。 詳しい方、教えてください。 (1)Alertを出すには。 (2)Soundを1度だけ鳴らすには (3)Soundを鳴らし続けるには 先日、プログラムに詳しい方からスローの方でご教授いただいたのですが、その方への連絡の取り方がわからないため、どなたかご教授ください。お願いします。 #property copyright "Copyright ゥ 2004, MetaQuotes Software Corp." #property link "http://www.metaquotes.net/" #property indicator_separate_window #property indicator_minimum 0 #property indicator_maximum 100 #property indicator_buffers 2 #property indicator_color1 Lime #property indicator_color2 Red //---- input parameters extern int KPeriod=42; extern int DPeriod=3; extern int Slowing=3; //---- buffers double MainBuffer[]; double SignalBuffer[]; double HighesBuffer[]; double LowesBuffer[]; //---- int draw_begin1=0; int draw_begin2=0; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { string short_name; //---- 2 additional buffers are used for counting. IndicatorBuffers(4); SetIndexBuffer(2, HighesBuffer); SetIndexBuffer(3, LowesBuffer); //---- indicator lines SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0, MainBuffer); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1, SignalBuffer); //---- name for DataWindow and indicator subwindow label short_name="Sto("+KPeriod+","+DPeriod+","+Slowing+")"; IndicatorShortName(short_name); SetIndexLabel(0,short_name); SetIndexLabel(1,"Signal"); //---- draw_begin1=KPeriod+Slowing; draw_begin2=draw_begin1+DPeriod; SetIndexDrawBegin(0,draw_begin1); SetIndexDrawBegin(1,draw_begin2); //---- return(0); } //+------------------------------------------------------------------+ //| Stochastic oscillator | //+------------------------------------------------------------------+ int start() { int i,k; int counted_bars=IndicatorCounted(); double price; //---- if(Bars<=draw_begin2) return(0); //---- initial zero if(counted_bars<1) { for(i=1;i<=draw_begin1;i++) MainBuffer[Bars-i]=0; for(i=1;i<=draw_begin2;i++) SignalBuffer[Bars-i]=0; } //---- minimums counting i=Bars-KPeriod; if(counted_bars>KPeriod) i=Bars-counted_bars-1; while(i>=0) { double min=1000000; k=i+KPeriod-1; while(k>=i) { price=Low[k]; if(min>price) min=price; k--; } LowesBuffer[i]=min; i--; } //---- maximums counting i=Bars-KPeriod; if(counted_bars>KPeriod) i=Bars-counted_bars-1; while(i>=0) { double max=-1000000; k=i+KPeriod-1; while(k>=i) { price=High[k]; if(max<price) max=price; k--; } HighesBuffer[i]=max; i--; } //---- %K line i=Bars-draw_begin1; if(counted_bars>draw_begin1) i=Bars-counted_bars-1; while(i>=0) { double sumlow=0.0; double sumhigh=0.0; for(k=(i+Slowing-1);k>=i;k--) { sumlow+=Close[k]-LowesBuffer[k]; sumhigh+=HighesBuffer[k]-LowesBuffer[k]; } if(sumhigh==0.0) MainBuffer[i]=100.0; else MainBuffer[i]=sumlow/sumhigh*100; i--; } //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; int limit=Bars-counted_bars; //---- signal line is simple movimg average for(i=0; i<limit; i++) SignalBuffer[i]=iMAOnArray(MainBuffer,Bars,DPeriod,0,MODE_SMA,i); //---- return(0); } //+------------------------------------------------------------------+

  • MT4 MACD

    下記、MACDのプログラムですが、MACDラインとSignalラインがクロスした際、(1)-(3)の条件を満たす、プログラム変更を、どなたか、詳しい方教えてください。 (1)Alertを鳴らす (2)Soundを1度鳴らす (3)Soundを鳴らし続ける #property copyright "Copyright(C) 2005 S.B.T. All Rights Reserved." #property link "http://sufx.core.t3-ism.net/" //---- indicator settings #property indicator_separate_window #property indicator_buffers 4 #property indicator_color1 MediumSeaGreen #property indicator_color2 DarkOrange #property indicator_color3 Crimson #property indicator_color4 SteelBlue //---- indicator parameters extern int FastMA=12; extern int SlowMA=26; extern int MA_Method=1; extern int SignalMA=9; extern int SignalMA_Method=1; extern int Apply=0; extern int Timeframe=0; //---- indicator buffers double ind_buffer1[]; double ind_buffer2[]; double ind_buffer3[]; double ind_buffer4[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { string short_name1,short_name2,short_name3; //---- drawing settings SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID); SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID); SetIndexDrawBegin(1,SignalMA); IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+1); //---- indicator buffers mapping if(!SetIndexBuffer(0,ind_buffer1) && !SetIndexBuffer(1,ind_buffer2) && !SetIndexBuffer(2,ind_buffer3) && !SetIndexBuffer(3,ind_buffer4)) Print("cannot set indicator buffers!"); //---- name for DataWindow and indicator subwindow label switch(MA_Method) { case 1 : short_name1="EMA("; break; case 2 : short_name1="SMMA("; break; case 3 : short_name1="LWMA("; break; default : MA_Method=0; short_name1="SMA("; } switch(SignalMA_Method) { case 1 : short_name2="EMA("; break; case 2 : short_name2="SMMA("; break; case 3 : short_name2="LWMA("; break; default : SignalMA_Method=0; short_name2="SMA("; } switch(Apply) { case 1 : short_name3="Apply to Open price"; break; case 2 : short_name3="Apply to High price"; break; case 3 : short_name3="Apply to Low price"; break; case 4 : short_name3="Apply to Median price, (high+low)/2"; break; case 5 : short_name3="Apply to Typical price, (high+low+close)/3"; break; case 6 : short_name3="Apply to Weighted close price, (high+low+close+close)/4"; break; default : Apply=0; short_name3="Apply to Close price"; } IndicatorShortName("MACD("+short_name1+FastMA+"),"+short_name1+SlowMA+"),"+short_name2+SignalMA+")) "+short_name3); SetIndexLabel(0,"Oscillator"); SetIndexLabel(1,"Oscillator"); SetIndexLabel(2,"Signal"); SetIndexLabel(3,"MACD"); //---- initialization done return(0); } //+------------------------------------------------------------------+ //| Moving Averages Convergence/Divergence | //+------------------------------------------------------------------+ int start() { int limit; int counted_bars=IndicatorCounted(); //---- check for possible errors if(counted_bars<0) return(-1); //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; //---- macd counted in the 1-st buffer for(int i=0; i<limit; i++) { ind_buffer4[i]=iMA(NULL,Timeframe,FastMA,0,MA_Method,Apply,i)-iMA(NULL,Timeframe,SlowMA,0,MA_Method,Apply,i); } //---- signal line counted in the 2-nd buffer for(i=0; i<limit; i++) { ind_buffer3[i]=iMAOnArray(ind_buffer4,Bars,SignalMA,0,SignalMA_Method,i); } //---- done //---- signal line counted in the 3-rd buffer for(i=0; i<limit; i++) { ind_buffer1[i]=ind_buffer4[i]-ind_buffer3[i]; } for(i=0; i<limit-1; i++) { if (ind_buffer1[i]<ind_buffer1[i+1]) ind_buffer2[i]=ind_buffer1[i]; else ind_buffer2[i]=0; } //---- done return(0); }

  • MT4 スローストキャスティクスについて

    下記MT4のスローストキャスティクスのプログラムなのですが、クロスした際にサウンドを鳴らすには、 どのようにプログラムを変えたら良いのでしょうか?どなたか詳しい方、ご教授願います。 詳しい方からすれば、なんてことないことなのですが、全くの初心者で困っています。 どなたか、どうぞよろしくお願いします。 #property copyright "Copyright ?2004, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" #property indicator_separate_window #property indicator_minimum 0 #property indicator_maximum 100 #property indicator_buffers 2 #property indicator_color1 LightSeaGreen #property indicator_color2 Red //---- input parameters extern int KPeriod=42; extern int DPeriod=3; extern int Slowing=3; //---- buffers double KBuffer[]; double DBuffer[]; double MainBuffer[]; double SignalBuffer[]; double HighesBuffer[]; double LowesBuffer[]; //---- int draw_begin1=0; int draw_begin2=0; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { string short_name; //---- 2 additional buffers are used for counting. IndicatorBuffers(6); SetIndexBuffer(2, HighesBuffer); SetIndexBuffer(3, LowesBuffer); SetIndexBuffer(4, MainBuffer); SetIndexBuffer(5, SignalBuffer); //---- indicator lines SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0, KBuffer); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1, DBuffer); //---- name for DataWindow and indicator subwindow label short_name="SlowKD("+KPeriod+","+DPeriod+","+Slowing+")"; IndicatorShortName(short_name); SetIndexLabel(4,short_name); SetIndexLabel(5,"Signal"); //---- draw_begin1=KPeriod+Slowing; draw_begin2=draw_begin1+DPeriod; SetIndexDrawBegin(0,draw_begin1); SetIndexDrawBegin(1,draw_begin2); //---- return(0); } //+------------------------------------------------------------------+ //| Stochastic oscillator | //+------------------------------------------------------------------+ int start() { int i,k; int counted_bars=IndicatorCounted(); double price; //---- if(Bars<=draw_begin2) return(0); //---- initial zero if(counted_bars<1) { for(i=1;i<=draw_begin1;i++) MainBuffer[Bars-i]=0; for(i=1;i<=draw_begin2;i++) SignalBuffer[Bars-i]=0; } //---- minimums counting i=Bars-KPeriod; if(counted_bars>KPeriod) i=Bars-counted_bars-1; while(i>=0) { double min=1000000; k=i+KPeriod-1; while(k>=i) { price=Low[k]; if(min>price) min=price; k--; } LowesBuffer[i]=min; i--; } //---- maximums counting i=Bars-KPeriod; if(counted_bars>KPeriod) i=Bars-counted_bars-1; while(i>=0) { double max=-1000000; k=i+KPeriod-1; while(k>=i) { price=High[k]; if(max<price) max=price; k--; } HighesBuffer[i]=max; i--; } //---- %K line i=Bars-draw_begin1; if(counted_bars>draw_begin1) i=Bars-counted_bars-1; while(i>=0) { double sumlow=0.0; double sumhigh=0.0; for(k=(i+Slowing-1);k>=i;k--) { sumlow+=Close[k]-LowesBuffer[k]; sumhigh+=HighesBuffer[k]-LowesBuffer[k]; } if(sumhigh==0.0) MainBuffer[i]=100.0; else MainBuffer[i]=sumlow/sumhigh*100; i--; } //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; int limit=Bars-counted_bars; //---- signal line is simple movimg average for(i=0; i<limit; i++) KBuffer[i]=iMAOnArray(MainBuffer,Bars,Slowing,0,MODE_SMA,i); for(i=0; i<limit; i++) DBuffer[i]=iMAOnArray(KBuffer,Bars,DPeriod,0,MODE_SMA,i); //---- return(0); } //+------------------------------------------------------------------+