**The Sweet Lord**, here is the Gaur's Polynomial Regression Channel.

Its a Polynomial Regression Channel but applied a little differently. Wont go into technical details much. Overview of options is as follows-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Channel Options

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

1. Degree of Polynomial: 1/2/3

Default = 3

Defines the degree of polynomials - 1,2,3. Note here, degree 1 will not be a straight line since its applied differently.

Try different degrees for different fits and market conditions.

2. Channel Length:

Default 30 (candles)

You can go beyond 100 or 200 candle lengths but smaller is the usual preference of Poly-Reg-channel traders. It all depends on market conditions and your style of trading. Do your research. I am usually comfortable with a range of 20-50 (in crypto markets).

3. Basis of Channel height/boundries: ATR/Manual

Default: ATR

ATR provides a dynamically adjusted entry/exit bounds of the channels. As ATR changes, the channel bounds also changes its height. It can also be fixed manually. Manual heights wont change automatically.

4. Basis of Y-Value: open/close/ sma / ema / wma /hilow

Default: close

Y- value is the y value of the (x,y) coordinates used while calculating the regression coefficients. Dont worry about it, its nothing serious.

5. Apply channel smoothning using sma?: Yes/No

Default: Yes

Without smoothning, the channel does not "look" good.

6. Shaded Area Height Percentage:

Its the extra margin for the channel. Its in percentage of the total height (defined 3 above) of channels. The shaded area provides an extra allowance for your entries or exits beyond the ATR or manual heights.

7. Plot RSI?: Yes/No

Default: Yes

Plots RSI ( orange line in between the channel - its different from the dotted center line) considering the downbound of channels as 0 (oversold) and upbound of channels as 100 (overbought)

8. Plot 200 sma?: Yes/No

Default: Yes

It plots a 200 period fast (green) and 225 period slow (red) sma . I usually use two MAs. Its visually very easy to understand.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Sample Strategy

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

You can develop your own strategy with the channels. But following is just one of the ways you can trade.

Best Application: Ranging markets. But can be happily used in volatile conditions, with a little experience.

1. SMA: -- (this condition is optional really)

If green (200) is above red (225) go only long. If red is above green go only short. Defines long term trend of the market.

2. Channel slope: -- (this stuff needs practice/experience)

Depending on the channel slope, like if its tending to go up or down, you can choose to take only short or long trades. It defines short term momentum of the market.

3. ATR based heights:

Since its ATR based, the channel height are our natural entry and exit points.

Long:

When price touches lower shaded area, consider possible long entry. Exit on price entering the upper shaded area.

Short:

Enter on upper bound shaded area, exit on lower.

4. RSI:

For additional conformations. Again note, the RSI considers the lower bound of channel as 0 and upper as 100. But since, the channel moves up and down, the RSI will also move not only as RSI but also with the channel. Meaning, say if the RSI is valued at 50, then it will be near the center of the channel but since the center changes as time and price changes, the RSI valued at 50 at different times will not be at the same horizontal level respect to the graph, although it will be at the same level (center) respect to the channel.

5. PRC Channel Percentage label:

This label is at the lower side a bit ahead of the current candle. Provides you info on what is the channel percentage. This is especially helpful in crypto markets to gauge your possible percentage profit where profits can be much higher than forex or other instruments. It can also helps you select a suitable market/instrument if the channels are based on ATR.

6. Extra indicators:

I usually use stochastic along with this setup for extra conformations.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Donate

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Use freely and donate generously if you find value. Your help will really help.

I had earlier provided BTC addresses for donations but it seems to violate TV House rules.

Hope they make TV coins redeemable in future.

- Pranav Joshi

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Extra Info

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

// © cpranavjoshi

// special thanks to the "Trading View" people for providing this great platform for free

// ------------------------

// MATH

// ------------------------

// special thanks to an article on the web that provided layman friendly explanation of the maths

// unfortunately i wont be able to provide the link to that article owing to TV restrictions, though i sincerely would have liked to credit the author.

// Google search this phrase, and you should be able to get it in one of the first results - "polynomialregression Mathematics of Polynomial Regression"

// my regression math calculation is a further resolution upon the generalized matrix formula given in the that article.

// the generalized matrix looks scary but in fact its much simpler than one may assume

// the summation sign things are just float numbers that can be easily found out

// so we get a matrix with number of equations equal to the number of unknowns.

// e.g. if its a 3rd degree poly, it has 4 unknowns (c0,c1,c2,c3) with 4 equations as in the generalized matrix

// it can be resolved by simple algebra

// Note: the results have been verified with excel using same input data points.

// pine was difficult for me so i coded it in python first to verify

// ------------------------

// WHY

// ------------------------

// this script was coded because Pranav badly needed Polynomial channels (had used them in mt4 earlier)

// and at the time of this coding, i could not find any readily available script in the trading view public library ( tnx public)

// the complex math was probably the hurdle

// i m not good in maths, but by the Will of the Lord, i could resolve the issue with simple algebra and logic

// ------------------------

// PINE

// ------------------------

// i am just an average (even poor probably) programmer and pine script is not my language

// this is a humble attempt to write my first pine with whatever i could do quickly

// experts - feel free to develop if needed. have used some workarounds in drawings/plottings. rectify them if possible

//

//

// - Pranav Joshi