### Stock Portfolio Organizer

The ultimate porfolio management solution.

Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....

#1 Selling Amibroker Plugin featuring:

Neural Networks
And Much More ....
Find Out More Here

### EBSW Even Better Sine Wave for Amibroker (AFL) sal157011 almost 5 years ago Amibroker (AFL)

Rating:
Tags:
oscillator, amibroker

Even Better Sine Wave

### Indicator / Formula

```SetBarsRequired( sbrAll );

function EBSW( Duration)
{
//HighPass filter cyclic components whose periods are shorter than Duration input
PI = 3.1415926;
alpha1 = (1 - sin (2*PI / Duration)) / cos(2*PI /Duration);
//Smooth with a Super Smoother Filter from equation 3-3
a1 = exp(-1.414*PI / 10);
b1 = 2*a1*cos(1.414*PI / 10);
c2 = b1;
c3 = -a1*a1;
c1 = 1 - c2 - c3;
HP = Close;
Filt = HP;
Wave = Filt;
Pwr = Filt;
for( i = 3 ; i < BarCount; i++ )
{
HP[ i ]=.5*(1 + alpha1)*(Close[i] - Close[i-1]) + alpha1*HP[i-1];

Filt[i] = c1*(HP[i] + HP[i-1]) / 2 + c2*Filt[i-1] + c3*Filt[i-2];
}
//3 Bar average of Wave amplitude and power
Wave = (Filt + Ref(Filt,-1) + Ref(Filt,-2)) / 3;
Pwr = (Filt^2 + Ref(Filt,-1)^2 + Ref(Filt,-2)^2) / 3;
//Normalize the Average Wave to Square Root of the Average Power
Wave = Wave / sqrt(Pwr);
return wave;
}
Plot(EBSW(Param("Duration",20,1,200,1,0)),"EBSW"+ _PARAM_VALUES(),colorBlue);//Plot( array, Name, color/barcolor, style = styleLine, minvalue = {empty}, maxvalue = {empty}, XShift = 0, Zorder = 0 )
/*
//HighPass filter cyclic components whose periods are
shorter than Duration input
alpha1 = (1 - Sine (360 / Duration)) / Cosine(360 /
Duration);
HP = .5*(1 + alpha1)*(Close - Close) + alpha1*HP;
//Smooth with a Super Smoother Filter from equation 3-3
a1 = expvalue(-1.414*3.14159 / 10);
b1 = 2*a1*Cosine(1.414*180 / 10);
c2 = b1;
c3 = -a1*a1;
c1 = 1 - c2 - c3;
Filt = c1*(HP + HP) / 2 + c2*Filt + c3*Filt;
//3 Bar average of Wave amplitude and power
Wave = (Filt + Filt + Filt) / 3;
Pwr = (Filt*Filt + Filt*Filt + Filt*Filt) / 3;
//Normalize the Average Wave to Square Root of the Average
Power
Wave = Wave / SquareRoot(Pwr);
Plot1(Wave);```

1.

works very well

tks again

2.

Even though I enjoyed of mathematical formula for calculating the wave but unfortunately using of this indicator is not a good Idea for Market specially Forex. I think you can work more on it to improve it

3.

@sal157011 -What is the best way to use this indicator ?
@ val2004 – Which market you find it useful and how you are imnplementing in your Trade Plan ?