初学者的问题 MQL5 MT5 MetaTrader 5 - 页 654

 
pako:

下层分形的条数是已知的

从中,在循环中搜索与已知分形的低点相对应的第一个高点

这可以做到,但我要做的是反过来。即首先找到前一根(形成的)蜡烛的高点,然后再找到最后一根分形的下跌。如果它们是一样的,就加一个点。
 
Alexey Kozitsyn:
我们可以这样做,但我要做的是相反。也就是说,首先我们要找到前一根(形成的)蜡烛的高点,然后是最后一根分形的下跌。如果它们重合,我们就加一个点。

我不明白。我以为这就是我们在做的条件。

if( High[i+1]==Low[isFractalDn()])//максимум первой свечи равен первому фракталу Dn
应该怎么写呢?
 
Vladimir Karputov:
从MQL5.community输入LOGIN和PASSWORD。
究竟哪里有一条线
附加的文件:
 
Ласло Подобедов:
究竟哪里有一条线呢?
对不起,被终端机搞糊涂了。当然,你只需要输入MQL5.community的LOGIN即可。
 
Vladimir Karputov:
对不起,被终端机搞糊涂了。当然,你只需要输入MQL5.community的LOGIN即可。
谢谢你,但它没有显示任何生命迹象......也许我做错了什么?
附加的文件:
 
mila.com:

我不明白。我以为这就是我们在做的条件。

if( High[i+1]==Low[isFractalDn()])//максимум первой свечи равен первому фракталу Dn
你是怎么写下来的呢?

轻松...这样做...

#property copyright "Tapochun"
#property link      "https://www.mql5.com/ru/users/tapochun"
#property version   "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_plots 2
//---
#property indicator_type1 DRAW_ARROW
#property indicator_width1 5
#property indicator_color1 clrAqua
#property indicator_type2 DRAW_ARROW
#property indicator_width2 5
#property indicator_color2 clrRed
//+------------------------------------------------------------------+
//| Глобальные переменные                                                                                                                       |
//+------------------------------------------------------------------+
double bufSell[];
double bufBuy[];
//+------------------------------------------------------------------+
//| Входные параметры                                                                                                                           |
//+------------------------------------------------------------------+
input int inpNum=50;    // Количество свечей для поиска последнего фрактала
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
   SetIndexBuffer(0,bufBuy);
   SetIndexBuffer(1,bufSell);
   SetIndexEmptyValue(0,EMPTY_VALUE);
   SetIndexEmptyValue(1,EMPTY_VALUE);
   SetIndexArrow(0,225);
   SetIndexArrow(1,226);
   IndicatorDigits(_Digits);
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
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[])
  {
   if(rates_total<=0 || prev_calculated<0)
      return( 0 );
//---
   if(prev_calculated>0) // Если не первый расчет индикатора
     {

     }
   else                         // Если первый расчет индикатора
     {
      ArrayInitialize(bufBuy,EMPTY_VALUE);
      ArrayInitialize(bufSell,EMPTY_VALUE);
      //---
      for(int i=1; i<rates_total-7; i++)
        {
         CheckBuyArrow(low[i],i,i+4,rates_total-3,time);
         CheckSellArrow(high[i],i,i+4,rates_total-3,time);
        }
     }
//---
   return(rates_total);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void CheckBuyArrow(const double price,
                   const int index,
                   const int first,
                   int last,
                   const datetime &time[]
                   )
  {
   last=(first+inpNum-1<last) ? first+inpNum-1 : last;
   double iPrice;
//---
   for(int i=first; i<=last; i++)
     {
      iPrice=iFractals(_Symbol,_Period,MODE_UPPER,i);
      if(iPrice!=EMPTY_VALUE)
        {
         if(price==iPrice)
           {
            bufBuy[index]=iPrice-10*_Point;
            Print(__FUNCTION__,": "+TimeToString(time[index])+" - "+TimeToString(time[i]));
           }
         return;
        }
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void CheckSellArrow(const double price,
                    const int index,
                    const int first,
                    int last,
                    const datetime &time[]
                    )
  {
   last=(first+inpNum-1<last) ? first+inpNum-1 : last;
   double iPrice;
//---
   for(int i=first; i<=last; i++)
     {
      iPrice=iFractals(_Symbol,_Period,MODE_LOWER,i);
      if(iPrice!=EMPTY_VALUE)
        {
         if(price==iPrice)
           {
            bufSell[index]=iPrice+10*_Point;
            Print(__FUNCTION__,": "+TimeToString(time[index])+" - "+TimeToString(time[i]));
           }
         return;
        }
     }
  }
//+------------------------------------------------------------------+
只是在指望故事。
 
Ласло Подобедов:
谢谢,但它没有显示任何生命迹象......也许我做错了什么?
可能有几种可能性。
  1. 你有一个32位的操作系统。在这种情况下,你是不允许去的。
  2. 时间很短--加入云需要两分钟。
  3. 可能的端口被防火墙关闭 - 需要查看代理日志。
 
Vladimir Karputov:
有几种选择是可能的。
  1. 你有一个32位的操作系统。在这种情况下,你是不允许去的。
  2. 时间并不长--加入云需要两分钟。
  3. 可能是端口被防火墙封锁了 - 你需要查看代理日志。
系统是x64的,因为我有8GB内存,操作系统是win 10,好的,谢谢你断开了防火墙,现在我将再次尝试!
 
Ласло Подобедов:
系统是x64的,因为我有8GB内存,系统是win 10,好的,谢谢你断开了防火墙,现在再试一次!
你知道如何找到TCP端口吗?我刚刚下载了metatester单独的...
 
mila.com:

我不明白。我以为这就是我们在做的条件。

if( High[i+1]==Low[isFractalDn()])//максимум первой свечи равен первому фракталу Dn
你是怎么写下来的呢?
看看盒子里的东西。