どんな新人の質問でも、フォーラムを乱雑にしないように。プロフェッショナルは、通り過ぎないでください。Nowhere without you - 6. - ページ 644

 
tara:
いいえ。

10』と答えてくれた方が助かる!万が一、そうでない場合は!?
削除済み  
Got:

私が間違っている場所を説明してください、それはマーケットウォッチでツールを見つけることができません。

i>=0 の条件にも "=" を入れてみてください。

for(int i=SymbolsTotal(true)-1; i>=0; i--){
 
borilunad:

プロパティの一番下にある「チャート」をクリックし、左上の「上部にあるチャート」のチェックを外してください!。そして、一般的には、もっと使ってください!重宝しますよ。

ありがとうございます!うまくいきました。
 

デバッガが動作しない - 何が問題なのか?

メタトレーダー ビルド 646、エディター ビルド 934。ここでは、最もシンプルなインジケーターを紹介します。


EURUSD,M 1で実行すると、このようになります。

1

つまり、すべてがあるべき姿なのです。

そして、今度はAlertの 前にブレークポイントを作って、Debuggerを実行します。

USDCHF,H1 チャートが表示されます。それはどこから来るのか?EURUSD ,M1のみ オープンです。

実行してみると、こんな感じです。

つまり、このUSDCHF,H 1から正確にデータを取得するインジケーターです。ここで何が問題なのか?

2つ目の質問ですが、Editorは書き込んだスクリプトをScripts フォルダーではなく、MQL4 フォルダーに置き、コンパイルしたファイルもそこに置くのですが、これはどうすればよいのでしょうか?ソースコードを手動でScripts フォルダにドラッグ&ドロップし、コンパイルして初めてNavigatorにスクリプトが表示されるのです。インジケーターではそのようなバグはなく、即座にフォルダに移動します。 私のやり方が悪いのか、Editorがミスしているのか?

3つ目の質問です。5月にフォーラムで650位と言われたのに、まだ646のBildを持っています。本当にあれから更新がないのか、また私が何か勘違いしているのか?

答えてくれる人に幸あれ。

 
幸運をありがとうございますでも、3つ目の質問にしか答えられない!?私もサーバーが新しいものにアップグレードされるまでは646のビルドを持っています。休んでから電源を入れるとこうなる。週に一度、セッションが始まる前にやっています。こちらこそ、よろしくお願いします。
 

インジケーターの値を再計算する際に、古いシグナルには反応せず、新しいシグナルに対してのみAlertを表示し、メールを送信するように、SendMailとAlertをインジケーターに組み込むにはどうしたらよいでしょうか?

このようになれば

//+------------------------------------------------------------------+
//|                                                       simple.mq4 |
//|                                                         evillive |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "evillive"
#property link      ""
#property version   "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Magenta
#property indicator_color2 Aqua

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
double Up[];
double Down[];
extern int period = 2;
extern int method = 1;
extern int price = 0;
extern int shift = 4;
extern string _alerts_="alerts section";
input bool alert=false;//show alert
input bool mail=false;//send mail
input bool not=false;//send push notification
//////////////////

      string dir="";
      datetime tim=0;

int OnInit()
  {

   SetIndexStyle(0, DRAW_ARROW, EMPTY,3);
   SetIndexArrow(0, 176);
   SetIndexBuffer(0, Up);
   SetIndexStyle(1, DRAW_ARROW, EMPTY,3);
   SetIndexArrow(1, 176);
   SetIndexBuffer(1, Down);
   SetIndexLabel(0,"BUY!");
   SetIndexLabel(1,"SELL!");

   return(INIT_SUCCEEDED);
  }

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---
   int i,limit;
   double ma0,ma1,atr;
//---
      if(rates_total<=(period+shift))
      return(0);
//--- counting from 0 to rates_total
//--- initial zero
   if(prev_calculated<1)
     {
      for(i=0; i<=rates_total-(period+shift); i++)
        {
         Up[i]=0.0;
         Down[i]=0.0;
        }
     }
//--- starting calculation
   if(prev_calculated>0)
      limit=rates_total-prev_calculated; //period+shift;
   else
      limit=rates_total-(period+shift);

   for(i = 1; i < limit; i++)
  {
      ma0 = iMA(NULL,0,period,0,method,price,i);
      ma1 = iMA(NULL,0,period,0,method,price,i+shift);
      atr = iATR(NULL,0,period,i);
      if(ma0>ma1 && Close[i]<Close[i+shift] && Close[i]>Close[i+period+shift])
        {
            Up[i] = (Close[i]+Open[i])/2;
            dir="up";
            tim=Time[i];
            alerts(dir,tim);
        }
      if(ma0<ma1 && Close[i]>Close[i+shift] && Close[i]<Close[i+period+shift])
        {   
            Down[i] = (Close[i]+Open[i])/2;
            dir="down";
            tim=Time[i];
            alerts(dir,tim);
        }
  }
   return(rates_total);
  }
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
void alerts(string d, datetime t)
{
if(!IsTesting() && (TimeLocal()-t)>60)
{
if(alert==true) Alert("New ",d," arrow");
if(mail==true) SendMail("New signal",StringConcatenate("A new ",d, "signal detected by indicator"));
if(not==true) SendNotification(StringConcatenate("A new ",d, "signal detected by indicator"));
}
return;
}

で、インジケータに何らかの影響(チャート上の設定、設定、TFの変更、場所のジャンプ、鋭い音)があると、アラートを再表示し、チャートの初めから 現在のものまで、すべての矢印に同じメールを送信しようとします。

おまけの質問 - ログに「Mail: 'Test message' has been sent」と表示されているのに、箱に1文字も落ちていない((((;゚Д゚))))ガクガクブルブル

 
evillive:

インジケーターの値を再計算する際に、古いシグナルには反応せず、新しいシグナルに対してのみアラートを表示し、メールを送信するようにするには、インジケーターにSendMailとAlertをどのように記述すればよいでしょうか。

このようになれば

その後、インジケータに何らかの影響(チャートへの設置、設定、TFの変更、場所のジャンプ、鋭い音)があると、再びアラートを表示し、チャートの始まりから現在のものまで、すべての矢印にメールで送信しようとします。

おまけの質問 - ログに「Mail: 'Test message' has been sent」と表示されているのに、箱に1文字も落ちていない(((.


私ならそうする

//+------------------------------------------------------------------+
//|                                                       simple.mq4 |
//|                                                         evillive |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "evillive"
#property link      ""
#property version   "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Magenta
#property indicator_color2 Aqua

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
double Up[];
double Down[];
extern int period = 2;
extern int method = 1;
extern int price = 0;
extern int shift = 4;
extern string _alerts_="alerts section";
input bool alert=false;//show alert
input bool mail=false;//send mail
input bool not=false;//send push notification
                     //////////////////

char dir=0;
datetime tim=0;
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int OnInit()
  {

   SetIndexStyle(0,DRAW_ARROW,EMPTY,3);
   SetIndexArrow(0,176);
   SetIndexBuffer(0,Up);
   SetIndexStyle(1,DRAW_ARROW,EMPTY,3);
   SetIndexArrow(1,176);
   SetIndexBuffer(1,Down);
   SetIndexLabel(0,"BUY!");
   SetIndexLabel(1,"SELL!");

   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---
   int i,limit;
   double ma0,ma1,atr;
//---
   if(rates_total<=(period+shift))
      return(0);
//--- counting from 0 to rates_total
//--- initial zero
   if(prev_calculated<1)
     {
      for(i=0; i<=rates_total-(period+shift); i++)
        {
         Up[i]=0.0;
         Down[i]=0.0;
        }
     }
//--- starting calculation
   if(prev_calculated>0)
      limit=rates_total-prev_calculated-1; //period+shift;
   else
      limit=rates_total-(period+shift)-1;

   for(i=limit; i>=0; i--)
     {
      ma0 = iMA(NULL,0,period,0,method,price,i);
      ma1 = iMA(NULL,0,period,0,method,price,i+shift);
      atr = iATR(NULL,0,period,i);
      if(ma0>ma1 && Close[i]<Close[i+shift] && Close[i]>Close[i+period+shift])
        {
         Up[i]=(Close[i]+Open[i])/2;
        }
      if(ma0<ma1 && Close[i]>Close[i+shift] && Close[i]<Close[i+period+shift])
        {
         Down[i]=(Close[i]+Open[i])/2;
        }
     }
      if(ma0>ma1 && Close[0]<Close[shift] && Close[0]>Close[period+shift])
        {
         if (dir!=1) {
            dir=1;
            alerts("UP",Time[0]);
         }
        }
      if(ma0<ma1 && Close[i]>Close[i+shift] && Close[i]<Close[i+period+shift])
        {
         if (dir!=-1){
            dir=-1;
            alerts("DOWN",Time[0]);
         }
        }

   

   return(rates_total);
  }
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
void alerts(string d,datetime t)
  {
   if(!IsTesting() && (TimeLocal()-t)>60)
     {
      if(alert==true) Alert("New ",d," arrow");
      if(mail==true) SendMail("New signal",StringConcatenate("A new ",d,"signal detected by indicator"));
      if(not==true) SendNotification(StringConcatenate("A new ",d,"signal detected by indicator"));
     }
   return;
  }
//+------------------------------------------------------------------+
 
Vinin:


私ならそうする

追加された線は ループの外側にあるはずですが、それともタイプミスでしょうか?
なるほど、そういうことだったんですね。
 

こんにちは、どなたかポジションを平均化するためのテンプレートをお持ちの方はいらっしゃいませんか?

つまり、ある注文をオープンしてそれが負けていたら、同じ方向に2つ目の注文をオープンして、この注文の間にストップを置いて、3つの注文、4つの注文...といった具合でしょうか。

 
Top2n:

こんにちは、どなたかポジションを平均化するためのテンプレートをお持ちの方はいらっしゃいませんか?

つまり、ある注文をオープンしてそれが負けていたら、同じ方向に2つ目の注文をオープンして、この注文の間にストップを置いて、3つの注文、4つの注文...といった具合でしょうか。


すべての建値を取って 算術平均を計算する