精英指标 :) - 页 199

 

数字滤波器 EA信息

Mladen, MrTools,

在#1987到#1989中显示的数字滤波器非常令人印象深刻。

我想试试使用这些的EA--你能说说如何设置iCustom来提取这些数值吗?

一个好的选择可能是图表平滑的数字过滤器--模式1(SATL)和模式0(FATL)。

EA的逻辑可以很简单--当FATL>SATL且两者的斜率为正时买入;卖出时则相反;当FATL斜率=0时关闭。

对于如何在这里最好地计算斜率有什么建议吗?

谢谢!

雷克斯

 
mladen:
雷克斯

要找出非平滑版本的斜率,你可以使用这样的方法

int price = PRICE_CLOSE;

int filterType;

filterType = 0;

double fatlCurrent = iCustom(NULL,0,"Digital filters - on chart","",filterType,price,0,0);

double fatlPrevious = iCustom(NULL,0,"Digital filters - on chart","",filterType,price,0,1);

filterType = 1;

double satlCurrent = iCustom(NULL,0,"Digital filters - on chart","",filterType,price,0,0);

double satlPrevious = iCustom(NULL,0,"Digital filters - on chart","",filterType,price,0,1);

filterType = 2;

double rftlCurrent = iCustom(NULL,0,"Digital filters - on chart","",filterType,price,0,0);

double rftlPrevious = iCustom(NULL,0,"Digital filters - on chart","",filterType,price,0,1);

filterType = 3;

double rstlCurrent = iCustom(NULL,0,"Digital filters - on chart","",filterType,price,0,0);

double rstlPrevious = iCustom(NULL,0,"Digital filters - on chart","",filterType,price,0,1);

//

//

// slope of any of the values, fatl in this case

//

//

bool slopeUp = false;

bool slopeDown = false;

if (fatlCurrent>fatlPrevious) slopeUp = true;

if (fatlCurrent<fatlPrevious) slopeUp = true;

[/php]to find it out in the smoothed version use something like this (additional parameters needed in iCustom() call)

int length = 5;

int phase = 0

int price = PRICE_CLOSE;

int filterType;

filterType = 0;

double fatlCurrent = iCustom(NULL,0,"Digital filters smoothed - on chart","",filterType,price,length,phase,0,0);

double fatlPrevious = iCustom(NULL,0,"Digital filters smoothed - on chart","",filterType,price,length,phase,0,1);

filterType = 1;

double satlCurrent = iCustom(NULL,0,"Digital filters smoothed - on chart","",filterType,price,length,phase,0,0);

double satlPrevious = iCustom(NULL,0,"Digital filters smoothed - on chart","",filterType,price,length,phase,0,1);

filterType = 2;

double rftlCurrent = iCustom(NULL,0,"Digital filters smoothed - on chart","",filterType,price,length,phase,0,0);

double rftlPrevious = iCustom(NULL,0,"Digital filters smoothed - on chart","",filterType,price,length,phase,0,1);

filterType = 3;

double rstlCurrent = iCustom(NULL,0,"Digital filters smoothed - on chart","",filterType,price,length,phase,0,0);

double rstlPrevious = iCustom(NULL,0,"Digital filters smoothed - on chart","",filterType,price,length,phase,0,1);

//

//

// slope of any of the values, fatl in this case

//

//

bool slopeUp = false;

bool slopeDown = false;

if (fatlCurrent>fatlPrevious) slopeUp = true;

if (fatlCurrent<fatlPrevious) slopeUp = true;

[/php]Both examples are using current (open) bar value. To avoid it change the last parameter from 0 and 1 to 1 and 2. Also, included even unnecessary values calculations (as you can see all the digital filters types are calculated) in order to show how to retreive every value

To compare values of different filters simply compare (for example) if (fatlCurrent>rftlCurrent) or if (fatlCurrent<rftlCurrent) but that just shows their relative values. It does not show if they just crossed one above/bellow the other

______________________

To find crossings of a different filters, it gets a bit more complicated and the best way is to write a new indicator. It is more complicated because it depends how do you treat eventual equal values of two indicators. I prefer to treat them as a trend continuation and not as a possible trend reversal. Attaching an indicator that will show you "trends" (a simple "bigger"/ "smaller" relation) of 2 digital filters. To use it all you need is to check the value that is even not going to be displayed anywhere on chart, like this

[php] int price = PRICE_CLOSE;

int filterType1 = 0; // fatl

int filterType2 = 2; // rftl

int filtersTrendCurrent = iCustom(NULL,0,"Digital filters - on chart trend","",filterType1,FilterType2,price,5,0); // retrieve value from trend buffer

int filtersTrendPrevious = iCustom(NULL,0,"Digital filters - on chart trend","",filterType1,FilterType2,price,5,1); //

if (filterTrendCurrent!= filterTrendPrevious) // trend just changed

{

if (filtersTrendCurrent== 1) ....// trend changed to up

if (filtersTrendCurrent==-1) ....// trend changed to down

}

Also, the remark for a opened bar stands for this example too, so change the last parameter to desired value (1 for closed bar, for example) if you do not want to use opened bar signals. The target indicator is the histogram down on the picture (fatl / rftl crosses in this case on a 5 minute chart)
And in the end, you could do something like this :

[php] if (filterTrendCurrent!= filterTrendPrevious) // trend just changed

{

if ( fatlCurrent>fatlPrevious && rftlCurrent>rftlPrevious && filtersTrendCurrent== 1) Buy...

if ( fatlCurrent<fatlPrevious && eftlCurrent<rftlPrevious && filtersTrendCurrent==-1) Sell....

}

//

// the danger is that the slope and the crosses are not going to change in the same

// moment and buying or selling on every bar when slopes are equal would cause an

// EA to "overtrade"

//

但在我看来,只需检查交叉点并使用一些完全不同的斜率进行过滤就足够了(在这个例子中使用的是快速数字滤波器,那么慢速数字滤波器(satl或rstl)可以作为 "斜率 "过滤使用)

______________________

PS:当涉及到EA时,你甚至可以考虑写一个不显示任何数值的指标(在这种情况下,它可以节省2个缓冲区),但在这种情况下,你必须101%确定你在用代码做什么(没有 "视觉控制")。

问候

姆拉登

雷克斯。

我只想说Mladen的这些数字指示器对Ea来说是非常好的选择,我已经注意到与其他老版本相比,它们对Cpu的影响是多么的小。我用旧的数字版本做了一些Ea;s,特别是在多个时间段使用STLM斜率,电脑很难受,这些似乎同样好或更好,但更轻。

尊敬的先生

工具

 

Mladen, Mrtools,

这正是我所希望的!

这是个很大的帮助。

再次感谢。

雷克斯

 

雷克斯

要找出非平滑版本的斜率,你可以使用这样的方法

int price = PRICE_CLOSE;

int filterType;

filterType = 0;

double fatlCurrent = iCustom(NULL,0,"Digital filters - on chart","",filterType,price,0,0);

double fatlPrevious = iCustom(NULL,0,"Digital filters - on chart","",filterType,price,0,1);

filterType = 1;

double satlCurrent = iCustom(NULL,0,"Digital filters - on chart","",filterType,price,0,0);

double satlPrevious = iCustom(NULL,0,"Digital filters - on chart","",filterType,price,0,1);

filterType = 2;

double rftlCurrent = iCustom(NULL,0,"Digital filters - on chart","",filterType,price,0,0);

double rftlPrevious = iCustom(NULL,0,"Digital filters - on chart","",filterType,price,0,1);

filterType = 3;

double rstlCurrent = iCustom(NULL,0,"Digital filters - on chart","",filterType,price,0,0);

double rstlPrevious = iCustom(NULL,0,"Digital filters - on chart","",filterType,price,0,1);

//

//

// slope of any of the values, fatl in this case

//

//

bool slopeUp = false;

bool slopeDown = false;

if (fatlCurrent>fatlPrevious) slopeUp = true;

if (fatlCurrent<fatlPrevious) slopeUp = true;

[/php]to find it out in the smoothed version use something like this (additional parameters needed in iCustom() call)

int length = 5;

int phase = 0

int price = PRICE_CLOSE;

int filterType;

filterType = 0;

double fatlCurrent = iCustom(NULL,0,"Digital filters smoothed - on chart","",filterType,price,length,phase,0,0);

double fatlPrevious = iCustom(NULL,0,"Digital filters smoothed - on chart","",filterType,price,length,phase,0,1);

filterType = 1;

double satlCurrent = iCustom(NULL,0,"Digital filters smoothed - on chart","",filterType,price,length,phase,0,0);

double satlPrevious = iCustom(NULL,0,"Digital filters smoothed - on chart","",filterType,price,length,phase,0,1);

filterType = 2;

double rftlCurrent = iCustom(NULL,0,"Digital filters smoothed - on chart","",filterType,price,length,phase,0,0);

double rftlPrevious = iCustom(NULL,0,"Digital filters smoothed - on chart","",filterType,price,length,phase,0,1);

filterType = 3;

double rstlCurrent = iCustom(NULL,0,"Digital filters smoothed - on chart","",filterType,price,length,phase,0,0);

double rstlPrevious = iCustom(NULL,0,"Digital filters smoothed - on chart","",filterType,price,length,phase,0,1);

//

//

// slope of any of the values, fatl in this case

//

//

bool slopeUp = false;

bool slopeDown = false;

if (fatlCurrent>fatlPrevious) slopeUp = true;

if (fatlCurrent<fatlPrevious) slopeUp = true;

[/php]Both examples are using current (open) bar value. To avoid it change the last parameter from 0 and 1 to 1 and 2. Also, included even unnecessary values calculations (as you can see all the digital filters types are calculated) in order to show how to retreive every value

To compare values of different filters simply compare (for example) if (fatlCurrent>rftlCurrent) or if (fatlCurrent<rftlCurrent) but that just shows their relative values. It does not show if they just crossed one above/bellow the other

______________________

To find crossings of a different filters, it gets a bit more complicated and the best way is to write a new indicator. It is more complicated because it depends how do you treat eventual equal values of two indicators. I prefer to treat them as a trend continuation and not as a possible trend reversal. Attaching an indicator that will show you "trends" (a simple "bigger"/ "smaller" relation) of 2 digital filters. To use it all you need is to check the value that is even not going to be displayed anywhere on chart, like this

[php] int price = PRICE_CLOSE;

int filterType1 = 0; // fatl

int filterType2 = 2; // rftl

int filtersTrendCurrent = iCustom(NULL,0,"Digital filters - on chart trend","",filterType1,FilterType2,price,5,0); // retrieve value from trend buffer

int filtersTrendPrevious = iCustom(NULL,0,"Digital filters - on chart trend","",filterType1,FilterType2,price,5,1); //

if (filterTrendCurrent!= filterTrendPrevious) // trend just changed

{

if (filtersTrendCurrent== 1) ....// trend changed to up

if (filtersTrendCurrent==-1) ....// trend changed to down

}

Also, the remark for a opened bar stands for this example too, so change the last parameter to desired value (1 for closed bar, for example) if you do not want to use opened bar signals. The target indicator is the histogram down on the picture (fatl / rftl crosses in this case on a 5 minute chart)
And in the end, you could do something like this :

[php] if (filterTrendCurrent!= filterTrendPrevious) // trend just changed

{

if ( fatlCurrent>fatlPrevious && rftlCurrent>rftlPrevious && filtersTrendCurrent== 1) Buy...

if ( fatlCurrent<fatlPrevious && eftlCurrent<rftlPrevious && filtersTrendCurrent==-1) Sell....

}

//

// the danger is that the slope and the crosses are not going to change in the same

// moment and buying or selling on every bar when slopes are equal would cause an

// EA to "overtrade"

//

但在我看来,只需检查交叉点并使用一些完全不同的斜率进行过滤就足够了(在这个例子中使用的是快速数字滤波器,那么慢速数字滤波器(satl或rstl)可以作为 "斜率 "过滤使用)

______________________

PS:当涉及到EA时,你甚至可以考虑写一个不显示任何数值的指标(在这种情况下,它可以节省2个缓冲区),但在这种情况下,你必须101%确定你在用代码做什么(没有 "视觉控制")。

______________________

PPS:正确的 "数字过滤器-图表趋势 "指标可以在这个帖子中找到https://www.mql5.com/en/forum/general

问候

Mladen

rdoane:
Mladen, MrTools,

在#1987到#1989中显示的数字过滤器非常令人印象深刻。

我想试试使用这些的EA--你能说说如何设置iCustom来提取这些数值吗?

一个好的选择可能是图表平滑的数字过滤器--模式1(SATL)和模式0(FATL)。

EA的逻辑可以很简单--当FATL>SATL且两者的斜率为正时买入;卖出时则相反;当FATL斜率=0时关闭。

对于如何在这里最好地计算斜率有什么建议吗?

谢谢!

吕志强
附加的文件:
 

在 "数字过滤器--关于图表趋势 "最初发布在这个帖子:https://www.mql5.com/en/forum/general,有一个错误。这个是更正后的,所以请使用这个。

问候

姆拉登

附加的文件:
 

Mladen,

你能在这个指标中加入不重绘着色和MTF选项吗?谢谢。

附加的文件:
rsi_ma.mq4  4 kb
 

Pc-breakout

Mladen,

我在虚拟私人服务器 上使用一个EA。当我把鼠标放在票号上时,有时会出现 "PC-Breakout "的信息。

这是什么意思?是连接中断还是服务器重新启动?

谢谢

问候。

 
casaliss:
你好 mladen

请在当前图表上添加零线交叉箭头。

谢谢

嗨,Mladen

1997年后

谢谢

 

Tradefx1

我的猜测是,这是您的EA在订单上的评论(当您在订单列表中右键单击时,尝试检查"评论",然后看看评论是否与您得到的弹出文本相对应)

问候

姆拉登

Tradefx1:
Mladen,

我在虚拟私人服务器上使用一个EA。当我把鼠标放在票号上时,有时会出现 "PC-Breakout "的信息。

这是什么意思?是连接中断还是服务器重启?

谢谢

问候。
 

比迪克

给你
PS: 忽略了 "mtf "部分。也附上一个mtf版本

问候

姆拉登

biddick:
Mladen, 你能不能在这个指标中加入不重绘着色和mtf选项?谢谢。
附加的文件: