Exponential regression

Sorry for not posting any script is it possible to rank by exponential regression as explained by Clenow in his book in optuma. I could only find linear regression not exponential one.
Exponential Regression
https://www.followingthetrend.com/premium/using-the-momentum-analytics/

Regards,
Deepak

Hii Sir,

I was able to figure it out lately.

v1=CLOSE(); 
v2=Ln(v1); 
v3=LRSLOPE(v2, BARS=90); 
v4=(POWER(exp(v3), POWER=250.00))-1; 
//v4=EXP(v3); 
//v5=POWER(v4, POWER=252.00); 
//v6=(v5-1); 
//v6 v6=BARINDEX()+1; 
v5 = CRL(v6,v2, BARS=90, CALCSTYLE=Price); 
v7 = POWER(v5, POWER=2.00); 
v4 * v7

Thanks
Deepak

Hi Deepak,

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.

All the best

Mathew

Hi,

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.

  1. Calculate Natural log from each price in the series.

  2. Calculate a Linear slope from the lookback period (90 Bars)

  3. Convert the Linear slope number to Exponential and Annualize @ 250 day’s

  4. Calculate R2 from the lookback period (90 Bars)

  5. 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

Hi Andrew,

Have you tried the RSQRD() function?

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.

Hope that helps

Mathew

Hi,

I have also dealt with Clenow’s Exponential Regression Ranking System.

Deepak’s approach is the best especially the trick with the BARINDEX() function.

Here is the complete script:

// https://www.followingthetrend.com/premium/using-the-momentum-analytics 
// http://www.followingthetrend.com/stocks-on-the-move-figures-and-charts 

// Clenow Exponential Regrssion Rank 
Line1 = CLOSE() ; 

// Natural LOG 
Line2 = LN(Line1) ; 

// 90 Day Linear Regression Slope 
Line3 = LRSLOPE(Line2, BARS = 90) ; 

// Annualized Linear Regression Slope (Converted to Exponential) 
Line4 = (POWER(EXP(Line3), POWER=250.00)) - 1 ; 

// R-Squared
Line5 = BARINDEX() + 1 ; 
Line6 = CRL(Line5, Line2, BARS = 90, CALCSTYLE=Price) ; 
Line7 = POWER(Line6, POWER = 2.00) ; 

// Calculating the Adjusted Slope Indicator
Line8 = (Line4 * Line7) ; 
Line8

Here is a calculation screenshot from the Clenow Research web site (http://www.followingthetrend.com/stocks-on-the-move-figures-and-charts):
Figure-6-1-Regression-Logic-in-Excel

Here is a screenshot with the data calculated with the above script in Optuma and exported to Excel for better viewing and comparison:
screenshot - 0000

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!

Hope that helps.

Best wishes,
Thomas

Is this the same as the new Exponential Regression tool released in Optuma 2.2?

Hi Tim,

Yes it is.

All the best

Mathew

Hi Mathew,

Has the new Exponential Regression tool a scripting function?

Thanks,
Thomas

Yes, ER()

When you search for an indicator in Optuma, you can see the function name in parentheses after the indicator name.

All the best

Mathew
2023-08-13_08-08-18

I’m assuming to get the adjusted slope you need to annualize to 90 day ER() and multiply to R2?

Thanks

Tim

Like this?

Line1 = CLOSE() ; 

// Natural LOG 
Line2 = LN(Line1) ; 

// 90 Day Exponential Regression
Line3 = ER(Day(PERIODAMOUNT=1), BARS=90);

// Annualized Linear Regression Slope (Converted to Exponential) 
Line4 = (POWER(EXP(Line3), POWER=250.00)) - 1 ; 

// R-Squared
Line5 = BARINDEX() + 1 ; 
Line6 = CRL(Line5, Line2, BARS = 90, CALCSTYLE=Price) ; 
Line7 = POWER(Line6, POWER = 2.00) ; 

// Calculating the Adjusted Slope Indicator
Line8 = (Line4 * Line7) ; 
Line8