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

 
Alexey Viktorov:

为了在测试器中显示?是的。创建一个包含所有你需要的指标的模板,并以EA名称或测试者名称保存它,测试将以这些设置打开。

在真实和模拟账户的图表上。

 

问候!

有没有人知道如何联系马克西姆-古特曼?

交易员,自动交易系统的开发者

 
odyn:

在真实和模拟账户的图表上。

以MACD为例,这里是指

所有其他的人都是一样的。

 

下午好,能否请您提供建议或给我一个链接,以查看

我需要从开放的职位中选择那些寿命超过一定期限的职位。

如何正确比较一个职位的开仓时间 和当前时间?

我扔了这个函数,接下来要做什么我想不出来(没什么经验),怎么比较时间?

//+------------------------------------------------------------------+
bool Selected_Positions_Time_Life(datetime time_life, int &array_base[][observations])
{
int n = 0;
int size = ArrayRange(array_base,0);

for(int i=0; i<size; i++)
{
   int index  = Arr_Position[i][0];
   int ticket = m_position.SelectByIndex(index);
   datetime tl = m_position.Time();
   datetime tc = TimeCurrent();
 //Вот тут наверное нужно сравнить tl и tc 
 //и если разница превышает time_life, то это наша позиция
}

return(n>0);
}
//+------------------------------------------------------------------+
 
Sergey Voytsekhovsky:

下午好,请告知或给我一个链接,看看

我需要从开放的职位中选择那些寿命超过一定期限的职位。

如何正确比较一个职位的开仓时间 和当前时间?

我已经创建了这个函数,但我不知道接下来该怎么做(缺乏经验),如何比较时间?

在循环中,选择一个位置并获得其票据。

ulong posTicket = PositionGetTicket(i);

接下来,得到开仓的时间

PositionGetInteger(POSITION_TIME)
并与参考时间±进行比较。
 
Alexey Viktorov:

选择循环中的一个位置,并为其开出罚单

然后得到位置的开放时间

并与参考时间±进行比较。

就这个比较程序抛出来,请大家用票的位置、开票时间 和服务器时间,我想我想明白了,我不能比较。我看了一下评论,我只是得到了日期。

 
Sergey Voytsekhovsky:

这正是比较的程序,请用仓票,开仓时间 和服务器时间,我想我想明白了,我不能比较。我看了一下评论,我只是得到了日期。

所以你要比较日期。但你必须考虑到这种差异。最好是用允许的偏差来比较开放时间和参考时间之间的差异。

fabs(время_позиции - эталонное_время) < допустимого_отклонения // например 600 секунд
 
Alexey Viktorov:

所以要比较一下日期。但你必须考虑到这种差异。最好是用公差偏差来比较开放时间和参考时间之间的差异。

阿列克谢-维克多罗夫

所以要比较一下日期。但你必须考虑到这种差异。最好是用公差来比较开放时间和参考时间之间的差异。

收到,谢谢,我一到电脑前就试试(我现在在手机上)。

 

下午好。

我想按时间对图表上的垂直线 进行排序。我写了一个小剧本。但结果却不是我想要的。

请告知我做错了什么。

void OnStart()
{
int      vlines            = 0;
string   vlines_name[];
string   vlines_name_sort[];
datetime tm[];

   vlines = ObjectsTotal(ChartID(),0,OBJ_VLINE);
   if(vlines < 20 * 2)
   {
      Print("вертикальных линий меньше необходимиого. (",vlines," < ",20 * 2,")");
      return;
   }
   ArrayResize(vlines_name,vlines);
   ArrayResize(vlines_name_sort,vlines);
   
   for(int i = 0; i < vlines; i++)
   {
      vlines_name[i] = ObjectName(ChartID(),i,0,OBJ_VLINE);
   }
   ArrayPrint(vlines_name);
   
   for(int i = 0, n = 0; i < 9000; i++)
   {
      ArrayFree(tm);
      CopyTime(Symbol(),Period(),i,1,tm);
      
      for(int a = 0; a < vlines - 1; a++)
      {
         datetime tml = (datetime)ObjectGetInteger(ChartID(),vlines_name[a],OBJPROP_TIME);
         if(tml == tm[0])
         {
            vlines_name_sort[n++] = vlines_name[a];
            break;
         }
      }
   }
   ArrayPrint(vlines_name_sort);
}

其结果是。

(GBPUSD,H6)     [ 0] "H6 Vertical Line 10771" "H6 Vertical Line 10884" "H6 Vertical Line 12743" "H6 Vertical Line 1371"  "H6 Vertical Line 14306"
(GBPUSD,H6)     [ 5] "H6 Vertical Line 16501" "H6 Vertical Line 17907" "H6 Vertical Line 20277" "H6 Vertical Line 23365" "H6 Vertical Line 28358"
(GBPUSD,H6)     [10] "H6 Vertical Line 28756" "H6 Vertical Line 29445" "H6 Vertical Line 30340" "H6 Vertical Line 31840" "H6 Vertical Line 32885"
(GBPUSD,H6)     [15] "H6 Vertical Line 33779" "H6 Vertical Line 34048" "H6 Vertical Line 38532" "H6 Vertical Line 38756" "H6 Vertical Line 39075"
(GBPUSD,H6)     [20] "H6 Vertical Line 39458" "H6 Vertical Line 39649" "H6 Vertical Line 40385" "H6 Vertical Line 41116" "H6 Vertical Line 4150" 
(GBPUSD,H6)     [25] "H6 Vertical Line 41900" "H6 Vertical Line 42820" "H6 Vertical Line 43071" "H6 Vertical Line 46245" "H6 Vertical Line 48196"
(GBPUSD,H6)     [30] "H6 Vertical Line 50258" "H6 Vertical Line 50374" "H6 Vertical Line 55171" "H6 Vertical Line 56003" "H6 Vertical Line 56400"
(GBPUSD,H6)     [35] "H6 Vertical Line 57565" "H6 Vertical Line 59075" "H6 Vertical Line 59881" "H6 Vertical Line 59969" "H6 Vertical Line 63122"
(GBPUSD,H6)     [40] "H6 Vertical Line 63540" "H6 Vertical Line 63904" "H6 Vertical Line 64359" "H6 Vertical Line 64420" "H6 Vertical Line 65200"
(GBPUSD,H6)     [45] "H6 Vertical Line 6695"  "H6 Vertical Line 7743"  "H6 Vertical Line 8707"  "H6 Vertical Line 9491"  "H6 Vertical Line 9662" 

(GBPUSD,H6)     [ 0] "H6 Vertical Line 46245" "H6 Vertical Line 39075" "H6 Vertical Line 40385" "H6 Vertical Line 55171" "H6 Vertical Line 31840"
(GBPUSD,H6)     [ 5] "H6 Vertical Line 63904" "H6 Vertical Line 6695"  "H6 Vertical Line 59075" "H6 Vertical Line 28358" "H6 Vertical Line 10884"
(GBPUSD,H6)     [10] "H6 Vertical Line 38532" "H6 Vertical Line 29445" "H6 Vertical Line 23365" "H6 Vertical Line 64420" "H6 Vertical Line 7743" 
(GBPUSD,H6)     [15] "H6 Vertical Line 30340" "H6 Vertical Line 39649" "H6 Vertical Line 38756" "H6 Vertical Line 34048" "H6 Vertical Line 42820"
(GBPUSD,H6)     [20] "H6 Vertical Line 64359" "H6 Vertical Line 50374" "H6 Vertical Line 14306" "H6 Vertical Line 48196" "H6 Vertical Line 57565"
(GBPUSD,H6)     [25] "H6 Vertical Line 20277" "H6 Vertical Line 41116" "H6 Vertical Line 12743" "H6 Vertical Line 50258" "H6 Vertical Line 41900"
(GBPUSD,H6)     [30] "H6 Vertical Line 17907" "H6 Vertical Line 4150"  "H6 Vertical Line 59881" "H6 Vertical Line 56400" "H6 Vertical Line 10771"
(GBPUSD,H6)     [35] "H6 Vertical Line 63540" "H6 Vertical Line 65200" "H6 Vertical Line 9491"  "H6 Vertical Line 16501" "H6 Vertical Line 63122"
(GBPUSD,H6)     [40] "H6 Vertical Line 32885" "H6 Vertical Line 1371"  "H6 Vertical Line 33779" null                     null                    
(GBPUSD,H6)     [45] null                     null                     null                     null                     null                    
 
Сергей Таболин:

下午好。

我想按时间对图表上的垂直线 进行排序。我写了一个小剧本。但结果却不是我想要的。

请告知我做错了什么。

其结果是。

从逻辑上讲,你首先需要把所有的行收集到一个数组中,我会立即做二维的,好了,还是数组结构,在第一维中加入创建的时间,在第二维中--行的名称。

在循环中进行一次运行,填充数组,在循环外填充数组后按第一维即时间进行排序。

结果在第二个循环中被打印出来。

因此,我们有2个周期,并在它们之间进行排序。

这就是全部,如果我对问题的理解正确的话 :)