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

 
Aleksey Vyazmikin:

你能为OpenCL写一个内核 吗?我知道这里只有一个人声称在EA运行时使用OpenCL来进行实时优化。我不知道任何其他的例子。

我想亲自看一看。甚至要求发布一篇关于这个问题的文章,但行政部门不知道如何将其应用于实际交易。

太不可思议了,opencl已经被支持了5年,但却没有具体的交易实例,也没有文章......好吧,既然开发者自己都不知道如何应用它,那我们就把重点放在云端优化上吧。
 
ax237b:
太不可思议了,对opencl的支持已经存在5年了,但却没有具体的工作实例,也没有文章......好吧,如果开发者自己都不知道如何应用它,那就让我们专注于云计算的优化吧。
有什么好惊讶的呢?终端以足够的速度工作,经纪人的反应延迟。所以opencl暂时在休息。接下来会发生什么--我们将拭目以待
 

请帮助我们!

我正在重新制作该指标,以下是绘制的代码

#property indicator_separate_window
#property indicator_buffers 3
#property indicator_plots   3
//--- plot Label1
#property  indicator_label1  "High";
#property  indicator_type1   DRAW_LINE;
#property  indicator_color1  clrRed;
#property  indicator_style1  STYLE_DOT;
#property  indicator_width1  1;
//--- plot Label2
#property  indicator_label2  "Low";
#property  indicator_type2   DRAW_LINE;
#property  indicator_color2  clrRed;
#property  indicator_style2  STYLE_DOT;
#property  indicator_width2  1;
//--- plot Label3
#property  indicator_label3  "Close";
#property  indicator_type3   DRAW_LINE;
#property  indicator_color3  clrAquamarine;
#property  indicator_style3  STYLE_SOLID;
#property  indicator_width3  1;


//--- input parameters
input int InpChannelPeriod=48; // Period
//--- indicator buffers
double ExtHighBuffer[];
double ExtLowBuffer[];
double ExtCloseBuffer[];
//---
int i,limit,start;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,ExtHighBuffer,INDICATOR_DATA);
   SetIndexBuffer(1,ExtLowBuffer,INDICATOR_DATA);
   SetIndexBuffer(2,ExtCloseBuffer,INDICATOR_DATA);   
//--- set accuracy
   IndicatorSetInteger(INDICATOR_DIGITS,_Digits);
//--- set first bar from what index will be drawn
   PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,InpChannelPeriod);
   PlotIndexSetInteger(1,PLOT_DRAW_BEGIN,InpChannelPeriod);
   PlotIndexSetInteger(2,PLOT_DRAW_BEGIN,InpChannelPeriod);   
//---
   return(0);
  }

//+------------------------------------------------------------------+ //| 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[]) { //--- check for rates if(rates_total<InpChannelPeriod) return(0); //--- preliminary calculations if(prev_calculated==0) limit=InpChannelPeriod; else limit=prev_calculated; //--- the main loop of calculations for(i=limit;i<rates_total && !IsStopped();i++) { ExtHighBuffer[i]=100.0; ExtLowBuffer[i]=0.0; ExtCloseBuffer[i]=50.0; } //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+

风格#属性indicator_style2STYLE_DOT; - 根本不在图表上绘制

样式# 属性indicator_style2STYLE_SOLID; - 在图表上以STYLE_DOT方式 绘制。

这是什么反常现象,还是我的手有问题?

 

从图形阵列中计算移动平均线 的最佳方式是什么--这里还是指标中?

是否有开发者推荐的现成的功能或库?

 
Aleksey Vyazmikin:

从图形阵列中计算移动平均线 的最佳方式是什么--这里还是指标中?

也许有一些开发者推荐的现成的功能或库?


甚至一个简单的变体--在地下室从iMA画出MA--我什么也没得到:(

我正在通过函数调用

double MA_TF(int index)
  {
   double MA[1];
   ResetLastError();
   if(CopyBuffer(handle_MA_TF,0,index,1,MA)<0)
     {
      PrintFormat("Failed to copy data from the handle_MA_TF indicator, error code %d",GetLastError());
      return(0.0);
     }
   return NormalizeDouble(MA[0],Digits());
  }

但是,这是不对的--从里到外...

 

通过向导,我对MA_TF(rate_total-i)进行了内部调用--似乎有帮助,但我看了看历史,有时与内置指标有出入(即使去掉了归一化),会是这种情况吗?

还有,如何使指标输出小数点值?

 
Aleksey Vyazmikin:

从图形阵列中计算移动平均线 的最佳方式是什么--这里还是指标中?

是否有开发者推荐的现成的功能或库?

在Include文件夹里有MovingAverages.mqh...
 
Alexey Viktorov:
在Include文件夹里有MovingAverages.mqh...

谢谢,我不知道,但我可以看到一个例子,说明在哪里工作?

 
Aleksey Vyazmikin:

谢谢,我不知道,但我可以看到一个例子,说明在哪里工作?

阿列克谢,搜索不工作了吗?

在右上方有一个文件搜索。你可以通过点击齿轮来调整搜索区域。


结果是这样的。


 
Alexey Viktorov:

阿列克谢,搜索不再起作用了吗?

在右上方有一个文件搜索。你可以通过点击齿轮来调整搜索区域。


而这里是结果。



的确,为什么不自己搜索一下呢------谢谢!