错误、漏洞、问题 - 页 2504

 
Francuz:
人们,分享一些信息。你用对齐的方法做什么?

这是 以浣熊为导向的编程!

唉,没有它是不行的;)

 
Igor Makanu:

这是 以浣熊为导向的编程!

唉,没有它是不行的;)

我很清楚这一点。我不是要你教我OOP的知识。我问的是谁在什么情况下使用排列组合。

 
Francuz:
人们,你能分享一些信息吗?你用对齐的方法做什么?

在多线程环境中,这一切都很方便,我是这样看的。MKL与此有什么关系?我不知道,这个问题被问到了,所以我被卡住了。

而总的来说--这些都是基础知识,对于任何像样的程序员来说,基本的理解是必要的。

ZS:嗯,这里有很多速度狂人,如果他们开始智能地调整一切,他们应该飞得更快,至少在理论上。
 
Francuz:
人们,分享一些信息。你用对齐的方法做什么?
在将结构转移到外部库时,这可能是必要的。
 

Vict:

ZS:这里有很多速度爱好者,如果他们开始弄好了,至少在理论上应该走得更快。


一般来说,我甚至没有想到。

#define  WRONG_ALIGNED
#define  CACHE_LINE_SIZE 64

struct Data {
#ifdef  WRONG_ALIGNED
   short bad_pad;
#endif
   uint ar[CACHE_LINE_SIZE/sizeof(int)];
};

#import "msvcrt.dll"
  long memcpy(Data &, Data &, long);
#import
#define  getaddr(x) memcpy(x, x, 0)

void OnStart()
{
   Data data[32768];
   if (getaddr(data[0])%4 != 0) {
      Alert("error");
      return;
   }
   ZeroMemory(data);
   int index = int(CACHE_LINE_SIZE - getaddr(data[0]) % CACHE_LINE_SIZE) / sizeof(int) - 1;
   
   srand(GetTickCount());
   
   ulong start_time = GetMicrosecondCount();
   for(unsigned i = 0; i < 10000; ++ i) {
      int rndnum = rand();
      while (++rndnum < 32768)
         for (int j = ArraySize(data[rndnum].ar)-1; j >= 0;  -- j)
            ++ data[rndnum].ar[j];
   }
      
   Alert(GetMicrosecondCount() - start_time);
   
   for (int j = ArraySize(data[100].ar)-1; j >= 0;  -- j)
      Print(data[100].ar[j]);
}
/*
WRONG_ALIGNED:
6117940
6104068
6047416

RIGHT_ALIGNED
3341823
2565150
2565150
*/

这段代码有点过于复杂--我试着把那个不适合缓存行的元素直接撞上去,但是失败了(如果我想的话可能可以做到,但是我觉得很无聊),而且我没有对代码做太多改动。但这更让人印象深刻--16次折叠中只有一次是在不属于缓存线的元素上进行的,但它给出了合理的结果。

SZY:在这种情况下,更客观的做法是通过插入两个短的来做RIGHT_ALIGNED,而不是删除唯一的(所以我们在两种情况下都会实现缓存线的两次更新)。速度的提升会比较小,但仍然是1.5倍左右。

 

顺便说一下,在mql中,pack的默认值是1,有点像。

从以前的帖子来看,也许对所有结构和类明确规定8是有意义的。

 

我无法克服这个错误。

我从Metatrader的交付中提取了 "之 "字形,以证明这个错误。在代码中增加了额外的缓冲区,取自我的程序。在这段代码中没有打算用额外的缓冲区进行操作。他们只是为了证明这个错误。

在欧元兑美元的H1时间框架上绘制了这个之字形图。关闭终端。从历史上删除了所有生成的欧元兑美元的时间序列。也就是说,删除了欧元兑美元货币对的所有*.hcc和*.hc文件。这样做是为了确保加载.hcc文件和从一个干净的表单中生成.hc文件。

终端启动 后,你会在欧元兑美元的图表上看到很多人工痕迹。这些神器是无法处理的。

我把修改后的 "之 "字形代码以文本和文件的形式附上。

我想提醒你,"之 "字形的参数是通过#propert指定的。

所有其他的缓冲区都不是通过#propert设置的,因为所有的东西,包括zigzags缓冲区,都是动态变化的。

//+------------------------------------------------------------------+
//|                                                       ZigZag.mq5 |
//|                   Copyright 2009-2017, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "2009-2017, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"
#property indicator_chart_window
#property indicator_buffers 29
#property indicator_plots 17
//---- plot Zigzag

#property  indicator_label17  "Zigzag"
#property  indicator_type17   DRAW_SECTION
#property  indicator_color17  Red
#property  indicator_style17  STYLE_SOLID
#property  indicator_width17  1

//--- input parameters
input int      ExtDepth=12;
input int      ExtDeviation=5;
input int      ExtBackstep=3;
//--- indicator buffers
double         ZigzagBuffer[];      // main buffer
double         HighMapBuffer[];     // highs
double         LowMapBuffer[];      // lows
int            level=3;             // recounting depth
double         deviation;           // deviation in points

double Hmzz1[],      Hmzz2[],  Hmzz3[], Hmzz4[],     Hmzz5[],   Hmzz6[], Hmzz7[], Hmzz8[],      Hmzz9[],  Hmzz10[];
double Lmzz1[],      Lmzz2[],  Lmzz3[], Lmzz4[],     Lmzz5[],   Lmzz6[], Lmzz7[], Lmzz8[],      Lmzz9[],  Lmzz10[];
double nen_ZigZagL[], nen_ZigZagH[];
double ha[], la[], ham[], lam[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping

   SetIndexBuffer(0,Lmzz1,INDICATOR_DATA);   // Plot = 0
   SetIndexBuffer(1,Hmzz1,INDICATOR_DATA);
   SetIndexBuffer(2,Lmzz2,INDICATOR_DATA);   // Plot = 1
   SetIndexBuffer(3,Hmzz2,INDICATOR_DATA);
   SetIndexBuffer(4,Lmzz3,INDICATOR_DATA);   // Plot = 2
   SetIndexBuffer(5,Hmzz3,INDICATOR_DATA);
   SetIndexBuffer(6,Lmzz4,INDICATOR_DATA);   // Plot = 3
   SetIndexBuffer(7,Hmzz4,INDICATOR_DATA);
   SetIndexBuffer(8,Lmzz5,INDICATOR_DATA);   // Plot = 4
   SetIndexBuffer(9,Hmzz5,INDICATOR_DATA);
   SetIndexBuffer(10,Lmzz6,INDICATOR_DATA);   // Plot = 5
   SetIndexBuffer(11,Hmzz6,INDICATOR_DATA);
   SetIndexBuffer(12,Lmzz7,INDICATOR_DATA);   // Plot = 6
   SetIndexBuffer(13,Hmzz7,INDICATOR_DATA);
   SetIndexBuffer(14,Lmzz8,INDICATOR_DATA);   // Plot = 7
   SetIndexBuffer(15,Hmzz8,INDICATOR_DATA);
   SetIndexBuffer(16,Lmzz9,INDICATOR_DATA);   // Plot = 8
   SetIndexBuffer(17,Hmzz9,INDICATOR_DATA);
   SetIndexBuffer(18,Lmzz10,INDICATOR_DATA);   // Plot = 9
   SetIndexBuffer(19,Hmzz10,INDICATOR_DATA);
   
   PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,0.0);
   PlotIndexSetDouble(1,PLOT_EMPTY_VALUE,0.0);
   PlotIndexSetDouble(2,PLOT_EMPTY_VALUE,0.0);
   PlotIndexSetDouble(3,PLOT_EMPTY_VALUE,0.0);
   PlotIndexSetDouble(4,PLOT_EMPTY_VALUE,0.0);
   PlotIndexSetDouble(5,PLOT_EMPTY_VALUE,0.0);
   PlotIndexSetDouble(6,PLOT_EMPTY_VALUE,0.0);
   PlotIndexSetDouble(7,PLOT_EMPTY_VALUE,0.0);
   PlotIndexSetDouble(8,PLOT_EMPTY_VALUE,0.0);
   PlotIndexSetDouble(9,PLOT_EMPTY_VALUE,0.0);

   ArraySetAsSeries(Lmzz1,true);
   ArraySetAsSeries(Hmzz1,true);
   ArraySetAsSeries(Lmzz2,true);
   ArraySetAsSeries(Hmzz2,true);
   ArraySetAsSeries(Lmzz3,true);
   ArraySetAsSeries(Hmzz3,true);
   ArraySetAsSeries(Lmzz4,true);
   ArraySetAsSeries(Hmzz4,true);   
   ArraySetAsSeries(Lmzz5,true);
   ArraySetAsSeries(Hmzz5,true);
   ArraySetAsSeries(Lmzz6,true);
   ArraySetAsSeries(Hmzz6,true);
   ArraySetAsSeries(Lmzz7,true);
   ArraySetAsSeries(Hmzz7,true);
   ArraySetAsSeries(Lmzz8,true);
   ArraySetAsSeries(Hmzz8,true);
   ArraySetAsSeries(Lmzz9,true);
   ArraySetAsSeries(Hmzz9,true);
   ArraySetAsSeries(Lmzz10,true);
   ArraySetAsSeries(Hmzz10,true);
   ArraySetAsSeries(nen_ZigZagH,true);
   ArraySetAsSeries(nen_ZigZagL,true);
   ArraySetAsSeries(ham,true);
   ArraySetAsSeries(lam,true);
   ArraySetAsSeries(ha,true);
   ArraySetAsSeries(la,true);

   PlotIndexSetInteger(0,PLOT_DRAW_TYPE,DRAW_ZIGZAG); 
   PlotIndexSetInteger(1,PLOT_DRAW_TYPE,DRAW_ZIGZAG);
   PlotIndexSetInteger(2,PLOT_DRAW_TYPE,DRAW_ZIGZAG); 
   PlotIndexSetInteger(3,PLOT_DRAW_TYPE,DRAW_ZIGZAG); 
   PlotIndexSetInteger(4,PLOT_DRAW_TYPE,DRAW_ZIGZAG);
   PlotIndexSetInteger(5,PLOT_DRAW_TYPE,DRAW_ZIGZAG); 
   PlotIndexSetInteger(6,PLOT_DRAW_TYPE,DRAW_ZIGZAG);
   PlotIndexSetInteger(7,PLOT_DRAW_TYPE,DRAW_ZIGZAG); 
   PlotIndexSetInteger(8,PLOT_DRAW_TYPE,DRAW_ZIGZAG);
   PlotIndexSetInteger(9,PLOT_DRAW_TYPE,DRAW_ZIGZAG);

   PlotIndexSetInteger(0,PLOT_LINE_STYLE,STYLE_SOLID);
   PlotIndexSetInteger(1,PLOT_LINE_STYLE,STYLE_SOLID);
   PlotIndexSetInteger(2,PLOT_LINE_STYLE,STYLE_SOLID);
   PlotIndexSetInteger(3,PLOT_LINE_STYLE,STYLE_SOLID);
   PlotIndexSetInteger(4,PLOT_LINE_STYLE,STYLE_SOLID);
   PlotIndexSetInteger(5,PLOT_LINE_STYLE,STYLE_SOLID);
   PlotIndexSetInteger(6,PLOT_LINE_STYLE,STYLE_SOLID);
   PlotIndexSetInteger(7,PLOT_LINE_STYLE,STYLE_SOLID);
   PlotIndexSetInteger(8,PLOT_LINE_STYLE,STYLE_SOLID);
   PlotIndexSetInteger(9,PLOT_LINE_STYLE,STYLE_SOLID);

   PlotIndexSetInteger(0,PLOT_LINE_COLOR, clrDarkOrange);
   PlotIndexSetInteger(1,PLOT_LINE_COLOR, clrRoyalBlue);
   PlotIndexSetInteger(2,PLOT_LINE_COLOR, clrForestGreen);
   PlotIndexSetInteger(3,PLOT_LINE_COLOR, clrSienna);
   PlotIndexSetInteger(4,PLOT_LINE_COLOR, clrDodgerBlue);
   PlotIndexSetInteger(5,PLOT_LINE_COLOR, clrGreen);
   PlotIndexSetInteger(6,PLOT_LINE_COLOR, clrBrown);
   PlotIndexSetInteger(7,PLOT_LINE_COLOR, clrMediumBlue);
   PlotIndexSetInteger(8,PLOT_LINE_COLOR, clrTeal);
   PlotIndexSetInteger(9,PLOT_LINE_COLOR, clrMaroon);

   PlotIndexSetInteger(0,PLOT_LINE_WIDTH, 0);
   PlotIndexSetInteger(1,PLOT_LINE_WIDTH, 0);
   PlotIndexSetInteger(2,PLOT_LINE_WIDTH, 0);
   PlotIndexSetInteger(3,PLOT_LINE_WIDTH, 0);
   PlotIndexSetInteger(4,PLOT_LINE_WIDTH, 0);
   PlotIndexSetInteger(5,PLOT_LINE_WIDTH, 0);
   PlotIndexSetInteger(6,PLOT_LINE_WIDTH, 0);
   PlotIndexSetInteger(7,PLOT_LINE_WIDTH, 0);
   PlotIndexSetInteger(8,PLOT_LINE_WIDTH, 0);
   PlotIndexSetInteger(9,PLOT_LINE_WIDTH, 0);

   SetIndexBuffer(20,nen_ZigZagH,INDICATOR_DATA);   // Plot = 10
   SetIndexBuffer(21,nen_ZigZagL,INDICATOR_DATA);   // Plot = 11
   PlotIndexSetInteger(10,PLOT_DRAW_TYPE,DRAW_ARROW); 
   PlotIndexSetInteger(10, PLOT_ARROW, 159); 
   PlotIndexSetInteger(10,PLOT_LINE_STYLE, STYLE_SOLID);
   PlotIndexSetInteger(10,PLOT_LINE_WIDTH, 0);
   PlotIndexSetInteger(10,PLOT_LINE_COLOR, clrMagenta);
   PlotIndexSetInteger(11,PLOT_DRAW_TYPE,DRAW_ARROW); 
   PlotIndexSetInteger(11, PLOT_ARROW, 159); 
   PlotIndexSetInteger(11,PLOT_LINE_STYLE, STYLE_SOLID);
   PlotIndexSetInteger(11,PLOT_LINE_WIDTH, 0);
   PlotIndexSetInteger(11,PLOT_LINE_COLOR, clrMagenta);

   SetIndexBuffer(22,ham,INDICATOR_DATA);   // Plot = 12
   SetIndexBuffer(23,lam,INDICATOR_DATA);   // Plot = 13
   PlotIndexSetInteger(12,PLOT_DRAW_TYPE,DRAW_LINE);
   PlotIndexSetInteger(12,PLOT_LINE_STYLE, STYLE_DOT);
   PlotIndexSetInteger(12,PLOT_LINE_WIDTH, 0);
   PlotIndexSetInteger(12,PLOT_LINE_COLOR, clrGreen);
   PlotIndexSetInteger(13,PLOT_DRAW_TYPE,DRAW_LINE);
   PlotIndexSetInteger(13,PLOT_LINE_STYLE, STYLE_DOT);
   PlotIndexSetInteger(13,PLOT_LINE_WIDTH, 0);
   PlotIndexSetInteger(13,PLOT_LINE_COLOR, clrOrange);

   SetIndexBuffer(24,ha,INDICATOR_DATA);   // Plot = 14
   SetIndexBuffer(25,la,INDICATOR_DATA);   // Plot = 15
   PlotIndexSetInteger(14,PLOT_DRAW_TYPE,DRAW_LINE);
   PlotIndexSetInteger(14,PLOT_LINE_STYLE, STYLE_DOT);
   PlotIndexSetInteger(14,PLOT_LINE_WIDTH, 0);
   PlotIndexSetInteger(14,PLOT_LINE_COLOR, clrGreen);
   PlotIndexSetInteger(15,PLOT_DRAW_TYPE,DRAW_LINE);
   PlotIndexSetInteger(15,PLOT_LINE_STYLE, STYLE_DOT);
   PlotIndexSetInteger(15,PLOT_LINE_WIDTH, 0);
   PlotIndexSetInteger(15,PLOT_LINE_COLOR, clrRed);

   SetIndexBuffer(26,ZigzagBuffer,INDICATOR_DATA);
   SetIndexBuffer(27,HighMapBuffer,INDICATOR_CALCULATIONS);
   SetIndexBuffer(28,LowMapBuffer,INDICATOR_CALCULATIONS);
   PlotIndexSetInteger(16,PLOT_DRAW_TYPE,DRAW_SECTION); 
   PlotIndexSetInteger(16,PLOT_LINE_STYLE, STYLE_SOLID);
   PlotIndexSetInteger(16,PLOT_LINE_WIDTH, 1);
   PlotIndexSetInteger(16,PLOT_LINE_COLOR, clrRed);

//--- set short name and digits   
   PlotIndexSetString(16,PLOT_LABEL,"ZigZag("+(string)ExtDepth+","+(string)ExtDeviation+","+(string)ExtBackstep+")");
   IndicatorSetInteger(INDICATOR_DIGITS,_Digits);
//--- set empty value
   PlotIndexSetDouble(16,PLOT_EMPTY_VALUE,0.0);
//--- to use in cycle
   deviation=ExtDeviation*_Point;
//---
   return(0);
  }
//+------------------------------------------------------------------+
//|  searching index of the highest bar                              |
//+------------------------------------------------------------------+
int iHighest(const double &array[],
             int depth,
             int startPos)
  {
   int index=startPos;
//--- start index validation
   if(startPos<0)
     {
      Print("Invalid parameter in the function iHighest, startPos =",startPos);
      return 0;
     }
   int size=ArraySize(array);
//--- depth correction if need
   if(startPos-depth<0) depth=startPos;
   double max=array[startPos];
//--- start searching
   for(int i=startPos;i>startPos-depth;i--)
     {
      if(array[i]>max)
        {
         index=i;
         max=array[i];
        }
     }
//--- return index of the highest bar
   return(index);
  }
//+------------------------------------------------------------------+
//|  searching index of the lowest bar                               |
//+------------------------------------------------------------------+
int iLowest(const double &array[],
            int depth,
            int startPos)
  {
   int index=startPos;
//--- start index validation
   if(startPos<0)
     {
      Print("Invalid parameter in the function iLowest, startPos =",startPos);
      return 0;
     }
   int size=ArraySize(array);
//--- depth correction if need
   if(startPos-depth<0) depth=startPos;
   double min=array[startPos];
//--- start searching
   for(int i=startPos;i>startPos-depth;i--)
     {
      if(array[i]<min)
        {
         index=i;
         min=array[i];
        }
     }
//--- return index of the lowest bar
   return(index);
  }
//+------------------------------------------------------------------+
//| 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[])
  {
   int i=0;
   int limit=0,counterZ=0,whatlookfor=0;
   int shift=0,back=0,lasthighpos=0,lastlowpos=0;
   double val=0,res=0;
   double curlow=0,curhigh=0,lasthigh=0,lastlow=0;
//--- auxiliary enumeration
   enum looling_for
     {
      Pike=1,  // searching for next high
      Sill=-1  // searching for next low
     };
//--- initializing
   if(prev_calculated==0)
     {
      ArrayInitialize(ZigzagBuffer,0.0);
      ArrayInitialize(HighMapBuffer,0.0);
      ArrayInitialize(LowMapBuffer,0.0);
     }
//--- 
   if(rates_total<100) return(0);
//--- set start position for calculations
   if(prev_calculated==0) limit=ExtDepth;

//--- ZigZag was already counted before
   if(prev_calculated>0)
     {
      i=rates_total-1;
      //--- searching third extremum from the last uncompleted bar
      while(counterZ<level && i>rates_total-100)
        {
         res=ZigzagBuffer[i];
         if(res!=0) counterZ++;
         i--;
        }
      i++;
      limit=i;

      //--- what type of exremum we are going to find
      if(LowMapBuffer[i]!=0)
        {
         curlow=LowMapBuffer[i];
         whatlookfor=Pike;
        }
      else
        {
         curhigh=HighMapBuffer[i];
         whatlookfor=Sill;
        }
      //--- chipping
      for(i=limit+1;i<rates_total && !IsStopped();i++)
        {
         ZigzagBuffer[i]=0.0;
         LowMapBuffer[i]=0.0;
         HighMapBuffer[i]=0.0;
        }
     }

//--- searching High and Low
   for(shift=limit;shift<rates_total && !IsStopped();shift++)
     {
      val=low[iLowest(low,ExtDepth,shift)];
      if(val==lastlow) val=0.0;
      else
        {
         lastlow=val;
         if((low[shift]-val)>deviation) val=0.0;
         else
           {
            for(back=1;back<=ExtBackstep;back++)
              {
               res=LowMapBuffer[shift-back];
               if((res!=0) && (res>val)) LowMapBuffer[shift-back]=0.0;
              }
           }
        }
      if(low[shift]==val) LowMapBuffer[shift]=val; else LowMapBuffer[shift]=0.0;
      //--- high
      val=high[iHighest(high,ExtDepth,shift)];
      if(val==lasthigh) val=0.0;
      else
        {
         lasthigh=val;
         if((val-high[shift])>deviation) val=0.0;
         else
           {
            for(back=1;back<=ExtBackstep;back++)
              {
               res=HighMapBuffer[shift-back];
               if((res!=0) && (res<val)) HighMapBuffer[shift-back]=0.0;
              }
           }
        }
      if(high[shift]==val) HighMapBuffer[shift]=val; else HighMapBuffer[shift]=0.0;
     }

//--- last preparation
   if(whatlookfor==0)// uncertain quantity
     {
      lastlow=0;
      lasthigh=0;
     }
   else
     {
      lastlow=curlow;
      lasthigh=curhigh;
     }

//--- final rejection
   for(shift=limit;shift<rates_total && !IsStopped();shift++)
     {
      res=0.0;
      switch(whatlookfor)
        {
         case 0: // search for peak or lawn
            if(lastlow==0 && lasthigh==0)
              {
               if(HighMapBuffer[shift]!=0)
                 {
                  lasthigh=high[shift];
                  lasthighpos=shift;
                  whatlookfor=Sill;
                  ZigzagBuffer[shift]=lasthigh;
                  res=1;
                 }
               if(LowMapBuffer[shift]!=0)
                 {
                  lastlow=low[shift];
                  lastlowpos=shift;
                  whatlookfor=Pike;
                  ZigzagBuffer[shift]=lastlow;
                  res=1;
                 }
              }
            break;
         case Pike: // search for peak
            if(LowMapBuffer[shift]!=0.0 && LowMapBuffer[shift]<lastlow && HighMapBuffer[shift]==0.0)
              {
               ZigzagBuffer[lastlowpos]=0.0;
               lastlowpos=shift;
               lastlow=LowMapBuffer[shift];
               ZigzagBuffer[shift]=lastlow;
               res=1;
              }
            if(HighMapBuffer[shift]!=0.0 && LowMapBuffer[shift]==0.0)
              {
               lasthigh=HighMapBuffer[shift];
               lasthighpos=shift;
               ZigzagBuffer[shift]=lasthigh;
               whatlookfor=Sill;
               res=1;
              }
            break;
         case Sill: // search for lawn
            if(HighMapBuffer[shift]!=0.0 && HighMapBuffer[shift]>lasthigh && LowMapBuffer[shift]==0.0)
              {
               ZigzagBuffer[lasthighpos]=0.0;
               lasthighpos=shift;
               lasthigh=HighMapBuffer[shift];
               ZigzagBuffer[shift]=lasthigh;
              }
            if(LowMapBuffer[shift]!=0.0 && HighMapBuffer[shift]==0.0)
              {
               lastlow=LowMapBuffer[shift];
               lastlowpos=shift;
               ZigzagBuffer[shift]=lastlow;
               whatlookfor=Pike;
              }
            break;
         default: return(rates_total);
        }
     }

//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+

请帮助终端开发者修复这个错误。

有人工痕迹的图片。


Запуск платформы - Для продвинутых пользователей - MetaTrader 5
Запуск платформы - Для продвинутых пользователей - MetaTrader 5
  • www.metatrader5.com
По завершении установки в меню "Пуск" создается группа программ торговой платформы, а на рабочем столе дополнительно помещается ярлык программы. Используйте их для запуска. Нельзя запускать одновременно две копии платформы из одной директории. Чтобы одновременно запустить несколько копий, установите соответствующее количество программ в разные...
附加的文件:
ZigZag_test.mq5  17 kb
 
Eugeni Neumoin:

我无法克服这个错误。

我从Metatrader的交付中提取了 "之 "字形,以证明这个错误。在代码中增加了额外的缓冲区,取自我的程序。本代码中没有提供额外的缓冲区的操作。他们只是为了证明这个错误。

在欧元兑美元的H1时间框架上绘制了这个之字形图。关闭终端。从历史上删除了所有生成的欧元兑美元的时间序列。也就是说,删除了欧元兑美元货币对的所有*.hcc和*.hc文件。这样做是为了确保加载.hcc文件和从一个干净的表单中生成.hc文件。

终端启动 后,你会在欧元兑美元的图表上看到很多人工痕迹。这些神器是无法处理的。

我把修改后的 "之 "字形代码以文本和文件的形式附上。

我想提醒你,"之 "字形的参数是通过#propert指定的。

所有其他的缓冲区都不是通过#propert设置的,因为所有的东西,包括zigzags缓冲区,都是动态变化的。

请帮助终端开发者修复这个错误。

有人工痕迹的图片。


所有的缓冲区都需要被初始化。

如果缓冲区内没有酒吧的值,必须明确写入缓冲区。换句话说,如果计算值要输出到缓冲区,就把它写到缓冲区,否则就写一个空值。

 
Vict:

总的来说,我甚至没有想到会这样。

我自己的运行情况没有显示出明显的差异。


如果代替

使

   Data data[];
   
   ArrayResize(data, 32768);


有一个6倍的减速!

 
Artyom Trishkin:

所有的缓冲区都需要被初始化。

如果酒吧的缓冲区内没有值,必须明确地写入缓冲区内。也就是说,如果计算值应该输出到缓冲区,我们就把它写到缓冲区,否则就写空值。

对不起,我错过了初始化。我的程序里有这个东西,但在例子里漏掉了。

附上一个带有初始化的文件。其效果是一样的。

对开发商来说,问题依然存在。请修复这个错误。

-------------

在我看来,会发生以下情况。当与终端一起启动程序时,时间序列大小要么等于零,要么有一些最小值。

程序在现有的历史片段上被初始化。但是当时间序列的大小增加时,没有通过初始化的内存片段被用于缓冲区阵列。因此,我们有这样的效果。

我试图用终端的事件来处理这种效果。同样的,伪影出现的时间只有几分之一秒。而这并不是好事。这样的方案一定不会被释放。

下面是如何解决这个问题。在为缓冲区分配完内存后,你应该立即清除这部分内存。但我们如何才能做到这一点呢?我还没有在终端应用程序的开发者那边发现这样的功能。

附加的文件:
ZigZag_test.mq5  17 kb
原因: