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 ....
CONFIRMING PRICE TREND for Amibroker (AFL)
Copy & Paste Friendly
Back
This technique is based on r-squared and linear regression slope indicators. The linear regression slope is AmiBroker's built-in function. The r-square indicator can be implemented as single-line function in AFL.
I am not the author. Found on internet
LISTING 1
Periods = Param("Periods", 20, 2, 200, 1, 10 );
Plot( LinRegSlope( C, Periods ), "LinRegSlope("+Periods+")",
colorGreen, styleHistogram | styleThick );
LISTING 2
function RSquared( array, periods )
{
return Correlation( BarIndex(), array, periods ) ^ 2;
}
periods = Param("Periods", 20, 2, 100 );
Plot( RSquared( C, periods ), "R2(" + periods + ")", colorRed, styleThick );