Trading Strategies Based On Digital Filters - page 81

 

Base Indicator

Pava:
how to change base indicator in extrapolator?

Pava,

Post the base indicator you want to use here and I will do the mod for you,if it is a "secret indicator" that you don`t want to post,just change the line of code as suggested at previous posts.

If,for example you want to do the Fourier Extr of RSI you should add to input parameters the following...

extern int RSIPeriod = 14;

And,then change this line of code :

in=0.5+iWPR(NULL,0,50,i+lb)/100.0; //change indicator here

For this one

in=0.5+iRSI(NULL, 0, RSIPeriod,0,i+lb)/100.0; //change indicator here

Regards

S

 

sorry

I want to apologize publicly to simba by my behavior in this thread with it, sorry if I have offended you ....

 

problem

indeed to do Fourier transform rsi show me that?: 'in' - expression on global scope not allowed C: \ Program Files \ WHC Trader 4 \ experts \ indicators \ RSI.mq4 (16, 1)

someone knows why?

 

FFTProblem

Now,before everybody believes this is the HG,I want to point it out that it is not

See attacched pic...Big Problem here,had you blindly believed the signal from the FFT of WPR you would have gotten short way earlier than necessary.

So,does this mean that FFt of indicator is not useful?..No...It can be very useful if you know how to trade it,basically there are 2 ways...First one is look for trendline breakout confirmation ,after the change in colour of FFT,and avoid entering a trade until price(close preferably) crosses the trendline...The second method I will explain in the next post.

Regards

S

Files:
fftproblem.gif  70 kb
 

and..

Forgive me for interrupting, then, fft can not take turns as in the image? repaint?

Files:
gbpjpyh4.jpg  266 kb
 

FFTSolution

There are more ways to use this indicators ,but the trendline and the one I will explain now are the basis to trade with these kind of Tools,you then can combine both or add MTF confirmation...But,the basis are these 2 methods.

Second Method:

1-TrendFilter: See pic FTTSolution1...USE a FFT with a base indicator period bewteen 200 to 300 bars,in this case I used a 250 periods RSI...And Harmonics=1...This will be your trendfilter,and the redrawing effect is negligible...so,once it became RED ,you can only take short Trades.

2-Trigger Entry: See pic FFTSolution2...ADDD to the chart a second FFT indicator with normal period(in this case RSI=14) and Harmonics anything bewteen 5 and 25(I used 25 for the example)...If trendfilter is signalling a downtrend,you enter when Trigger signals a downtrend too...see the Blue areas I marked at the chart...You can exit by TP,or,mandatory, by change of colour....In the case signalled there were 5 entries,3 of them marginally profitable,2 of them very good trades....

This is not the HG either,BUT it is a very good strategy to trade safe and profitably.

SUGGESTIONS:

1-Don`t be greedy,use either the trendline,or this method,or both...Do NOT anticipate the trend change..Always use a trendfilter based on ,at least H1 with >200 periods.

2-My usual comment about lower Timeframes...Use it at/above H1..If you really have to use it at m1,m5,m15,do,so only if m15 and h1 TRENDFILTERS(>200 periods) are BOTH signalling in the same direction.

3-The best Entries are done if you are extremely patient and wait for the right setup...See last entry(Blue area) at the second chart...Trend was Down,there was an ABCD kind of retracement that retraced more than 50% of the previous downmove(about 80%) and then a Trigger entry.

4-High harmonics (25)are faster but can repaint,usually in countertrend direction,you can use them for the Trigger if you trade in the trend direction,but,preferably,use just 5 harmonics...you will have less trades but you will catch the profitable ones.

5-Practice your setups and triggers with the Visual Tester,get the feel for it,for several timeframes and several pairs.

Regards

S

Files:
 

Ok

learntrader:
I want to apologize publicly to simba by my behavior in this thread with it, sorry if I have offended you ....
learntrader:
indeed to do Fourier transform rsi show me that?: 'in' - expression on global scope not allowed C: \ Program Files \ WHC Trader 4 \ experts \ indicators \ RSI.mq4 (16, 1) someone knows why?
learntrader:
Forgive me for interrupting, then, fft can not take turns as in the image? repaint?

Dario,

1-I accept your apologies.

2-See attacched at this post the FFT of RSI,I modified Leledc indicators,since it has all the bells and whistles.

3-FFT can take those turns,the most important issue is the base indicator that you use...FFT can repaint like crazy,or it can be very stable,If you use it as I explained in my previous post,you will combine a stable directional filter with a fast(prone to redrawings or repaintings) "turncatcher"...the key is that by combining them you minimize the dangers of the repainting and profit from fast directional entries.

Leledc

Thanks for your indicator`s modification.

Regards

S

 
SIMBA:
Dario,

1-I accept your apologies.

2-See attacched at this post the FFT of RSI,I modified Leledc indicators,since it has all the bells and whistles.

3-FFT can take those turns,the most important issue is the base indicator that you use...FFT can repaint like crazy,or it can be very stable,If you use it as I explained in my previous post,you will combine a stable directional filter with a fast(prone to redrawings or repaintings) "turncatcher"...the key is that by combining them you minimize the dangers of the repainting and profit from fast directional entries.

Leledc

Thanks for your indicator`s modification.

Regards

S

I'm very glad to hear this from you!!!!

 

Gaussian Filter

Hi I have a tradestation fucntion:i 'd like to convert it in mql(to port a tradestation indi in mt4).Below original and my version of function in mql.It doesn't work well so i'd like an help from some expert here.thanks

Easylanguage

{Gaussian Filter}

Inputs: Price(NumericSeries), iptPeriod(NumericSimple), iptPoles(NumericSimple);

variables: aa(0), b(0), w(0), x(0), y(0), y1(0), y2(0), y3(0), y4(0),

a_1(0), a_12(0), a_13(0), a_14(0), a2(0), a3(0), a4(0), Pi(3.141592654),

sqrtOf2(1.414213562), Period(2), poles(0);

if (iptPeriod < 2) then

Period = 2

else

Period = iptPeriod;

// Number of filter poles must be between 1 and 4, inclusive

if iptPoles < 1 then

poles = 1

else if iptPoles > 4 then

poles = 4

else

poles = iptPoles;

// initialization - performed only for first bar

if CurrentBar = 1 then

begin

w = 2 * Pi / Period; // omega

w = 180 * w / Pi; // in degrees

b = (1 - cosine(w)) / (power(sqrtOf2, 2.0/poles) - 1.0);

aa = -b + squareroot(b*b + 2*b);

a_1 = 1.0 - aa;

a_12 = a_1 * a_1;

a_13 = a_1 * a_1 * a_1;

a_14 = a_12 * a_12;

a2 = aa * aa;

a3 = aa * aa * aa;

a4 = a2 * a2;

y1 = Price;

y2 = y1;

y3 = y2;

y4 = y3;

end;

{ Calculate your indicator value here }

x = Price;

if (poles = 1) then

y = aa * x + a_1 * y1

else if (poles = 2) then

y = a2 * x + 2 * a_1 * y1 - a_12 * y2

else if (poles = 3) then

y = a3 * x + 3 * a_1 * y1 - 3 * a_12 * y2 + a_13 * y3

else if (poles = 4) then

y = a4 * x + 4 * a_1 * y1 - 6 * a_12 * y2 + 4 * a_13 * y3 - a_14 * y4;

y4 = y3; // delayed by four bars

y3 = y2; // delayed by three bars

y2 = y1; // delayed by two bars

y1 = y; // delayed by one bar

Gauss = y;

[/php]Mql

[php]

double Gauss(double Price, double iptPeriod,double iptPoles){

double aa, b, w, x, y, y1, y2, y3, y4,a_1, a_12, a_13, a_14, a2, a3, a4;

double Pi=3.141592654;

double period=21, poles;

if (iptPeriod < 2)

period = 2;

else

period = iptPeriod;

if (iptPoles < 1){

poles = 1;

}

else if (iptPoles > 4){

poles = 4;

}

else{

poles = iptPoles;

}

// initialization - performed only for first bar

for(int i = Price; i >= 0; i--){

w = 2 * Pi / period; // omega

w = 180 * w / Pi; // in degrees

b = (1 - MathCos(w)) / (MathPow(MathSqrt(2.0),2.0/poles) - 1.0);

aa = -b + MathSqrt(b*b + 2*b);

a_1 = 1.0 - aa;

a_12 = a_1 * a_1;

a_13 = a_1 * a_1 * a_1;

a_14 = a_12 * a_12;

a2 = aa * aa;

a3 = aa * aa * aa;

a4 = a2 * a2;

y1 = Price;

y2 = y1;

y3 = y2;

y4 = y3;

}

for(i = Price; i >= 0; i--){

x = Price;

y = a4 * x + 4 * a_1 * y1 - 6 * a_12 * y2 + 4 * a_13 * y3 - a_14 * y4;//we don't need y1 y2 y3 y4

}

return (y);

}

 

!!!!!!!!!!

Reason: