求高人啊!Can't draw any line。。。画不出线,help !! 新评论 gmdply 2016.02.29 13:50 //+------------------------------------------------------------------+//| Xiazi_QSDD.mq5 |//| 瞎子 |//| http://来自益盟 |//+------------------------------------------------------------------+#property copyright "OK"#property link "http://OK"#property version "1.00"#property indicator_separate_window#property indicator_buffers 4#property indicator_plots 4//--- plot 长期线#property indicator_label1 "Longline"#property indicator_type1 DRAW_LINE#property indicator_color1 clrDeepPink#property indicator_style1 STYLE_SOLID#property indicator_width1 1//--- indicator buffersdouble LonglineBuffer[];int maHandle1,maHandle2,maHandle3; //double ma1[],ma2[],ma3[]; //double AAA[];//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+int OnInit() { maHandle1=iMA(_Symbol,_Period,1,0,MODE_SMA,PRICE_HIGH); // - 入场点函数主条件句柄 maHandle2=iMA(_Symbol,_Period,1,0,MODE_SMA,PRICE_LOW); // - 入场点函数主条件句柄 maHandle3=iMA(_Symbol,_Period,1,0,MODE_SMA,PRICE_CLOSE); // - 入场点函数主条件句柄 PlotIndexSetInteger(0,PLOT_DRAW_TYPE,DRAW_LINE); PlotIndexSetInteger(0,PLOT_LINE_STYLE,STYLE_SOLID);//--- 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[]) { ArraySetAsSeries(ma1,true); ArraySetAsSeries(ma2,true); if(CopyBuffer(maHandle1,0,0,200, ma1)<0) {Alert("复制iMA1指标出错: " ,GetLastError()); return(-1);} if(CopyBuffer(maHandle2,0,0,200, ma2)<0) {Alert("复制iMA2指标出错: " ,GetLastError()); return(-1);} ArraySetAsSeries(ma3,true); if(CopyBuffer(maHandle3,0,0,200, ma3)<0) {Alert("复制iMA3指标出错: " ,GetLastError()); return(-1);} double myhigh=ma1[0],mylow=ma2[0]; double aaatatal=0.00000; for(int i=0;i<rates_total;i++) { for(int j=0;j<19;j++) //ima(AAA,19) { for(int k=0;k<34;k++) //HighPrice,LowPrice in 34 { if(ma1[j+k+1]>myhigh) myhigh=ma1[j+k+1]; if(ma1[j+k+1]<mylow) mylow =ma1[j+k+1]; } AAA[j]=-100*(myhigh-ma3[j])/(myhigh-mylow); aaatatal=aaatatal+AAA[j]; myhigh=ma1[j];mylow=ma2[j]; } LonglineBuffer[i]=aaatatal/19+100; //Drawline,but faild. aaatatal=0.00000; }//--- return value of prev_calculated for next call return(rates_total); }//I want to draw a line: LonglineBuffer[] ,but faild. 这条线怎么都不显示,画不出来,哪里出了问题?? error: 提示: (EURUSD,M5) array out of range in 'XXX.mq5' (127,13)!!! Please Help !! Can't draw any line.... Can't draw any line。。。help !! 新人对MQL4和MQL5的任何问题,对算法和代码的帮助和讨论 Jinsong Zhang 2016.03.01 04:24 #1 数据超出数组范围 gmdply 2016.03.01 09:30 #2 Jinsong Zhang: 数据超出数组范围哪里错了呢?应该怎么改? 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
//| Xiazi_QSDD.mq5 |
//| 瞎子 |
//| http://来自益盟 |
//+------------------------------------------------------------------+
#property copyright "OK"
#property link "http://OK"
#property version "1.00"
#property indicator_separate_window
#property indicator_buffers 4
#property indicator_plots 4
//--- plot 长期线
#property indicator_label1 "Longline"
#property indicator_type1 DRAW_LINE
#property indicator_color1 clrDeepPink
#property indicator_style1 STYLE_SOLID
#property indicator_width1 1
//--- indicator buffers
double LonglineBuffer[];
int maHandle1,maHandle2,maHandle3; //
double ma1[],ma2[],ma3[]; //
double AAA[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
maHandle1=iMA(_Symbol,_Period,1,0,MODE_SMA,PRICE_HIGH); // - 入场点函数主条件句柄
maHandle2=iMA(_Symbol,_Period,1,0,MODE_SMA,PRICE_LOW); // - 入场点函数主条件句柄
maHandle3=iMA(_Symbol,_Period,1,0,MODE_SMA,PRICE_CLOSE); // - 入场点函数主条件句柄
PlotIndexSetInteger(0,PLOT_DRAW_TYPE,DRAW_LINE);
PlotIndexSetInteger(0,PLOT_LINE_STYLE,STYLE_SOLID);
//---
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[])
{
ArraySetAsSeries(ma1,true);
ArraySetAsSeries(ma2,true);
if(CopyBuffer(maHandle1,0,0,200, ma1)<0) {Alert("复制iMA1指标出错: " ,GetLastError()); return(-1);}
if(CopyBuffer(maHandle2,0,0,200, ma2)<0) {Alert("复制iMA2指标出错: " ,GetLastError()); return(-1);}
ArraySetAsSeries(ma3,true);
if(CopyBuffer(maHandle3,0,0,200, ma3)<0) {Alert("复制iMA3指标出错: " ,GetLastError()); return(-1);}
double myhigh=ma1[0],mylow=ma2[0];
double aaatatal=0.00000;
for(int i=0;i<rates_total;i++)
{
for(int j=0;j<19;j++) //ima(AAA,19)
{
for(int k=0;k<34;k++) //HighPrice,LowPrice in 34
{
if(ma1[j+k+1]>myhigh) myhigh=ma1[j+k+1];
if(ma1[j+k+1]<mylow) mylow =ma1[j+k+1];
}
AAA[j]=-100*(myhigh-ma3[j])/(myhigh-mylow);
aaatatal=aaatatal+AAA[j];
myhigh=ma1[j];mylow=ma2[j];
}
LonglineBuffer[i]=aaatatal/19+100; //Drawline,but faild.
aaatatal=0.00000;
}
return(rates_total);
}
//I want to draw a line: LonglineBuffer[] ,but faild. 这条线怎么都不显示,画不出来,哪里出了问题?? error: 提示: (EURUSD,M5) array out of range in 'XXX.mq5' (127,13)!!!