You’ve done exactly what I would have suggested. The Natural Log creates linear results and then the standard Linear Regression can be used. I will still have a look at this to see if there are cases where the exponential line of best fit is not limited to the log/anti-log constraints.
I too am attempting to recreate Andreas Clenow Exponential Regression Ranking. Following from Clenow’s book Stocks on the Move there are five basic steps for the creation of the formula.
Calculate Natural log from each price in the series.
Calculate a Linear slope from the lookback period (90 Bars)
Convert the Linear slope number to Exponential and Annualize @ 250 day’s
Calculate R2 from the lookback period (90 Bars)
Multiply #3 x #4 to get adjusted slope figure.
I was able to work this out in Excel OK but upon translation to Optuma I’m having a problem recreating R2. Here’s what I have so far:
// CLENOW EXPONENTIAL REGRESSION RANK // CLOSE V1=CLOSE(); // NATURAL LOG V2=LN(V1); // 90 DAY LINEAR REGRESSION SLOPE V3=LRSLOPE(V2,BARS=90); //ANNUALIZED LINEAR REGRESSION SLOPE (CONVERTED TO EXPONENTIAL) V4=(POWER(EXP(V3), POWER=250.00))-1; // R SQUARED ??? // CALCULATE ADJ SLOPE INDICATOR V4*V5
I’ve attempted nesting CLR and POWER together as well as leaving them as separate variable to no avail. Any help would be appreciated
Note that correlation, standard deviation and r² all use the same base regression functions. So calling a RSQRD(CALCSTYLE=Price, HTTIMEFRAME=Bars, BARS2=90) should do it. Note that you must change to “Price” and not “Percent” because you have already taken the LN of the data.
Here is a screenshot with the data calculated with the above script in Optuma and exported to Excel for better viewing and comparison:
As you can see the calculation for the “Adjusted Slope” from the Clenow screenshot example above and the Optuma script calculations are the same! So the script is correct!