This indicator will automatically curve-fit a polynomial regression channel. The user may select any polynomial factor between 1 (a straight line) and 6 (a complex curve).

I wanted to thank you for your excellent coding of the Polynomial Regression Channel. This is a SUPERIOR INDICATOR for support, resistance and projection.

The Farlander

Your indicators are no less than excellent. I have bought the wolf wave and regression channel indicators and both are very impressive.

I have made a few thousand dollars in a couple of days.

Najam

Robert’s Regressions

aka The finest polynomial regression channel available for ThinkorSwim

 

Hi, Robert ….

I was wondering if you might want to attempt coding a Polynomial Regression Channel for Thinkorswim. I’m a huge believer in channel trading, but there has been nothing adequate coded for TOS to date. There are some poorly coded pseudo-channels on the net, but they are copies of each other and they have the same flaws.

This was a fun, although very challenging, project. I needed to study up on linear algebra so that I could understand the math involved. Then, because ThinkScript does not support arrays, matrices, or easily storing data for future reference, I had to devise creative work-arounds to handle the advanced algorithms required by this indicator.

This indicator will automatically curve-fit a polynomial regression channel. The user may select any polynomial factor between 1 (a straight line) and 6.

Fun with ThinkScript: Polynomial Regression Channel

The user may adjust the length of the channel as desired from within the settings panel.

Fun with ThinkScript: Settings Panel

Fun with ThinkScript: Polynomial Regression Channel

This indicator will work on any instrument and on any time frame. Some examples are below.

Fun with ThinkScript: Polynomial Regression Channel

Fun with ThinkScript: Polynomial Regression Channel

Fun with ThinkScript: Polynomial Regression Channel

Questions

Was this made with a T3 Moving Average or a Centered TMA with an extrapolation to the right?

No. No moving averages are involved. This is a true polynomial regression. The curve is fit based on the closing prices of each candle.

Will this work with Heiken-Ashi candles?

Yes. It will work with any chart type (tick, candle, Heiken-Ashi, etc.) and on any time frame.

Below is a screenshot of a Heiken-Ashi chart.

Fun with ThinkScript: Polynomial Regression Channel Heiken-Ashi

Updated 07 July 2021

One of the questions I’m asked most often is whether the polynomial regression channel indicator will work with the scanner. Unfortunately, the polynomial regression channel indicator is too complex to work within the limitations of the scanner. However, if you only want to scan for a 2nd order polynomial, you can use the new quadratic regression indicator. It will work with the scanner since the calculations are simpler.

2 comments

  1. Hello, I purchased the Polynomial Regression Channel script about a month ago and
    it has far exceeded my expectations. I have used other linear regression channels for years, but I have never found a script that does nearly as much at identifying trend changes. And moreover, the Polynomial Degree (1-6) is a game changer and can be utilized on any time period with amazing ease and clarity.

    Also, I have contacted Robert a couple of time with questions, and he has responded with an hour. Robert has made time to make sure I am satisfied with his product.

    I would recommend this Indicator it goes way beyond anything I used before.

  2. This is my favorite indicator of all time. Others struggle to find the edges of a move. This indicator nails the edge and catches reversals beautifully. Gives me confidence to hold a position longer knowing where the edges are.

Leave a Reply