这个自定义指标(iTrend.mq4)可以被编入现有的EA中吗......如果可以的话,该如何编码?

 
??
 
是的,这是有可能的(见文章《将指标代码转为专家顾问代码》。专家顾问的一般结构方案和指标功能),但为什么?
 
wizkid:
??

如果你问的是如何使用或调用一个自定义指标,这很简单......使用 "iCustom "来定义这个功能,像这样

double MyTrend=iCustom(NULL,0,"iTrend",0,0);

将指标放在 "expert/indicator/"目录中......那么就不需要指定路径,也不需要使用.mq4文件扩展名。


你需要知道的关于其他数值的一切都在MetaEditor库中。 除此以外,我的理解是,试图将指标像函数一样构建到你的EA中,是在浪费时间和计算机资源。你并没有真正得到什么,终端对指标和EA的处理方式不同,对指标的处理会占用EA到终端线程的可用性。作为独立的文件,它们不会相互冲突。

 
seawolf wrote >>

if you are asking how to use, or call, a custom indicator, it's very simple... use the "iCustom" to define the function like this

place the indicator in the "expert/indicator/" directory... then there is no need to specify either the path, or use the .mq4 file extension.


everything you need to know about the other values is in the MetaEditor Library. Other than that, my understanding is that trying to build the indicator into your EA like a function is a waste of time and computer resources. you do not really gain anything, terminal handles indicators and EA's differently and the processing of the indicator would chew up availability of the EA to Terminal thread. As separate files they would not conflict with each other.

Rosh
wrote
>>
是的,这是有可能的(见文章《将指标代码转移到专家顾问代码中》。专家顾问的一般结构方案和指标功能),但为什么?

我按照你的建议做了,现在我在编译时得到这样的信息:...............'iCustom' - initialization expected C:\Program Files\Interbank FX Trader 4Demo\experts\PTTrend_201].mq4 (15, 16)

 

iTrend指标是否有任何输入参数?

如果有的话,它们需要在iCustom()调用中指定。

 
phy wrote>>

iTrend指标是否有任何输入参数?

如果有,它们需要在iCustom()调用中指定。

所以输入参数需要在这里指定...double MyTrend=iCustom(NULL,0,"iTrend",0,0)

 

double MyTrend=iCustom(NULL,0,"iTrend",P1, P2, P3, P4, 0,0)

所有的输入参数都必须被指定,是的。有多少个?

 
phy wrote>>

double MyTrend=iCustom(NULL,0,"iTrend",P1, P2, P3, P4, 0,0)

所有的输入参数都必须被指定,是的。有多少个?

有7个...所以它的P1到P7如下double MyTrend=iCustom(NULL,0,"iTrend",P1, P2, P3, P4, P5, P6,P7, 0,0);

 
wizkid wrote>>

有7个...所以它的P1到P7如下double MyTrend=iCustom(NULL,0,"iTrend",P1, P2, P3, P4, P5, P6,P7, 0,0)

这就是我现在的情况 double MyTrend=iCustom(NULL,0, "iTrend",0,0,40,8,25,200,0,0)....,我仍然得到同样的错误信息 'iCustom' - initialization expected C:\Program Files\Interbank FX Trader 4Demo\experts\PTTrend_201].1.mq4 (15, 16)

 

名字是iTrend还是i_Trend?

 
phy wrote>>

名称是iTrend还是i_Trend?

iTrend