新人对MQL4和MQL5的任何问题,对算法和代码的帮助和讨论 - 页 1449

 

Vitaly Muzichenko:

需要一个关于如何使用SmoothedMAOnBuffer()函数的例子

一般来说,它是这样的。

//+------------------------------------------------------------------+
//|                                                       VMTest.mqh |
//|                        Copyright 2021, MetaQuotes Software Corp. |
//|                             https://mql5.com/ru/users/artmedia70 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2021, MetaQuotes Software Corp."
#property link      "https://mql5.com/ru/users/artmedia70"
#property version   "2.00"
#property strict
#property indicator_separate_window
#ifdef __MQL5__
  #property indicator_buffers 2
  #property indicator_plots   2
#else
  #property indicator_buffers 2
#endif
#property indicator_color1 clrLime
#property indicator_type1 DRAW_LINE
#property indicator_width1 2
#property indicator_color2 clrRed
#property indicator_type2 DRAW_LINE
#property indicator_width2 2

double BufferHL[];
double BufferSMMA[];

sinput int InpPeriod = 5;  // Smoothing period
int    period_smma;

#include <MovingAverages.mqh>
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
   #ifdef __MQL4__ IndicatorBuffers(2); #endif
   SetIndexBuffer(0,BufferHL,INDICATOR_DATA);
   SetIndexBuffer(1,BufferSMMA,INDICATOR_DATA);
   ArraySetAsSeries(BufferHL,true);
   ArraySetAsSeries(BufferSMMA,true);
   period_smma=(InpPeriod<2 ? 2 : InpPeriod);
   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[])
  {
   int limit=rates_total-prev_calculated;
   if(limit>1)
     {
      limit=rates_total-1;
      ArrayInitialize(BufferHL,EMPTY_VALUE);
      ArrayInitialize(BufferSMMA,EMPTY_VALUE);
     }
   for(int i=limit;i>WRONG_VALUE;i--)
     {
      BufferHL[i]=high[i]-low[i];
     }
   if(SmoothedMAOnBuffer(rates_total,prev_calculated,0,period_smma,BufferHL,BufferSMMA)==0)
      return 0;
   return(rates_total);
  }
//+------------------------------------------------------------------+
 
下午好。我怎样才能增加图形上的文字量。目前显示24个文本,也就是一天的内容。
   void Vr(){
   double h = TimeHour(TimeCurrent()); 
           ObjectCreate(0,"Vr"+h,OBJ_TEXT,1,TimeCurrent(),0);    
           double Vr0=ObjectDescription("Vr"+h);   
           ObjectSetText("Vr"+h,MathMin(balance[0],Vr0),20,"Arial",clrWhite);
           ObjectSetInteger(0,"Vr"+h,OBJPROP_ANCHOR,ANCHOR_RIGHT);
       Comment(Vr0);    }  
我在分钟图上使用该指标。每小时显示一次文本
 

当我点击MQL5云保护器时,弹出了一个错误

sending request to protector server error (3-3, #0)             0       0

该文件自行编译没有任何问题。可能的错误是什么?

 
Sergey Likho:

当我点击MQL5云保护器时,弹出了一个错误

该文件自行编译没有任何问题。可能的错误是什么?

谷歌建议:向保护者服务器发送请求时出现错误

 
Artyom Trishkin:

总而言之,事情就是这样。

谢谢你!

 
Vitaly Muzichenko:

谢谢你!

不客气;)

我可以告诉你如何重新做一个五 - 你不是所有的王牌在那里...

 
Artyom Trishkin:

不客气;)

我可以告诉你如何为5美元重做- 你没有所有的王牌在那里...

我从来没有让它启动和运行...

如果它是以原始形式出现,那就太好了。

这是迄今为止唯一一个出现过故障的指标。

附加的文件:
max.mq5  12 kb
 
Vitaly Muzichenko:

我从来没有让它启动和运行 ...

如果它是原始形式,那就太好了。

这是迄今为止唯一一个出现过故障的指标。

给我这个指标的原始的、完全工作的代码,在四。我将为五人做。

 
Artyom Trishkin:

给我这个指标的原始的、完全工作的代码,在四。我将为五人做。

这里有一个经过调整的,原来的那个只是普通的垃圾。

P.S. Dot.mq4 - 完整的原件

附加的文件:
test.mq4  17 kb
Dot.mq4  8 kb
 
Vitaly Muzichenko:

这是经过调整的那张,原来的那张只是普通的阴暗。

P.S. Dot.mq4 - 完整的原件

一个非常好的。但我只能在闲暇时看看--工作、家、家庭、猫和孩子/孙子。岳母也是,是的...

原因: