任何菜鸟问题,为了不给论坛添乱。专业人士,不要路过。没有你就无处可去 - 6. - 页 644

 
tara:
没有。

你回答'十'会更有用!以防你不知道!
[删除]  
Got:

解释一下我哪里错了,它没有在市场观察中找到这个工具。

试着在i>=0 的条件中也加上"="。

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

点击 "图表",在 "属性 "的底部,在左上方取消勾选 "顶部的图表"!总的来说,多使用它,它将会派上用场!

谢谢你!它起作用了。
 

调试器不工作 - 怎么了?

Metatrader bild 646, editor bild 934。这里有一个最简单的指标。


我在欧元兑美元 上运行,M1,这是我得到的结果。

1

也就是说,一切都像它应该的那样。

现在我在Alert 之前做一个断点,并运行调试器。

USDCHF,H1 图表出现。它是从哪里来的?我只有EURUSD ,M1 开放。

我正在运行它,这是我看到的情况。

也就是说,该指标正是从这个USDCHF,H1 中获取数据。这里有什么问题呢?

第二个问题:编辑器没有把写好的脚本放在Scripts 文件夹里,而是放在MQL4 文件夹里,并把编译好的文件也放在那里。我必须手动拖放源代码到Scripts 文件夹,然后编译,脚本才会出现在Navigator中。我在使用指标时没有这种错误,它们会立即进入它们的文件夹。 是我做错了什么,还是编辑器出了错?

第三个问题。我仍然有646张图片,尽管论坛上有人在5月时就说过650张左右。此后真的没有更新,还是我又出了什么问题?

祝愿回答我的人好运。

 
谢谢你的运气!但只回答了第三个问题!我也有一个646的图片,直到服务器将我们升级到一个较新的图片。当我在休息后打开它时就会发生这种情况。我在会议开始前每周做一次。也祝您好运!
 

如何在指标中加入SendMail和Alert,使其在重新计算指标值时对旧信号没有反应,而只对新信号显示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的变化、跳跃的地方或尖锐的声音),它重新显示警报,并试图通过邮件向所有箭头发送相同的信息,从图表的开始 到当前的箭头。

此外还有一个问题--日志中的邮件被标记为"邮件:'测试信息'已发送",但没有一个字母落入箱中(())。

 
evillive:

我如何在指标中写入SendMail和Alert,使其在重新计算指标值时不对旧信号作出反应,而只对新信号显示Alert和发送邮件?

如果它是这样的。

然后,在对指标的任何影响下(在图表上安装、设置、改变TF、跳转位置或尖锐的声音),它再次显示警报,并试图通过邮件将它们发送到所有箭头,从图表的开始到当前的箭头。

另外的问题是--日志中的邮件被标记为"邮件:'测试信息'已发送",但没有一个字母落入盒子里(()。


我本可以这样做

//+------------------------------------------------------------------+
//|                                                       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:


我本可以这样做

增加的线 应该是在循环之外,还是打错了?
好的,我知道了,应该是这样的。
 

你好,有没有人有一个平均分配职位的模板。

也就是说,如果一个订单开了,而且是亏损的,那么在同一方向开了第二个订单,我们在这些订单中间放一个止损,以此类推,三个订单,四个...?

 
Top2n:

你好,有没有人有一个平均分配职位的模板。

也就是说,如果一个订单开了,而且是亏损的,那么在同一方向开了第二个订单,我们在这些订单中间放一个止损,以此类推,三个订单,四个...?


取所有开盘价 并计算算术平均数