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

 
jommerbot:

好吧,即使在最简单的情况下也是不行的。

我不明白我的错误在哪里。在EA和脚本中复制同一指标的缓冲区可以工作,但在指标中不能。指示器手柄被初始化,没有错误。

找到差异。)

#property copyright "Copyright 2010, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_plots   1
#property  indicator_type1   DRAW_LINE
#property  indicator_color1  clrRed
//---
double ExtLineBuffer[];
int    iRocHandleEURUSD =INVALID_HANDLE;
int    iPlotShift       =0;
int    iPeriod          =6;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
void OnInit()
  {
   IndicatorSetInteger(INDICATOR_DIGITS,2);
   SetIndexBuffer(0,ExtLineBuffer,INDICATOR_DATA);
   PlotIndexSetInteger(0,PLOT_SHIFT,iPlotShift);
   PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,iPeriod-1);
//---
   iRocHandleEURUSD=iCustom("EURUSD",0,"Examples\\ROC");
   if(iRocHandleEURUSD==INVALID_HANDLE)
      Print("Не удалось получить хендл индикатора ROC EURUSD");
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int    rates_total,
                const int    prev_calculated,
                const int    begin,
                const double &price[])
  {
//---
   if(rates_total<iPeriod)
      return(0);
//---
   int first=0;
   double aRocRatesEURUSD[];
   ArraySetAsSeries(ExtLineBuffer,true);
//---
   if(prev_calculated==0)
      first=0;
   else
      first=prev_calculated-1;
//---
   for(int bar=first; bar<rates_total; bar++)
     {
      CopyBuffer(iRocHandleEURUSD,0,bar,1,aRocRatesEURUSD);
      Print("bar: ",bar,"; value: ",DoubleToString((aRocRatesEURUSD[0]!=EMPTY_VALUE)?aRocRatesEURUSD[0]:0,2));
      ExtLineBuffer[bar]=aRocRatesEURUSD[0];
     }
//---
   return(rates_total);
  }
//+------------------------------------------------------------------+
 

是的,明白了,在我上一版本的代码中,指标处理程序进入了变量的错误范围。我错过了,谢谢你。但有一个问题--在测试器中,在测试期 开始前的历史条上,指标 正常工作,但从测试期开始,新到的点位不被考虑。即一个子指标的缓冲区不被更新。

 

好心人,请帮助纠正代码,以便从工作行中 "输入参数 "的顾问
extern string Lot = "0.2 0.2 0.3 0.4 0.5"; //(通过空格)
,最后一个值(在这种情况下是0.5)会无限地重复,即不输入
"0.2 0.2 0.2 0.3 0.4 0.5 0.5 0.5 0.5 0.5"。

//----------------------------

StringToArrayLot(Lot,xiLot)。

//---------------------------------------------------

int StringToArrayLot(string st,double &ad[])
{
int i=0,np; string stp;ArrayResize(ad,0);
while(StringLen(st)>0)
{
np=StringFind(st," ");
if(np<0)
{
stp=st;
st="";
}else{
stp=StringSubstr(st,0,np);
st=StringSubstr(st,np+1);
}
i++;
ArrayResize(ad,i);
ad[i-1]=StrToDouble(stp);
}
return(ArraySize(ad));
}

 
为什么我不能在网站上或终端上看到我的EA?
 
Krasev157:
为什么我不能在网站上或终端上看到我的EA?
要在网站上看到它,你必须上传它。要在终端编译它。
 
zfs:
要在网站上看到它,你必须上传它。要在终端编译它。

我的资料上看不到,但我的资料上看不到。

 
Krasev157:

将在网站上发布,我在我的个人资料上看不到它。

请给我一个阿尔巴尼亚语词典的链接。
 
barabashkakvn:
请给我一个阿尔巴尼亚语词典的链接。

http://www.txtblog.ru/blog/1165306807 给你

 

哈塔尔先生着火 了。

来吧!

巴辛格!

 
你好,如果不是太麻烦的话,请你告诉我好吗?如何将最后5个点的价格放入一个数组?