[警告关闭!]任何新手问题,为了不给论坛添乱。专业人士,不要走过。没有你,哪里都不能去。 - 页 1061

 

晚上好。

有一个有趣的顾问 "Frank_ud",问题是--如何为阿尔帕里磨刀?

 
volshebnik:
阿列克谢,你是对的。我检查了我的专家顾问--当MA周期=6 ...10 ......我的专家顾问在测试了一个月后挂掉了......。测试停止并挂起。 专家顾问根本无法打开交易。为什么测试器会挂起?

如果零除法 写在日志里,那就更容易了。

但这样一来,你就必须把版画放在每个区块中,并监测事件的进展。然后,在确定了悬停区之后,你必须对行数进行更具体的分析。

这可能是一个周期的问题。

 

你能告诉我如何改变动量指标 的公式吗?

 
把这个指标放在这里,我给你看。
 
//| Momentum.mq4 |
//| Copyright © 2004, MetaQuotes Software Corp.
//| http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp.
#属性链接 "http://www.metaquotes.net/"

#属性 indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 DodgerBlue
//---- 输入参数
外置 int MomPeriod=14;
//---- 缓冲区
双倍MomBuffer[]。
//+------------------------------------------------------------------+
//|自定义指标初始化功能
//+------------------------------------------------------------------+
int init()
{
string short_name;
//---- 指标线
SetIndexStyle(0,DRAW_LINE)。
SetIndexBuffer(0,MomBuffer)。
//---- DataWindow和指标子窗口标签的名称
short_name="Mom("+MomPeriod+")"。
IndicatorShortName(short_name)。
SetIndexLabel(0,short_name)。
//----
SetIndexDrawBegin(0,MomPeriod)。
//----
return(0);
}
//+------------------------------------------------------------------+
//| 势头 |
//+------------------------------------------------------------------+
int start()
{
int i,counted_bars=IndicatorCounted()。
//----
如果(Bars<=MomPeriod)返回(0)。
//---- 初始零点
如果(counted_bars<1)
for(i=1;i<=MomPeriod;i++) MomBuffer[Bars-i]=0.0。
//----
i=Bars-MomPeriod-1。
如果(counted_bars>=MomPeriod) i=Bars-counted_bars-1;
while(i>=0)
{
MomBuffer[i]=Close[i]-Close[i+MomPeriod]。
i--;
}
return(0);
}
//+------------------------------------------------------------------+
 

好的,第二个问题。

究竟是什么在

 
//| Momentum.mq4 |
//| Copyright © 2004, MetaQuotes Software Corp.
//| http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp.
#属性链接 "http://www.metaquotes.net/"

#属性 indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 DodgerBlue
//---- 输入参数
外置 int MomPeriod=14;
//---- 缓冲区
双倍MomBuffer[]。
//+------------------------------------------------------------------+
//|自定义指标初始化功能
//+------------------------------------------------------------------+
int init()
{
string short_name;
//---- 指标线
SetIndexStyle(0,DRAW_LINE)。
SetIndexBuffer(0,MomBuffer)。
//---- DataWindow和指标子窗口标签的名称
short_name="Mom("+MomPeriod+")"。
IndicatorShortName(short_name)。
SetIndexLabel(0,short_name)。
//----
SetIndexDrawBegin(0,MomPeriod)。
//----
return(0);
}
//+------------------------------------------------------------------+
//| 势头 |
//+------------------------------------------------------------------+
int start()
{
int i,counted_bars=IndicatorCounted()。
//----
如果(Bars<=MomPeriod)返回(0)。
//---- 初始零点
如果(counted_bars<1)
for(i=1;i<=MomPeriod;i++) MomBuffer[Bars-i]=0.0。
//----
i=Bars-MomPeriod-1。
如果(counted_bars>=MomPeriod) i=Bars-counted_bars-1;
while(i>=0)
{
MomBuffer[i]=Close[i]-Close[i+MomPeriod]。
i--;
}
return(0);
}
//+------------------------------------------------------------------+
 

在公式中到底需要改变什么? 也就是你想增加什么新的公式?

PS。

你一定是不小心发布了两次指标

 

对不起,我已经说到了最后一个问题。

这是原来的那个。

//| Momentum.mq4 |
//| Copyright © 2004, MetaQuotes Software Corp.
//| http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp.
#属性链接 "http://www.metaquotes.net/"

#属性 indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 DodgerBlue
//---- 输入参数
外置 int MomPeriod=14;
//---- 缓冲区
双倍MomBuffer[]。
//+------------------------------------------------------------------+
//|自定义指标初始化功能
//+------------------------------------------------------------------+
int init()
{
string short_name;
//---- 指标线
SetIndexStyle(0,DRAW_LINE)。
SetIndexBuffer(0,MomBuffer)。
//---- DataWindow和指标子窗口标签的名称
short_name="Mom("+MomPeriod+")"。
IndicatorShortName(short_name)。
SetIndexLabel(0,short_name)。
//----
SetIndexDrawBegin(0,MomPeriod)。
//----
return(0);
}
//+------------------------------------------------------------------+
//| 势头 |
//+------------------------------------------------------------------+
int start()
{
int i,counted_bars=IndicatorCounted()。
//----
如果(Bars<=MomPeriod)返回(0)。
//---- 初始零点
如果(counted_bars<1)
for(i=1;i<=MomPeriod;i++) MomBuffer[Bars-i]=0.0。
//----
i=Bars-MomPeriod-1。
如果(counted_bars>=MomPeriod) i=Bars-counted_bars-1;
while(i>=0)
{
MomBuffer[i]=Close[i]*100/Close[i+MomPeriod] 。
i--;
}
return(0);
}

//+------------------------------------------------------------------+

在这个指标中,其公式为:。MOMENTUM = CLOSE (i) / CLOSE (i - n) * 100,而我需要

MOMENTUM = CLOSE (i) - CLOSE (i - n)
 
lordsnake:

对不起,我已经说到了最后一个问题。

这里是原文。

//| Momentum.mq4 |
//| Copyright © 2004, MetaQuotes Software Corp.
//| http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp.
#属性链接 "http://www.metaquotes.net/"

#属性 indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 DodgerBlue
//---- 输入参数
外置 int MomPeriod=14;
//---- 缓冲区
双倍MomBuffer[]。
//+------------------------------------------------------------------+
//|自定义指标初始化功能
//+------------------------------------------------------------------+
int init()
{
string short_name;
//---- 指标线
SetIndexStyle(0,DRAW_LINE)。
SetIndexBuffer(0,MomBuffer)。
//---- DataWindow和指标子窗口标签的名称
short_name="Mom("+MomPeriod+")"。
IndicatorShortName(short_name)。
SetIndexLabel(0,short_name)。
//----
SetIndexDrawBegin(0,MomPeriod)。
//----
return(0);
}
//+------------------------------------------------------------------+
//| 势头 |
//+------------------------------------------------------------------+
int start()
{
int i,counted_bars=IndicatorCounted()。
//----
如果(Bars<=MomPeriod)返回(0)。
//---- 初始零点
如果(counted_bars<1)
for(i=1;i<=MomPeriod;i++) MomBuffer[Bars-i]=0.0。
//----
i=Bars-MomPeriod-1。
如果(counted_bars>=MomPeriod) i=Bars-counted_bars-1;
while(i>=0)
{
MomBuffer[i]=Close[i]*100/Close[i+MomPeriod]; // this

MomBuffer[i]=Close[i]- Close[i+MomPeriod]; //改成这样

i--;
}
return(0);
}

//+------------------------------------------------------------------+

在这个指标中,该公式。MOMENTUM = CLOSE (i) / CLOSE (i - n) * 100,但我需要

MOMENTUM = CLOSE (i) - CLOSE (i - n)