Gentleman-Goat

Linear Regression - Auto Adjust To Ideal Pearson's R (Min & Max)

Gentleman-Goat Aktualisiert   
This is meant as a partner to my linear regression strategy script. This one however is just the indicator only so you can overlay the technique over other strategies.

To use this script you need to understand what Pearson's R is; which is how correlated a set of data is to a line within a given deviation (+ or -).

If the Pearson's R is negative (-) then the trend is going upwards. If the value is positive (+) then the trend is going downwards.

There is a lot of debate as to what the ideal negative and positive values are for the Pearson's R, so you can change these in the settings. What the script will do is attempt to automatically find (and draw the trend lines) based on a given minimum period and a maximum period (both set in the settings) that match the ideal Pearson's R settings selected.

Ideally the data is MOST correlated the closest it is to -1 or 1. This means the pattern is very reliable.

This script was designed and works very well with the bar replay mode. You may need a more professional version of TradingView to use this correctly. This mode allows you to see the script in action as it mutates and changes according to the new data being introduced.

I've pre-set the Pearson's R (+) and (-) ranges to what I think is ideal.

Versionshinweise:
This new version cleans up the code a bit and adds a better infobox thanks to richard santos and some modifications I did to his original code base. The colors of the info box are designed to better match the new oscillator partner script I uploaded as well.
Versionshinweise:
The box adjustment was not working so well so removed it for now.
Versionshinweise:
I changed the default values to 0.85 for both positive and negative to match the oscillator indicator. These can be changed in the settings. I also added alerts for the upper and upper max + lower and lower max trend lines. You can enable these alerts by going to alerts and adding a new alert then selecting my indicator and selecting from the alert options. Enjoy!
Versionshinweise:
Added new alerts for detecting bullish,bearing or sideways trends that you can set and alerts for both the long term and short term when these occurs so users can use webhooks to trigger trades based on these conditions. Some traders like to trade differently during different cycles, so this will allow you to do this programmatically now :). Thanks to TradeBoneDog for this suggestion :).

You can disable what shows in the infobox as well in the settings if you only care about seeing certain results so it doesn't get so cluttered in there ;).

-=Gentleman Goat=- Download the TradingView Input Optimizer at tradingtools.software/optimizer
Discord: discord.gg/pGHHRczpbu
Open-source Skript

Ganz im Spirit von TradingView hat der Autor dieses Skripts es als Open-Source veröffentlicht, damit Trader es besser verstehen und überprüfen können. Herzlichen Glückwunsch an den Autor! Sie können es kostenlos verwenden, aber die Wiederverwendung dieses Codes in einer Veröffentlichung unterliegt den Hausregeln. Sie können es als Favoriten auswählen, um es in einem Chart zu verwenden.

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.

Möchten Sie dieses Skript auf einem Chart verwenden?