如何编码? - 页 337 1...330331332333334335336337338339340341342343344...347 新评论 Mladen Rakic 2015.06.03 07:20 #3361 at120: 嗨,Mladen!我认为我的iCustom的调用是正确的,因为在测试和正常(导出数据或作为indi使用)中 到目前为止,它工作得很好。我认为问题出在你提到的双数/数组值上。 当我现在使用一个 double mom1[]。 mom1 = iCustom(NULL,0, "myIndi",0,i)。 和比一个-> mom(mom1,Bars,20,i)。 --> "mom" --参数对话不允许 我怎样才能把这个写对呢? 非常感谢,再见,AT 试着像这样: mom(mom1,Bars,20,i);[/PHP] Also, change the mom function to be like this : [PHP]double Mom(double& series[], int period, int totcount, int index) { if (totcount<1 || period<1) return (EMPTY_VALUE); if (indextotcount-1) return (EMPTY_VALUE); return (series-series); } at120 2015.06.03 08:03 #3362 嗨,Mladen! 谢谢你的帮助! 我的问题是,我需要 "const",因为程序的其他部分需要它...。 把 "一切 "都写成新的就太麻烦了,所以问题是,我是否可以反过来做。 以便使mom1与子函数 一起工作? 非常感谢,再见,AT Mladen Rakic 2015.06.03 08:08 #3363 at120: 嗨,Mladen!谢谢你的帮助! 我的问题是,我需要 "const",因为程序的其他部分需要它...。 把 "一切 "都写成新的就太麻烦了,所以问题是,我能否反过来做。 让mom1与子函数一起工作? 非常感谢,再见,AT 你可以按原样使用mom函数(以及其他的)。 只要把mom(mom1,Bars,20,i);改为mom(mom1,Bars,20,i)。 at120 2015.06.03 08:21 #3364 然后我得到了错误。 -- "mom1" --参数 对话不允许 这个问题很棘手......有什么其他想法吗? 谢谢,再见,AT Mladen Rakic 2015.06.03 08:25 #3365 at120: 然后我得到了错误。-- "mom1" --参数对话不允许 这个问题很棘手......有什么其他想法吗? 谢谢,再见,AT 我没有得到这个错误 请看这个例子。 #property indicator_chart_window double buffer[]; int init() { SetIndexBuffer(0,buffer); return(0); } int deinit() { return(0); } int start() { double mom = Mom(buffer,10,50,0); return(0); } double Mom(const double& series[], int period, int totcount, int index) { if (totcount<1 || period<1) return (EMPTY_VALUE); if (indextotcount-1) return (EMPTY_VALUE); return (series-series); } 编译时完全没有错误 at120 2015.06.03 08:43 #3366 嗨,Mladen! 也许是因为有for {}函数?(为了得到Bars?)或者是因为... 另一点是:mom1是一个自定义的indi... mom1 = iCustom(NULL,0, "myIndi",0,i)。 我在这里调用:mom(mom1,Bars,20,i)。 谢谢你的帮助!! 再见,AT Mladen Rakic 2015.06.03 08:56 #3367 at120: 嗨,Mladen!也许是因为有一个for {}函数?(为了获得Bars?)或者是因为...... 另一点是:mom1是一个自定义的indi... mom1 = iCustom(NULL,0, "myIndi",0,i)。 我在这里调用:mom(mom1,Bars,20,i)。 谢谢你的帮助!! 再见,AT 不,这不可能是原因 请看这个例子。 #property indicator_chart_window double buffer[]; int init() { SetIndexBuffer(0,buffer); return(0); } int deinit() { return(0); } int start() { int counted_bars=IndicatorCounted(); if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; int limit = MathMin(Bars-counted_bars,Bars-1); for(int i = limit; i>=0; i--) { buffer = iCustom(NULL,0,"custom name",0,i); double mom = Mom(buffer,10,50,i); } return(0); } double Mom(const double& series[], int period, int totcount, int index) { if (totcount<1 || period<1) return (EMPTY_VALUE); if (indextotcount-1) return (EMPTY_VALUE); return (series-series); } 另外,完全没有编译器错误 How to code? 编码帮助 趋势指标 at120 2015.06.03 09:26 #3368 嗨,Mladen! 也许是因为我的代码看起来更像这样,而且有一个 "错误"... :-/ #property indicator_chart_window double buffer[]; int init() { SetIndexBuffer(0,buffer); return(0); } int deinit() { return(0); } int start() { int counted_bars=IndicatorCounted(); if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; int limit = MathMin(Bars-counted_bars,Bars-1); for(int i = limit; i>=0; i--) { double mom1; mom1 = iCustom(NULL,0,"custom name",0,i); buffer = ( Mom(mom1,10,Bars,i); ); } return(0); } double Mom(const double& series[], int period, int totcount, int index) { if (totcount<1 || period<1) return (EMPTY_VALUE); if (indextotcount-1) return (EMPTY_VALUE); return (series-series); } ); 谢谢,再见,AT How to code? 编码帮助 趋势指标 Mladen Rakic 2015.06.03 09:37 #3369 at120: 嗨,Mladen!也许是因为我的代码看起来更像这样,而且有一个 "错误"... :-/ #property indicator_chart_window double buffer[]; int init() { SetIndexBuffer(0,buffer); return(0); } int deinit() { return(0); } int start() { int counted_bars=IndicatorCounted(); if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; int limit = MathMin(Bars-counted_bars,Bars-1); for(int i = limit; i>=0; i--) { double mom1; mom1 = iCustom(NULL,0,"custom name",0,i); buffer = ( Mom(mom1,10,Bars,i); ); } return(0); } double Mom(const double& series[], int period, int totcount, int index) { if (totcount<1 || period<1) return (EMPTY_VALUE); if (indextotcount-1) return (EMPTY_VALUE); return (series-series); } ); 谢谢,再见,AT at120 在你的代码中,mom1被定义为双数(简单的双数变量)而不是数组或缓冲区。 用定义 "缓冲区 "的方法来定义它,在init部分把它加到缓冲区里,就可以了(确保适当调整缓冲区的数量)。 at120 2015.06.03 10:10 #3370 嗨,马尔顿! 谢谢你的支持!;-) 甚至,当我像你说的那样写代码的时候。 (我想是的...) #property indicator_chart_window double buffer[]; double mom1[]; int init() { SetIndexBuffer(0,buffer); SetIndexBuffer(1,mom1);return(0); } int deinit() { return(0); } int start() { int counted_bars=IndicatorCounted(); if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; int limit = MathMin(Bars-counted_bars,Bars-1); for(int i = limit; i>=0; i--) { mom1 = iCustom(NULL,0,"custom name",0,i); buffer = ( Mom(mom1,10,Bars,i); //doesn't work - no value in indi // Mom(mom1,10,Bars,i); //error: parameter conversation not allowed // mom1 // this works ); } return(0); } double Mom(const double& series[], int period, int totcount, int index) { if (totcount<1 || period<1) return (EMPTY_VALUE); if (indextotcount-1) return (EMPTY_VALUE); return (series-series); } ); 所以当我使用 "第一个 "版本时,我没有得到任何值。 当我使用第二个版本时,我得到了错误...嗯。 只有调用mom1才有效...但这不是正确的值... 谢谢你的帮助! 再见,AT How to code? 编码帮助 趋势指标 1...330331332333334335336337338339340341342343344...347 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
嗨,Mladen!
我认为我的iCustom的调用是正确的,因为在测试和正常(导出数据或作为indi使用)中
到目前为止,它工作得很好。我认为问题出在你提到的双数/数组值上。
当我现在使用一个
double mom1[]。
mom1 = iCustom(NULL,0, "myIndi",0,i)。
和比一个-> mom(mom1,Bars,20,i)。
--> "mom" --参数对话不允许
我怎样才能把这个写对呢?
非常感谢,再见,AT试着像这样:
Also, change the mom function to be like this :
[PHP]double Mom(double& series[], int period, int totcount, int index) { if (totcount<1 || period<1) return (EMPTY_VALUE); if (indextotcount-1) return (EMPTY_VALUE); return (series-series); }嗨,Mladen!
谢谢你的帮助!
我的问题是,我需要 "const",因为程序的其他部分需要它...。
把 "一切 "都写成新的就太麻烦了,所以问题是,我是否可以反过来做。
以便使mom1与子函数 一起工作?
非常感谢,再见,AT
嗨,Mladen!
谢谢你的帮助!
我的问题是,我需要 "const",因为程序的其他部分需要它...。
把 "一切 "都写成新的就太麻烦了,所以问题是,我能否反过来做。
让mom1与子函数一起工作?
非常感谢,再见,AT你可以按原样使用mom函数(以及其他的)。
只要把mom(mom1,Bars,20,i);改为mom(mom1,Bars,20,i)。
然后我得到了错误。
-- "mom1" --参数 对话不允许
这个问题很棘手......有什么其他想法吗?
谢谢,再见,AT
然后我得到了错误。
-- "mom1" --参数对话不允许
这个问题很棘手......有什么其他想法吗?
谢谢,再见,AT我没有得到这个错误
请看这个例子。
double buffer[];
int init() { SetIndexBuffer(0,buffer); return(0); }
int deinit() { return(0); }
int start()
{
double mom = Mom(buffer,10,50,0);
return(0);
}
double Mom(const double& series[], int period, int totcount, int index)
{
if (totcount<1 || period<1) return (EMPTY_VALUE);
if (indextotcount-1) return (EMPTY_VALUE);
return (series-series);
}编译时完全没有错误
嗨,Mladen!
也许是因为有for {}函数?(为了得到Bars?)或者是因为...
另一点是:mom1是一个自定义的indi... mom1 = iCustom(NULL,0, "myIndi",0,i)。
我在这里调用:mom(mom1,Bars,20,i)。
谢谢你的帮助!!
再见,AT
嗨,Mladen!
也许是因为有一个for {}函数?(为了获得Bars?)或者是因为......
另一点是:mom1是一个自定义的indi... mom1 = iCustom(NULL,0, "myIndi",0,i)。
我在这里调用:mom(mom1,Bars,20,i)。
谢谢你的帮助!!
再见,AT不,这不可能是原因
请看这个例子。
double buffer[];
int init() { SetIndexBuffer(0,buffer); return(0); }
int deinit() { return(0); }
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit = MathMin(Bars-counted_bars,Bars-1);
for(int i = limit; i>=0; i--)
{
buffer = iCustom(NULL,0,"custom name",0,i);
double mom = Mom(buffer,10,50,i);
}
return(0);
}
double Mom(const double& series[], int period, int totcount, int index)
{
if (totcount<1 || period<1) return (EMPTY_VALUE);
if (indextotcount-1) return (EMPTY_VALUE);
return (series-series);
}另外,完全没有编译器错误
嗨,Mladen!
也许是因为我的代码看起来更像这样,而且有一个 "错误"... :-/
#property indicator_chart_window
double buffer[];
int init() { SetIndexBuffer(0,buffer); return(0); }
int deinit() { return(0); }
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit = MathMin(Bars-counted_bars,Bars-1);
for(int i = limit; i>=0; i--)
{
double mom1;
mom1 = iCustom(NULL,0,"custom name",0,i);
buffer = (
Mom(mom1,10,Bars,i);
);
}
return(0);
}
double Mom(const double& series[], int period, int totcount, int index)
{
if (totcount<1 || period<1) return (EMPTY_VALUE);
if (indextotcount-1) return (EMPTY_VALUE);
return (series-series);
}
);谢谢,再见,AT
嗨,Mladen!
也许是因为我的代码看起来更像这样,而且有一个 "错误"... :-/
#property indicator_chart_window
double buffer[];
int init() { SetIndexBuffer(0,buffer); return(0); }
int deinit() { return(0); }
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit = MathMin(Bars-counted_bars,Bars-1);
for(int i = limit; i>=0; i--)
{
double mom1;
mom1 = iCustom(NULL,0,"custom name",0,i);
buffer = (
Mom(mom1,10,Bars,i);
);
}
return(0);
}
double Mom(const double& series[], int period, int totcount, int index)
{
if (totcount<1 || period<1) return (EMPTY_VALUE);
if (indextotcount-1) return (EMPTY_VALUE);
return (series-series);
}
);at120
在你的代码中,mom1被定义为双数(简单的双数变量)而不是数组或缓冲区。
用定义 "缓冲区 "的方法来定义它,在init部分把它加到缓冲区里,就可以了(确保适当调整缓冲区的数量)。
嗨,马尔顿!
谢谢你的支持!;-)
甚至,当我像你说的那样写代码的时候。
(我想是的...)
#property indicator_chart_window
double buffer[];
double mom1[];
int init() { SetIndexBuffer(0,buffer); SetIndexBuffer(1,mom1);return(0); }
int deinit() { return(0); }
int start()
{
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
int limit = MathMin(Bars-counted_bars,Bars-1);
for(int i = limit; i>=0; i--)
{
mom1 = iCustom(NULL,0,"custom name",0,i);
buffer = (
Mom(mom1,10,Bars,i);
//doesn't work - no value in indi
// Mom(mom1,10,Bars,i); //error: parameter conversation not allowed
// mom1 // this works
);
}
return(0);
}
double Mom(const double& series[], int period, int totcount, int index)
{
if (totcount<1 || period<1) return (EMPTY_VALUE);
if (indextotcount-1) return (EMPTY_VALUE);
return (series-series);
}
);所以当我使用 "第一个 "版本时,我没有得到任何值。
当我使用第二个版本时,我得到了错误...嗯。
只有调用mom1才有效...但这不是正确的值...
谢谢你的帮助!
再见,AT