INVITE-ONLY SCRIPT

Trend Lines Pro for Indicators

Updated
Hello Traders!

We need to make things better & better to solve the puzzle and I try to do my best on this way. now I am here with my new Trend Lines Pro for Indicators script.

As you know, Trend Lines is very subjective and many people (even professionals) draw different Trend Lines on the same chart. This is confusing and there must be an automation to make the life easer. with this tool I tried to automate it.

The idea in this script is different from my previous trend lines scripts. In this, I use channel idea so it can check number of pivot points it contains. it also checks the angle while choosing trend lines. then we get stronger and useful Trend Lines automatically.

There are some option in the script, let see one by one:

Indicator: the indicator on which you want to see Trend lines, Predefined Indicators are: RSI, CCI(Commodity Channel Index), OBV(On-Balance Volume), Momentum, MACD, CMF(Chaikin Money Flow), External Indicator

External Indicator: with this option you can use other indicators as input and get trend lines for them.
- First add an indicator (such as MFI)
- in "Indicator" option select "External Indicator"
- click "External Indicator" option
- and choose the indicator from the list

Pivot Period: The Length to calculate Pivot Highs/Lows

Threshold Rate: This rate is used for channel width. it you give bigger numbers then you get bigger channels. it's 4 by default

Minimum Angle Rate for new Trendline: if there are different trend lines , there must be an angle between them to choose best trend lines . you can set the angle with this option.

Minimum Strength: there can be many trend lines but we need to choose/use stronger ones. with this option you can set the number of pivot points a trend channel have to contains. default value is 2

Maximum Loopback Length: by default the script can check 40 pivot highs and 40 pivot lows but to make the script faster and useful I needed to add a limitation for the number of bars that the script can go back.

Show Trendlines as: you can see trend lines as "Trendline", "Channel", "Trend Channel". you can see examples below.

Enable Weak Trend Lines: if there is no trend lines strong enough (as defined in "Minimum Strength" option) you have option to see a weak trend line . that is useful sometimes. if you enable this option weak lines are shown as dotted lines.

Show Price Labels on Trendlines: the script can show the price levels to break trend lines . the example

Line Style: trend lines can be Solid or Dashed as you wish

Color theme: colors of the Up/Down Trend lines can be set. Red, Lime, Blue, White, Black, Olive, Gray

Indicator color: colors of the Up/Down Trend lines can be set. Red, Lime, Blue, White, Black, Olive, Gray and Yellow

and last options are for length options for RSI, CCI, Momentum, MACD, CMF

There are many alerts such: Support/Resistance Broken, Price in Support/Resistance channel, Support/Resistance line broken but still in a channel that means it broke S/R but there is another trend lines to break.

Below an example how the script uses external indicator as input and draws trend lines on it. in this example chaikin ossilator was added to the chart and get trend lines for it. (I am going to make a short video about it)
snapshot

An example of Trend Channel is below. when you use trend channel option you can get "big picture" of whats going on
snapshot

An example for trend lines in channels, that is the idea behind this trend lines script
snapshot

An axample for trend lines for CCI:
snapshot

Trend lines on OBV:
snapshot

Trend lines on Momentum:
snapshot

Trend lines on MACD:
snapshot

Trend lines on CMF:
snapshot

Different colors and line styles:
snapshot


Please send me message for access and do not hesitate to ask your questions about this tool.


Enjoy!


DISCLAIMER: No sharing, copying, reselling, modifying, or any other forms of use are authorized for our documents, script / strategy, and the information published with them. This informational planning script / strategy is strictly for individual use and educational purposes only. This is not financial or investment advice. Investments are always made at your own risk and are based on your personal judgement. I am not responsible for any losses you may incur. Please invest wisely.
Release Notes

Added a short video about its usage:



Good Luck!
Release Notes
New Indicator "Cumulative Delta" was added!

Cumalative Delta indicator: Delta is the difference between buyers and sellers. Cumulative Delta (Volume) is the cumulative sum of the difference between buyers and sellers

snapshot
Release Notes
Midline added to some indicators:
for RSI, added dashed line at level 50
for CCI and MFI and Momentum and MACD, added dashed line at level 0
Release Notes
Added new Indicators !
- Ultimate Oscillator
- Stochastic

Added "Hide Indicator Line"
Release Notes
Fixed.
Release Notes
New Updates:
Update: Improved algorithm to make it faster
Update: Some functions was improved
Update: Using Arrays in the script (Thanks to Pine Team for adding Arrays)
Update: Pivot Points are shown as arrows instead of H/L letters
Update: Color limitation is removed, so you can choose any color for trend lines
Update: No color limitation for Indicator line, any color can be set
Update: Now you will get Closing price and broken support/resistance levels the Alerts. as an example: you will have alerts like "Support Broken, Indicator: 45.32 Support: 46.27", where, Indicator => Indicator value, Support => Broken S/R level
Update: Following Alerts Removed: Because there are alerts when support/resistance levels broken and when Price in Support/Resistance
"Support Broken but still in channel"
"Resistance Broken but still in channel"
Fixed: if the number of total candles was less than 300 then there was no trend lines. now it can draw trend lines if number of PPs is enough to draw trend lines
Release Notes
New Updates:
Update: Alerts improved
Update: Added two new Alerts!
--------> "Price went up from Support Channel"
--------> "Price went down from Resistance Channel"
Price sometimes enters into Support/Resistance channel and it may break it or it may have reversal. when you got one of these new alerts, price may have reversal soon. I recommend you to use "Once Per Bar Close" option in the alerts. I also recommend you to use same option for Support/Resistance broken alerts.
Release Notes
An issue with the arrays was fixed. New improvements and updates are on the way
Release Notes
Updates:
- The main algorithm and some functions improved
- Alerts were improved, now you will get more info from the alerts. for example when the support/uptrend line was broken, you will get Indicator level, broken support level, the current support and resistance levels if they exist. as an example you get alert like: "Support broken, Indicator: 45.09 support: 46.13 Current Support: 38.64, Current Resistance: 54.23"
where:
Indicator
: current indicator level
Support: broken support (broken uptrend line level)
Current Support: after support (uptrend) broken, the support level (if it exists)
Current Resistance: after support (uptrend) broken, the Resistance level (if it exists)

or you will get "Indicator went up from Support Channel, Indicator: 37.24 Support:35.54 Resistance: 67.29"
where:
Indicator:
current indicator level
Support: the support level from which Indicator started to move up
Resistance: the resistance level (if it exists)
Release Notes
New Updates:
- Improvements in the main algorithm
- New Alerts added for "Pivot High" and "Pivot Low" (you should know that the Pivot Points are calculated by checking left/right candles. so what to with these alerts? for example if you get Pivot High alert in the up trend then you may think price is in a correction wave. but as Pivot Points are laggy you should not use them as buy/sell signals)
- Extra 40 and 60 lines added for RSI Indicator (Users request)
- Added new option "Add EMA?" (Exponential Moving Average). Disabled by default. If you enable this option then the script draws EMA of the current Indicator and you can set following properties of EMA line. (Users request)
--- EMA Length
--- EMA Color
--- EMA Line Width

An example for EMA line, enabled EMA for MACD:
snapshot
Release Notes
Updates:
- The main algorithm and some functions improved
- Lower band of Up Trend Channel and Upper band of Down Trend Channel were adjusted to pass on pivot points (some users requested)
- New Alerts added for Pivot High and Pivot Low (you should know that the Pivot Points are calculated by checking left/right candles. so what to with these alerts? for example if you get Pivot High alert in the up trend then you may think price is in a correction wave. but as Pivot Points are laggy you should not use them as buy/sell signals)
- A new option added "Show Last Broken Trend Line" now Last broken TrendLline can be shown on the chart up to 10 candles (you can set the length as you wish, by default it's 5). This option was added because we may need to see if it's a trap and the price will come back or if trend lines was really broken (after you get the alert Support/Resistance broken).
- When you open a chart if there is broken trend lines on last 10 bars then the script can show them now, no need to replay (1min or higher time frames). you can set the number of bars using "Show it for ? Candles" option (by default it's 5). "Show Last Broken Trend Line" option should be enabled, also "UTC" value under it must be set same as the chart timezone. important: Enabling "Show Last Broken Trend Line" causes much more calculation, so I recommend you to enable it only when you needed to check broken trend lines. (Users request)
- Important: because of the script can not know chart timezone, new UTC option added under "Show Last Broken Trend Line" option, this value is only used to calculate last N bar to show last broken trend lines. it should be same as chart timezone. You can see/change the chart timezone and/or time at the bottom bar by clicking on the clock or in the chart settings in the Symbol tab. for example: "New York UTC -4", "London UTC +1", "Berlin UTC +2", "Moscow UTC +3", "Beijing UTC +8" etc. If you have any question please contact me.
- You have "Style" and "Color" option for Last Broken Trend Lines: Dotted or Dashed. it's Dotted by default. and its color is gray by default. you can set them as you wish.
- Minimum value for Pivot Period can be set to 1 now. (it was 2). (Users request) I recommend you to use default values (it's 2 by default) and zoom the chart using lower time frames.
-Default value for Maximum loopback period set to 200, as we see it never needed to search more bars

An Example for Broken Trend Line on RSI:
snapshot

Release Notes
New Updates:
- An Option added to set indicator line width (Users request)
- An issue with the arrays was fixed.
- A few improvements in the main algorithm
Release Notes
Improved the script by using array of Lines and array of Labels instead of individual variables.
Release Notes
New Updates:
- Divergence Option added. if you enable "Show Divergences" option then the script checks divergences and shows them in the indicator window. (Explained below)
- Pre-calculation step added, so the main algorithm works much faster now
- "Show it for ? Candles" option under "Show Last Broken Trend Line" changed as "Number of Bars to Check". because it was a bit confusing for some users.
- Following New Alerts Added:
---> Negative Divergence Detected
---> Positive Divergence Detected
---> Indicator crossed over signal line (users request)
---> Indicator crossed under signal line (users request)

Explanation about newly added Divergence option:
First of all although Divergence give signals about reversal, it may not be a reversal signal all the time. I mean sometimes if trend is very strong then there may be divergence, so it may show trend stregth as well.
I see many traders use divergence indicator in a wrong way. in general Divergence indicators should be used for analysing the chart or close the position. we should take long position in uptrend, short position in downtrend.
Lets look at the following example. there is an uptrend. so we should take long position. after correction wave we take long position and later if we get divergence signal, this meaning there may be correction wave. so it may be good place to close position. but as it's uptrend, we don't take short position here, otherwise we may be in a position against the trend. if you want you can, completely it depends on your strategy and your decision.
snapshot

Positive divergence gives signal that Price may go up and Negative divergence give signal that Price may go down
. please keep in mind, this moves are NOT guaranteed, we cannot predict the future. if you don't enable "Show Divergence" option you can not get divergences alerts as well!. divergence is checked only on current indicator, for example if RSI is active then the script checks the divergence on only RSI.

Also sometimes the divergence may show trend reversal, in the following example on last Higher High (HH) there is divergence then price goes down. at this moment we don't know uptrend is over or not. then price makes New Low, then Lower High (LH) and then price breaks down New Low level and makes Lower Low. now we may think that probably uptrend ended and down trend started. we may get early signals from Trend lines
snapshot

Example screen for new divergence option:
snapshot

Release Notes
New Updates:
- Can give External Signals as input for your scripts. (you can find details below)
- "Show MACD Histogram", option added, distabled by default. if you want to see macd histogram when you choose MACD then enable this option
- "Show Divergence Label" option added, enabled by default. if you don't want to see divergence labels then disable this option

if you have script and want to get signal from "Trend Lines Pro for Indicators" then you can get following signals. you need to get external_signal as input in your script. if you have plan for it let me know then I can help about it.
snapshot

Screenshot of a script that get signals from "Trend Lines Pro for Indicators":
snapshot
Release Notes
New Updates:
- Pre-Calculation step improved
- Main algorithm improved
- Label Positioning fixed
- Hidden Divergences added
- Following options added for "Show Divergence" option:
==> Dont Show (Don't show divergences)
==> Regular (Shows Regular Divergences)
==> Hidden (Shows Hidden Divergences)
==> Regular&Hidden (Shows Regular and Hidden Divergences)
- Following two new alerts added
==> Positive Hidden Divergence Detected
==> Negative Hidden Divergence Detected

- Color option added for Positive Divergence and Negative Divergence lines


Release Notes
Explanation for Hidden Divergences:
Positive Hidden Divergence: appears on tops. Positive Hidden divergences are the signals that price may increase
Negative Hidden Divergence: appears on bottoms. Negative Hidden divergences are the signals that price may decrease

Difference between Regular and Hidden divergence is that while positive regular divergence appears at bottoms, positive hidden divergence appears at tops, and while negative regular divergence appears at tops, negative hidden divergence appears at bottoms. If you want more information about divergences then you can search it on the net or you can contact me

Example: Positive Hidden Divergence. After positive hidden divergence the price may increase
snapshot

Example: Negatice Hidden Divergence. After negative hidden divergence the price may increase
snapshot

Positive and Negative Hidden Divergence:
snapshot
Release Notes
New Updates:
- Hidden Divergences Fixed/corrected. Hidden divergence is a trend following divergence, In the uptrends it may appear at Higher Lows, and in downtrends it may appear at Lower Highs. screenshots below.
- Exaggerated Divergences Added. This is similar to regular divergence. The difference from regular is that the price makes two tops or two bottoms. The first top or bottom on the price is similar to second top or bottom but indicator shows these tops very different first to second. screenshots below.
- Added Alerts for Positive and Negative Exaggerated Divergences.

Positive Hidden Divergence example:
snapshot

Negative Hidden Divergence example:
snapshot

Positive Exaggerated Divergence example:
snapshot

Negative Exaggerated Divergence example:
snapshot
Release Notes
New Updates:
- Improvements in the main algorithm
- New options added for Price Labels of Up/Down trendlines. now you can change:
==> Price Label Size (Tiny, Small, Normal, Large)
==> Up/Downtrend Label Colors / Transparency (you can choose any color)
==> Label Text Color / Transparency (you can choose any color)

- New options added for Divergence Labels. now you can change:
==> Divergence Label size (Tiny, Small, Normal, Large)
==> Divergence Text Color / Transparency (you can choose any color)
==> Positive Divergence Color / Transparency (you can choose any color)
==> Negative Divergence Color / Transparency (you can choose any color)

- Two New Alerts added:
==> Positive Divergence Detected (Regular or Hidden or Exaggerated)
==> Negative Divergence Detected (Regular or Hidden or Exaggerated)

- Hidden and Exaggerated divergence signals added to External Signal. from your scripts you can get following signals (using External Signals)
1 => Support Broken
2 => Resistance Broken
3 => Price in Support Channel
4 => Price in Resistance Channel
5 => Price went up from Support Channel
6 => Price went down from Resistance Channel
7 => Positive Regular Divergence
8 => Negative Regular Divergence
9 => Positive Exaggerated Divergence
10 => Negative Exaggerated Divergence
11 => Positive Hidden Divergence
12 => Negative Hidden Divergence

Release Notes
New Updates:
- "ALL DIVs" option added under "Show Divergence" option. if you choose this option you can see all Regular, Hidden and Exaggerated divergences
- Update number added => "TLPu17". now you can see if you are using updated version or not
==> TLPI : Trend Lines Pro for Indicators
==> u17 : Update 17
- Line width option added for Broken Trend Lines
- Improvement in Divergence algorithm
Release Notes
New Updates (TLPIu18):
- Stochastic RSI indicator added as internal indicator
- With this update, now there is Grouping in the Indicator menu. Options are well organized and more readable
- Improvement in the algorithm
- 3 new Alerts added
==> "Support/Resistance Broken" (if you set it then you get alert when support or resistance broken)
==> "Move From Resistance/Support" (if you set it then you get alert if the price went away from Support or Resistance)
==> "Price in Support/Resistance Channel" (if you set it then you get alert when price is in Support or Resistance channel)
Release Notes
New Updates (TLPIu19):
- All in One Alert option added.
With this update you will need create only 1 alert to get all alerts for a symbol/security. You don't need to add alert for each condition anymore. You can find explanation and screenshots below.

Under the new "ALERTS" header in the options you can see the conditions and frequency options to set alerts. Frequency can be "Once Per Bar" or "Once Per Bar Close".
Conditions that you can enable/disable to get alerts:
- Support/Resistance Broken (you can get alert when Support Broken or Resistance Broken on the indicator)
- Price in Support/Resistance Channel (you can get alert when indicator is in Support Channel or Resistance Channel)
- Price went up/down from S/R (you can get alert when indicator went up from Support channel or when indicator went down from Resistance channel)
- Positive Regular Divergence
- Negative Regular Divergence
- Positive Hidden Divergence
- Negative Hidden Divergence
- Positive Exaggerated Divergence
- Negative Exaggerated Divergence

So how will you create this alert?
At the first step, go to Indicator Options and enable/disable the Conditions and set Frequency for each one as seen in the following screenshot:
snapshot

At the second step you need to create only 1 alert as seen on the following screenshot, it's same as setting alert for TLP (Trend Lines Pro), same screenshot is used
- in the Condition menu choose "TLPIu18" and "Any alert() function call"
- type a name in "Alert name" box like "TLPI All Alerts" or any other name you want
snapshot

Frequency explanation:
Once Per Bar: Has the alert trigger every time its condition is met, but not more than 1 time for each price bar.
Once Per Bar Close: Makes the alert trigger every time its condition is met at the bar's close. so you get the alert at the beginning of next candle.
Release Notes
New Updates (TLPIu20):
- "Indicator cross over/under signal line" alerts added into all-in-one alerts (users request)
- Now indicator name is shown on the left side (you can disable it using "Show Indicator Name" option) (users request)
Release Notes
New Updates: TLPIu21
- Upgraded to Pine version 5!
- ATR and MFI indicators added!
- Location of the indicator name is now shown at left-bottom and its location will not change when window size is changed
- Maximum value for "Number of Bars to Check" for Broken trend lines increased to 50 (was 10)
- Color options added for the indicator and EMA line. (default colors are Lime/Red for both, and you can set them as you wish)
- Name option added for "External indicator". its default value is "External Indicator" and you can change it as you wish
- Momentum indicator definition fixed
- Explanation added to the options
Release Notes
New Updates: TLPIv22.0
- "Divergence Labels" option added under Divergences menu. You have 3 options: "Don't Show", "Show Last", "Show All". Show Last option can be used if you want to see only last divergence labels
- "Max Number of Bars to Search" option added under Divergences menu. You can set the number of bars up to 100 to search divergences. by default it's 80 bars.
- The source for Money Flow Index indicator changed as hlc3 => (high+low+close)/3
- "New Trendlines" Alert option added. if you enable it you can get alert when new trend lines appeared
- Custom Alert Message options with Place Holders added for each Alert. now you can customize each alert messages as you wish! (all custom messages set by default and can be changed if needed)
-- Place Holders that can be used in Custom Alert Messages:
---- {{BrokenSupport}} => gets the level of broken Up trend line on last bar
---- {{BrokenResistance}} => gets the level of broken Down trend line on last bar
---- {{CurrentSupport}} => gets closer Support level if there is any
---- {{CurrentResistance}} => gets closer Resistance level if there is any
---- {{ticker}} => gets Ticker info
---- {{time}} => gets the time in which the Alert triggered. you should set UTC accordingly to get the time correct!
---- {{timeframe}} => gets time frame of the chart
---- {{indivalue}} => gets the indicator when the alert was triggered
---- {{indiname}} => gets the Indicator name when the alert was triggered
---- {{signalvalue}} => gets the Signal line value when the alert was triggered

Some examples for Custom Alert Messages
=> {{ticker}}, {{timeframe}}, {{indiname}}, Resistance Broken, Indicator:{{indivalue}}, Broken Resistance:{{BrokenResistance}}, Current Resistance:{{CurrentResistance}}, Current Support:{{CurrentSupport}}
====> BTCUSDT, 30, RSI, Resistance Broken, Indicator:37.12, Broken Resistance:36.45, Current Resistance:58.71, Current Support: 28.94

=> {{ticker}}, {{timeframe}}, Bounce back up from Support Channel, Indicator:{{indivalue}}, Support:{{CurrentSupport}}, Resistance:{{CurrentResistance}}
====> BTCUSDT, 30, Bounce back up from Support Channel, Indicator:21.76, Support:20.43, Resistance:48.63

Release Notes
New Updates: TLPIv23.0
- "Shaded channels" option added. The Channels can be shown as shaded. You can change colors and transparency. Please see the examples below
- New placeholders added: {{high}}, {{low}}, {{close}}
- Minimum value of "Maximum loopback length" can be set to 20 now. (minimum value was 100, users request)
- The main algorithm slightly improved

Examples for Shaded Channels:
snapshot
snapshot
snapshot
Release Notes
New Updates: TLP23.1
- EMA/SMA option added for the signal line under 'Extras' menu
- Stepline option added for the indicator line. (you can see the example below)
- "show price labels" changed as "show indicator labels"

Stepline:
snapshot
Release Notes
New Updates: TLPIv24.0
- A lot of improvements. Much more faster algorithm.
- "Min Divergence Length" feature added. You can set the minimum length between divergences points
- Added second SMA/EMA option. Now you can add 2 moving averages.
Centered OscillatorsdivergenceshiddendivergencelonesometheblueOscillatorsregulardivergenceTrend AnalysistrendchannelstrendfollowingTrend Line Breaktrendlinesuport

Invite-only script

Access to this script is restricted to users authorized by the author and usually requires payment. You can add it to your favorites, but you will only be able to use it after requesting permission and obtaining it from its author. Contact LonesomeTheBlue for more information, or follow the author's instructions below.

TradingView does not suggest paying for a script and using it unless you 100% trust its author and understand how the script works. In many cases, you can find a good open-source alternative for free in our Community Scripts.

Author's instructions

If you want access then please send me message with your request. Thank you!

Want to use this script on a chart?

Warning: please read before requesting access.

Disclaimer