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, is very subjective and many people (even professionals) draw different 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 scripts. In this, I use channel idea so it can check number of it contains. it also checks the angle while choosing . then we get stronger and useful automatically.
There are some option in the script, let see one by one:
Indicator: the indicator on which you want to see , Predefined Indicators are: RSI, ( ), OBV(On-Balance ), Momentum, , CMF ( ), External Indicator
External Indicator: with this option you can use other indicators as input and get for them.
- First add an indicator (such as )
- in "Indicator" option select "External Indicator"
- click "External Indicator" option
- and choose the indicator from the list
Pivot Period: The Length to calculate 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 , there must be an angle between them to choose best . you can set the angle with this option.
Minimum Strength: there can be many but we need to choose/use stronger ones. with this option you can set the number of a trend channel have to contains. default value is 2
Maximum Loopback Length: by default the script can check 40 highs and 40 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 as: you can see as "Trendline", "Channel", "Trend Channel". you can see examples below.
Enable Weak Trend Lines: if there is no strong enough (as defined in "Minimum Strength" option) you have option to see a weak . 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 . the example
Line Style: can be Solid or Dashed as you wish
Color theme: colors of the Up/Down can be set. Red, Lime, Blue, White, Black, Olive, Gray
Indicator color: colors of the Up/Down can be set. Red, Lime, Blue, White, Black, Olive, Gray and Yellow
and last options are for length options for , , Momentum, , CMF
There are many alerts such: Broken, Price in channel, line broken but still in a channel that means it broke S/R but there is another to break.
Below an example how the script uses external indicator as input and draws on it. in this example chaikin ossilator was added to the chart and get for it. (I am going to make a short video about it)
An example of Trend Channel is below. when you use trend channel option you can get "big picture" of whats going on
An example for in channels, that is the idea behind this script
An axample for for CCI:
Different colors and line styles:
Please send me message for access and do not hesitate to ask your questions about this tool.
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.
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
for RSI, added dashed line at level 50
for CCI and MFI and Momentum and MACD, added dashed line at level 0
- Ultimate Oscillator
Added "Hide Indicator Line"
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
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.
- 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"
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"
Indicator: current indicator level
Support: the support level from which Indicator started to move up
Resistance: the resistance level (if it exists)
- 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:
- 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:
- An Option added to set indicator line width (Users request)
- An issue with the arrays was fixed.
- A few improvements in the main algorithm
- 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.
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
Example screen for new divergence option:
- 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.
Screenshot of a script that get signals from "Trend Lines Pro for Indicators":
- 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
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
Example: Negatice Hidden Divergence. After negative hidden divergence the price may increase
Positive and Negative Hidden Divergence:
- 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:
Negative Hidden Divergence example:
Positive Exaggerated Divergence example:
Negative Exaggerated Divergence example:
- 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
- "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
- 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)
- 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:
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
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.
- "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)
الوصول إلى هذا النص مقيد للمستخدمين المصرح لهم من قبل المؤلف وعادة ما يكون الدفع مطلوباً. يمكنك إضافته إلى مفضلاتك، لكن لن تتمكن من استخدامه إلا بعد طلب الإذن والحصول عليه من مؤلفه. تواصل مع LonesomeTheBlue للحصول على مزيد من المعلومات، أو اتبع إرشادات المؤلف أدناه.
لا تقترح TradingView الدفع مقابل النصوص البرمجية واستخدامها حتى تثق بنسبة 100٪ في مؤلفها وتفهم كيفية عملها. في كثير من الحالات، يمكنك العثور على بديل جيد مفتوح المصدر مجانًا في المكتبة العامة.
If you want access then please send me message with your request. Thank you!
تحذير: يرجى القراءة قبل طلب الوصول.