新手写自定义指标的问题 新评论 Tancy W 2024.03.04 06:27 各位大神好。我的指标 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[]) { //--- Alert("====== indicator strar: "+TimeLocal()+" ======"); Alert("rates_total: "+rates_total); int bars; bars=rates_total-prev_calculated; if(prev_calculated>0) bars++; Alert("bars: "+bars); for(int i=0;i<bars;i++) { CopyHigh(Symbol(),0,i,count,high10); CopyLow(Symbol(),0,i,count,low10); ArraySort(high10,WHOLE_ARRAY,0,MODE_DESCEND); ArraySort(low10); high10Buffer[i]=high10[13]; //Alert("["+i+"]-high10[13]= "+high10[13]); if(GetLastError()>0) { Alert("GetLastError("+i+") Code is: "+GetLastError()); break; } low10Buffer[i]=low10[13]; } Alert("====== indicator stop: "+TimeLocal()+" ======"); //--- return value of prev_calculated for next call return(rates_total); } test-indicatior-000 XAUUSD,H1: array out of range in 'test-indicatior-000.mq4' (72,29) test-indicatior-000 XAUUSD,H1: Alert: bars: 114359 test-indicatior-000 XAUUSD,H1: Alert: rates_total: 114359 test-indicatior-000 XAUUSD,H1: Alert: ====== indicator strar: 2024.03.04 13:22:33 ====== 报的错误我用GetLastError获取不到,请高手帮忙看看如何解决。 另外这个指标执行非常慢,我估计跟上面的报错有关系,报错处理完,执行速度可能就正常了。 万分感谢! Hung Wen Lin 2024.03.05 00:05 #1 array out of range in 'test-indicatior-000.mq4' (72,29) 數組超出範圍 ==> 數組的設定錯誤 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
各位大神好。我的指标
报的错误我用GetLastError获取不到,请高手帮忙看看如何解决。
另外这个指标执行非常慢,我估计跟上面的报错有关系,报错处理完,执行速度可能就正常了。
万分感谢!