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 ....
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
TREND-QUALITY INDICATOR for Amibroker (AFL)
Copy & Paste Friendly
Back
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | I found it in the internet. I am not the author. Thanks This Indicator attempts to estimate the trend in relation to noise. LISTING 1 // Piecewise EMA is an EMA that restarts calculations each time // the 'sincebar' argument is true function PiecewiseEMA( array, range, sincebar ) { factor = IIf ( sincebar, 1, 2/(range+1) ); return AMA2 ( array, factor, 1-factor ); } // parameters m=4; n=250; // generate reversal signals based on EMA crossover rule Lpf1 = EMA ( C , 7 ); Lpf2 = EMA ( C , 15 ); CrossPoint = Cross ( Lpf1, Lpf2 ) OR Cross ( Lpf2, Lpf1 ); Periods = BarsSince ( CrossPoint ); // variable bar sum DC = Close - Ref ( Close , -1 ); CPC = Sum ( DC, Periods ); // smooth CPC by piecewise 4 bar EMA Trend = PiecewiseEMA( CPC, 4, CrossPoint ); // noise DT = CPC - Trend; Noise = 2 * sqrt ( MA ( DT^2, n ) ); // alternative 'linear' noise calculation // Noise = 2 * MA( abs( DT ), n ) ); QIndicator = Trend/Noise; Plot ( sign (Lpf1-Lpf2), "Rev" , colorRed ); Plot ( Qindicator, "Qindicator" , colorGreen , styleHistogram ); PlotGrid ( -1 ); PlotGrid ( 1 ); PlotGrid ( 2 ); PlotGrid ( -2 ); PlotGrid ( 5 ); PlotGrid ( 5); |