
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Digital Filters EA info
Mladen, MrTools,
The Digital Filters shown in #1987 to #1989 are very impressive.
I'd like to try an EA using these - can you spell out how to set up iCustom to extract the values?
A good choice might be the Digital Filters on Chart Smoothed - Mode 1 (SATL) and Mode 0 (FATL).
The EA logic could be simple - Buy when FATL > SATL and the slope of both is positive; opposite for sell; close when FATL slope = 0.
Any recommendations on how to best calculate slope here?
Thanks!
Rex
Rex
To find out the slopes in non smoothed version you can use something like this
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 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
}
[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"
//
But in my opinion it is enough just to check the crosses and use some completely other slope for filtering (in this examples fast digital filter are used, then slow digital filters (satl or rstl) could be used as a "slope" filtering ones)
______________________
PS: when it comes to EA, you even might consider writing an indicator that does not display any values (it would save 2 buffers in this histo version in that case) but in that case you have to be 101% sure what are you doing with the code (no "visual control")
regards
MladenRex,
Just want to say these digital indicators by Mladen very good choice for Ea have all ready noticed how light on Cpu they are compared to the other old versions. Have made a number of Ea;s with the older digital versions especially using STLM slope on multiple timeframes man the computer was suffering, these seem just as good or better but way lighter.
Regards
tools
Mladen, Mrtools,
That's exactly what I was hoping for!
This is a big help.
Thanks again.
Rex
Rex
To find out the slopes in non smoothed version you can use something like this
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 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
}
[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"
//
But in my opinion it is enough just to check the crosses and use some completely other slope for filtering (in this examples fast digital filter are used, then slow digital filters (satl or rstl) could be used as a "slope" filtering ones)
______________________
PS: when it comes to EA, you even might consider writing an indicator that does not display any values (it would save 2 buffers in this histo version in that case) but in that case you have to be 101% sure what are you doing with the code (no "visual control")
______________________
PPS: the correct "digital filters - on chart trends" indicator is found at this post https://www.mql5.com/en/forum/general
regards
Mladen
Mladen, MrTools,
The Digital Filters shown in #1987 to #1989 are very impressive.
I'd like to try an EA using these - can you spell out how to set up iCustom to extract the values?
A good choice might be the Digital Filters on Chart Smoothed - Mode 1 (SATL) and Mode 0 (FATL).
The EA logic could be simple - Buy when FATL > SATL and the slope of both is positive; opposite for sell; close when FATL slope = 0.
Any recommendations on how to best calculate slope here?
Thanks!
RexIn the "digital filters - on chart trends" originally posted at this post : https://www.mql5.com/en/forum/general there was one error. This one is the corrected one, so please use this one
regards
Mladen
Mladen,
Can you add nonrepainting coloring and mtf option to this indicator?Thanks.
Pc-breakout
Mladen,
I am using an EA on a virtual private server. I have sometimes the message "PC-Breakout", when I put the mouse on the ticket number.
What does it mean ? Is it a loss of connection or can it be a server restart ?
thanks
regards,
Hi mladen
Please add zero line cross arrows on current chart.
ThanksHi Mladen
Post 1997
Thanks
Tradefx1
My guess is that it is the comment that your EA is placing on the order (try checking "comments" too when you right click in the list of orders and then see if the comment corresponds to the pop-up text you are getting)
regards
Mladen
Mladen,
I am using an EA on a virtual private server. I have sometimes the message "PC-Breakout", when I put the mouse on the ticket number.
What does it mean ? Is it a loss of connection or can it be a server restart ?
thanks
regards,biddick
Here you goregards
Mladen
Mladen, Can you add nonrepainting coloring and mtf option to this indicator?Thanks.