| kmcintyre Legend ![]() ![]() ![]() ![]() Posts: 410 Joined: 8/30/2007 Location: Valley Center, CA User Profile | I posted this to the OT Pro forum, but I was not able to attach files... So, here it is again... I have been working on a few indicators based on using Linear Regression "best fit" lines. I have 4 indicators - indLRLPlot - plots a Linear Regression Line (LRL) in the price pane indLRLPercent - returns the % delta between the final Close and the LRL indLRLSlope - returns the slope of the LRL in % per bar indLRLVariance - returns the variance between the max excursion and the LRL over the period of the LRL I am using these indicators with OmniScan to find underlyings that meet specific conditions. I also use the indicators as sortable columns in the Focus List I am currently only using this for prospecting. I have not created any Systems or Strategies leveraging LRL indicators (yet). So that's the executive summary. Now for a deeper dive. (Read on if interested...) I want to be able to find underlyings that are rising smoothly. I want to be able to find underlyings that are moving sideways with very high volatility. I want to be able to find underlyings that have been in a 6 month downtrend, but are sharply up over the past month. Etc. To that end, I created the MyLRL library. It uses math and statistics to better empower OmniScan. The core of MyLRL is the Linear Regression line (aka the "best fit" line) This is provided by OL, but is a little tricky to use. indLRLPlot has two parameters, Periods and Offset. Periods is the length of the drawn LRL. Offset is the bars from the HRE where the LRL ends. Using indLRLPlot results in a straight line drawn through price bars. The LRL is the best possible line based on Close prices. indLRLVariance provides a measurement of the overall tendency to hug or wander away from the LRL. Normally, Variance is based on the mean of the sample data. As such, the mean is a single number. A flat line... indLRLVariance differs in that it uses the actual LRL values, bar by bar, as the mean. Think of it as a "de-trended variance". Also, indLRLVariance includes a Sensitivity parameter. Normal Variance uses a square of the delta between the mean and each data point. The Sensitivity parameter allows for specifying an exponent other than 2 for the calculation. A larger exponent (Sensitivity ) "punishes" excursions from the mean to a greater extent. Finally, normal Variance returns an absolute number. indLRLVariance normalizes the variance to a percentage based on the LRL's ending value. This allows the indLRLVariance value to be easily compared between underlyings. indLRLSlope returns the slope of the LRL, as a percent change per bar. This is relative to the LRL itself. This tells me the daily % increase or decrease over the length of the LRL. Since this is in %, I can easily compare the slope of different underlyings. indLRLPercent tells me how far the Close of the final bar is from the LRL. I can easily determine if the "current" price is near or far away from the LRL. That's a deeper dive into the four indicators. Now some notes on why and how I am using this stuff. Due to the way charts are automatically scaled, it is very difficult to compare recent performance just by eyeballing the chart. Using math and statistics, I can easily determine which underlyings are gaining the most, losing the most, going nowhere, etc. I can also accurately determine which underlyings are experiencing the least volatility. Or the most volatility. Or anywhere inbetween. And unlike ATR, RSI, MACD, and many other indicators, the trend of the underlying is central to calculating the indicators. The Offset parameter is also very useful. I can model combinations of longer term trends with shorter term trends. (like multi-timeframe analysis...) To support the Offset parameter, all the indicators carry forward their final LRL value through the HRE., So I can determine the slope of a LRL that ended 21 bars ago with a OmniScan running at the HRE. Ditto for the Variance and Percent indicators. The MyLRL indicators are not dis-similar to the KAMA, DAMA, and SAMA indicators. THe same logic can be used to determine "market state". But I prefer to think of this as "market state" for the specific underlying. I would not attempt to trade AMZN based on using the MyyLRL indicators on the SPY . I plan to do some studies to determine the persistence of the LRL moving forward in time. Will a 63 bar LRL predict the next 21 bars? Whith what probability? Can I use MyLRL to filter strategies, as in "Adaptive TRading"? Can I use the GA to tune LRL Period and Offset values? But for now, I just want to find smooth underlyings that are easily beating the market. TO that end, I use a OmniScan sort filter of indLRLSlope(63, 0) / indLRLVariance(63,0,2) The numerator finds the strongest bull stocks over the past 63 bars. The denominator punishes the underlyings if they have high volatility. The resulst are (seemingly) great trend trading candidates... This same technique can be used to find the top stocks in smooth bearish trends. Or sideways on low volatility. Or sideways with extreme volatility. Whatever the case, I have option strategies for each style of market... I hope others can use this to increase their trade expectancy. Happy Trading! And Happy 4th of July. USA - The best nation on earth. The slayer of slavery. The country many are willing to risk life and limb to immigrate to. THe country where ALL races and creeds are free to succeed. The "Shining Light On THe Hill"... God Bless America! Attached file : MyLRL(63,0) - OS sort using LRL indicators.png (53KB - 384 downloads) Attached file : MyLRL(63,0) - indicator columns.png (53KB - 382 downloads) Attached file : MyLRL(126.0) - 6 month with no offset.png (53KB - 288 downloads) Attached file : MyLRL(63,21) - 21 bar offset.png (53KB - 322 downloads) Attached file : indLRLPercent.txt (0KB - 312 downloads) Attached file : indLRLSlope.txt (0KB - 315 downloads) Attached file : indLRLVariance.txt (1KB - 325 downloads) Attached file : tplLRLine.otd (144KB - 296 downloads) | |