支持MG4脚本和顾问的测试人员 - 页 2

 
AlexeyVik:

好吧,也许创作者没有看到普通程序员所面临的那种困难。

例如,我以前在大学里学习BASIC,其他什么都不学。我曾尝试使用mql4,但现在我没有任何问题了。当我尝试使用mql5的时候,我写了一个简单的指标,不到100行,连同一个mql5指标的帽子。在我看来,这两者是有区别的,而且区别很大。

这是个神话,你知道的。

让我们以MetaTrader 4的标准ATR.mq4为例。那里有104条线。

//+------------------------------------------------------------------+
//|                                                          ATR.mq4 |
//|                   Copyright 2005-2014, MetaQuotes Software Corp. |
//|                                              https://www.mql4.com |
//+------------------------------------------------------------------+
#property copyright   "2005-2014, MetaQuotes Software Corp."
#property link        "https://www.mql4.com"
#property description "Average True Range"
#property strict

//--- indicator settings
#property indicator_separate_window
#property indicator_buffers 1
#property  indicator_color1  DodgerBlue
//--- input parameter
input int InpAtrPeriod=14; // ATR Period
//--- buffers
double ExtATRBuffer[];
double ExtTRBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit(void)
  {
   string short_name;
//--- 1 additional buffer used for counting.
   IndicatorBuffers(2);
   IndicatorDigits(Digits);
//--- indicator line
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtATRBuffer);
   SetIndexBuffer(1,ExtTRBuffer);
//--- name for DataWindow and indicator subwindow label
   short_name="ATR("+IntegerToString(InpAtrPeriod)+")";
   IndicatorShortName(short_name);
   SetIndexLabel(0,short_name);
//--- check for input parameter
   if(InpAtrPeriod<=0)
     {
      Print("Wrong input parameter ATR Period=",InpAtrPeriod);
      return(INIT_FAILED);
     }
//---
   SetIndexDrawBegin(0,InpAtrPeriod);
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Average True Range                                               |
//+------------------------------------------------------------------+
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;
//--- check for bars count and input parameter
   if(rates_total<=InpAtrPeriod || InpAtrPeriod<=0)
      return(0);
//--- counting from 0 to rates_total
   ArraySetAsSeries(ExtATRBuffer,false);
   ArraySetAsSeries(ExtTRBuffer,false);
   ArraySetAsSeries(open,false);
   ArraySetAsSeries(high,false);
   ArraySetAsSeries(low,false);
   ArraySetAsSeries(close,false);
//--- preliminary calculations
   if(prev_calculated==0)
     {
      ExtTRBuffer[0]=0.0;
      ExtATRBuffer[0]=0.0;
      //--- filling out the array of True Range values for each period
      for(i=1; i<rates_total; i++)
         ExtTRBuffer[i]=MathMax(high[i],close[i-1])-MathMin(low[i],close[i-1]);
      //--- first AtrPeriod values of the indicator are not calculated
      double firstValue=0.0;
      for(i=1; i<=InpAtrPeriod; i++)
        {
         ExtATRBuffer[i]=0.0;
         firstValue+=ExtTRBuffer[i];
        }
      //--- calculating the first value of the indicator
      firstValue/=InpAtrPeriod;
      ExtATRBuffer[InpAtrPeriod]=firstValue;
      limit=InpAtrPeriod+1;
     }
   else
      limit=prev_calculated-1;
//--- the main loop of calculations
   for(i=limit; i<rates_total; i++)
     {
      ExtTRBuffer[i]=MathMax(high[i],close[i-1])-MathMin(low[i],close[i-1]);
      ExtATRBuffer[i]=ExtATRBuffer[i-1]+(ExtTRBuffer[i]-ExtTRBuffer[i-InpAtrPeriod])/InpAtrPeriod;
     }
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+


让我们来看看MetaTrader 5的ATR.mq5,它有96行。

//+------------------------------------------------------------------+
//|                                                          ATR.mq5 |
//|                        Copyright 2009, MetaQuotes Software Corp. |
//|                                              https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright   "2009, MetaQuotes Software Corp."
#property link        "https://www.mql5.com"
#property description "Average True Range"
//--- indicator settings
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_plots   1
#property  indicator_type1   DRAW_LINE
#property  indicator_color1  DodgerBlue
#property  indicator_label1  "ATR"
//--- input parameters
input int InpAtrPeriod=14;  // ATR period
//--- indicator buffers
double    ExtATRBuffer[];
double    ExtTRBuffer[];
//--- global variable
int       ExtPeriodATR;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
void OnInit()
  {
//--- check for input value
   if(InpAtrPeriod<=0)
     {
      ExtPeriodATR=14;
      printf("Incorrect input parameter InpAtrPeriod = %d. Indicator will use value %d for calculations.",InpAtrPeriod,ExtPeriodATR);
     }
   else ExtPeriodATR=InpAtrPeriod;
//--- indicator buffers mapping
   SetIndexBuffer(0,ExtATRBuffer,INDICATOR_DATA);
   SetIndexBuffer(1,ExtTRBuffer,INDICATOR_CALCULATIONS);
//---
   IndicatorSetInteger(INDICATOR_DIGITS,_Digits);
//--- sets first bar from what index will be drawn
   PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,InpAtrPeriod);
//--- name for DataWindow and indicator subwindow label
   string short_name="ATR("+string(ExtPeriodATR)+")";
   IndicatorSetString(INDICATOR_SHORTNAME,short_name);
   PlotIndexSetString(0,PLOT_LABEL,short_name);
//--- initialization done
  }
//+------------------------------------------------------------------+
//| Average True Range                                               |
//+------------------------------------------------------------------+
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;
//--- check for bars count
   if(rates_total<=ExtPeriodATR)
      return(0); // not enough bars for calculation
//--- preliminary calculations
   if(prev_calculated==0)
     {
      ExtTRBuffer[0]=0.0;
      ExtATRBuffer[0]=0.0;
      //--- filling out the array of True Range values for each period
      for(i=1;i<rates_total && !IsStopped();i++)
         ExtTRBuffer[i]=MathMax(high[i],close[i-1])-MathMin(low[i],close[i-1]);
      //--- first AtrPeriod values of the indicator are not calculated
      double firstValue=0.0;
      for(i=1;i<=ExtPeriodATR;i++)
        {
         ExtATRBuffer[i]=0.0;
         firstValue+=ExtTRBuffer[i];
        }
      //--- calculating the first value of the indicator
      firstValue/=ExtPeriodATR;
      ExtATRBuffer[ExtPeriodATR]=firstValue;
      limit=ExtPeriodATR+1;
     }
   else limit=prev_calculated-1;
//--- the main loop of calculations
   for(i=limit;i<rates_total && !IsStopped();i++)
     {
      ExtTRBuffer[i]=MathMax(high[i],close[i-1])-MathMin(low[i],close[i-1]);
      ExtATRBuffer[i]=ExtATRBuffer[i-1]+(ExtTRBuffer[i]-ExtTRBuffer[i-ExtPeriodATR])/ExtPeriodATR;
     }
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+


104行与96行的大小没有区别,甚至优势都在MQL5一边。

人们就是这样把胡言乱语和神话从一个论坛转移到另一个论坛。

 
Renat:

这完全不意味着语言是一样的。

区别只在于一小部分功能(MT5有更好的功能),而且没有什么大的成本需要掌握。

至于 "我不想浪费我的时间 "和 "我昨天就需要",我想提醒你,交易平台是提高交易者效率的一个重要工具。当有一个更有效和实用的解决方案时,不使用它就是一种自我伤害和自我欺骗的编造的神话。

这足以让交易策略测试者比较永远忘记MT4。我不是在开玩笑,也不是反应过度--它是真实的。

MT5中最愚蠢的加总头寸的原则(这意味着不可能限制在一个符号和一个账户上同时操作几个MTS而不需要任何技巧)永远阻止了在其上的交易。即使在现实中,提供MT5的经纪商比手掌上的手指还多。

而仅仅为了一个测试员而重写MT5的代码--对不起,但这是很荒谬的。

 
evillive:

MT5中最愚蠢的加总头寸的原则(这意味着不可能在一个符号和一个账户上没有任何技巧地限制几个MTS的同时操作)永远阻止了在它上面的交易。即使有更多的经纪人提供MT5的真实性,也比手上的手指多。

这一点都不荒唐。

这些优点已经解释过很多次了,我不想再重复。我也反复解释了为什么 "在一个符号上有多个MTS是自取灭亡,是一种损失,是一种不现实的大规模使用情况"。


而仅仅为了一个测试员而重写MT5的代码--对不起,但这是荒谬的。

这并不荒唐。

你正在削减自己的机会,错过了发展的机会。向你自己和其他人证明,一个明知更好、功能更强大的系统比一个有一堆缺陷的旧系统更糟糕,是对自己的直接伤害。

 
Renat:

完全不意味着语言是一样的。

唯一的区别是一组小的功能(在MT5中它们更好),而且没有大的成本来掌握。

至于 "我不想浪费我的时间 "和 "我昨天就需要",我想提醒你,交易平台是提高交易者效率的一个重要工具。当附近有一个明知更有效和实用的解决方案时,不使用它就是伤害自己,用编造的神话欺骗自己。

这足以让交易策略测试者比较永远忘记MT4。我不是在开玩笑,也不是反应过度--它是真实的。

雷纳特,将mt4测试器等同于mt5测试器有多难?
 
Renat:

这是个神话,你知道的。

让我们以MetaTrader 4的标准ATR.mq4为例。那里有104条线。


让我们来看看MetaTrader 5的ATR.mq5,它有96行。


104行与96行的大小没有区别,甚至优势都归于MQL5。

人们就是这样把胡言乱语和神话从一个论坛转移到另一个论坛。

我的问题是,在mql4中同样的指标,我花了一个小时就写好了,而在mql5中写同样的代码,我花了一个星期才掌握...这不是引言的数量,而是对编程方法的理解...

mql4中获取标准指标值的功能与mql5中的相同功能有什么不同...我在处理这个问题时几乎失去了理智。当然,你可以提供编程课程,但你必须考虑其他因素,可能不允许去参加这种课程......而成本,和年龄,以及与场地的距离或在线学习中的交通成本......。你永远不知道...

 
AlexeyVik:
Renat,将mt4测试器等同于mt5测试器有多难?
我们不会触及4,只有与MQL5.社区整合的服务部分。
 
Renat:
我们将不触及Quartet,只有与MQL5.community整合的服务部分。
我甚至没有问你是否会这样做,所以我猜你不会。我问是否很难...
 
AlexeyVik:

我不是这个意思,我是说我在mql4上写了同样的指标只用了一个小时,而我花了一个星期才学会在mql5上写同样的代码...这不是引言的数量,而是对编程方法的理解...

在mql4中获取自定义指标值的功能与mql5中的相同功能有什么不同 ...我为了弄清楚这个问题,几乎疯了。当然,你可以提供编程课程,但你必须考虑其他因素,可能不允许去参加这种课程......而成本,和年龄,以及与场地的距离或在线学习中的交通成本......。你永远不知道...

比较这两个文件,你会发现最小的差异。

关于 "一个星期就开窍了,差点疯了"--这是论坛上的一个红字。这就是神话的诞生过程。

 
AlexeyVik:
只是其中的语言非常不同,需要花费不小的时间来掌握它。
去他妈的。一个月已经足够了。
 
Renat:

比较这两个文件,你会发现差异很小。

"一个星期就开窍了,我差点就疯了",这只是论坛上的一个红字。这就是神话的诞生过程。

我不会证明这就是真相。对于一个不熟悉C++编程和一般OOP的人来说,这是相当困难的,完全不是为了红字或创造神话。虽然看起来很奇怪,但我在一个星期内就理解了这一切,并写下了我所需要的东西。而这是一个完全不同的神话;它表明mql5甚至可以被非专业人士,如我,轻松掌握。