The Periodic Linear Regressions (PLR) indicator calculates linear regressions periodically (similar to the VWAP indicator) based on a user-set period (anchor).

This allows for estimating underlying trends in the price, as well as providing potential supports/resistances.

🔶 USAGE

スナップショット

The Periodic Linear Regressions indicator calculates a linear regression over a user-selected interval determined from the selected "Anchor Period".

The PLR can be visualized as a regular linear regression (Static), with a fit readjusting for new data points until the end of the selected period, or as a moving average (Rolling), with new values obtained from the last point of a linear regression fitted over the calculation interval. While the static method line is prone to repainting, it has value since it can further emphasize the linearity of an underlying trend, as well as suggest future trend directions by extrapolating the fit.

スナップショット

Extremities are included in the indicator, these are obtained from the root mean squared error (RMSE) between the price and calculated linear regression. The Multiple setting allows the users to control how far each extremity is from the other.

Periodic Linear Regressions can be helpful in finding support/resistance areas or even opportunities when ranging in a channel.

スナップショット

スナップショット

The anchor - where a new period starts - can be shown (in this case in the top right corner).

スナップショット

The shown bands can be visualized by enabling Show Extremities in settings (Rolling or Static method).

スナップショット

The script includes a background gradient color option for the bands, which only applies when using the Rolling method.

The indicator colors can be suggestive of the detected trend and are determined as follows:

  • Method Rolling: a gradient color between red and green indicates the trend; more green if the output is rising, suggesting an uptrend, and more red if it is decreasing, suggesting a downtrend.
  • Method Static: green if the slope of the line is positive, suggesting an uptrend, red if negative, suggesting a downtrend.


🔶 DETAILS

🔹 Anchor Type

When the Anchor Type is set to Periodic, the indicator will be reset when the "Anchor Period" changes, after which calculations will start again.

An anchored rolling line set at First Bar won't reset at a new session; it will continue calculating the linear regression from the first bar to the last; in other words, every bar is included in the calculation. This can be useful to detect potential long-term tops/bottoms.

スナップショット

Note that a linear regression needs at least two values for its calculation, which explains why you won't see a static line at the first bar of the session. The rolling linear regression will only show from the 3rd bar of the session since it also needs a previous value.

🔹 Rolling/Static

When Anchor Type is set at Periodic, a linear regression is calculated between the first bar of the chosen session and the current bar, aiming to find the line that best fits the dataset.

スナップショット

The example above shows the lines drawn during the session. The offered script, though, shows the last calculated point connected to the previous point when the Rolling method is chosen, while the Static method shows the latest line.

スナップショット

Note that linear regression needs at least two values, which explains why you won't see a static line at the first bar of the session. The rolling line will only show from the 3rd bar of the session since it also needs a previous value.

🔶 SETTINGS

  • Method: Indicator method used, with options: "Static" (straight line) / "Rolling" (rolling linear regression).
  • Anchor Type: "Periodic / First Bar" (the latter works only when "Method" is set to "Rolling").
  • Anchor Period: Only applicable when "Anchor Type" is set at "Periodic".
  • Source: open, high, low, close, ...
  • Multiple: Alters the width of the bands when "Show Extremities" is enabled.
  • Show Extremities: Display one upper and one lower extremity.


🔹 Color Settings

  • Mono Color: color when "Bicolor" is disabled
  • Bicolor: Toggle on/off + Colors
  • Gradient: Background color when "Show extremities" is enabled + level of gradient


🔹 Dashboard

  • Show Dashboard
  • Location of dashboard
  • Text size
bandslinear-regressionLinear RegressionluxalgoParallel ChannelperiodicregressionsupportSupport and ResistancesupportandresistancezonesTrend Analysis

オープンソーススクリプト

TradingViewの精神に則り、このスクリプトの作者は、トレーダーが理解し検証できるようにオープンソースで公開しています。作者に敬意を表します!無料で使用することができますが、このコードを投稿で再利用するには、ハウスルールに準拠する必要があります。 お気に入りに登録してチャート上でご利用頂けます。

チャートでこのスクリプトを利用したいですか?


Get access to our exclusive tools: luxalgo.com

Join our 150k+ community: discord.gg/lux

All content provided by LuxAlgo is for informational & educational purposes only. Past performance does not guarantee future results.
他のメディア:

免責事項