Trend Lines [LuxAlgo]Our new "Trend Lines" indicator detects and highlights relevant trendlines on the user chart while keeping it free of as much clutter as possible.
The indicator is thought for real-time usage and includes several filters as well as the ability to estimate trendline angles.
🔶 USAGE
Trendlines can act as support/resistance, with a higher number of tests indicating a more significant support/resistance role.
A broken TrendLine can be indicative of a potential trend reversal. The script highlights breaks with a label.
Users can additionally filter trendlines, only showing trendlines whose angles fall within a user set range:
This allows for the removal of potential clutter from the chart but also helps keep steeper or more horizontal trendlines.
🔶 DETAILS
When a swing (pivot point) is found, a Trendline is drawn when certain conditions are fulfilled.
An essential condition is that a Bearish Trendline (red) always occurs on a lower high, while a Bullish Trendline (blue) occurs on a higher low.
Our implementation will first show an initial dotted-styled TrendLine on confirmation, after which a solid-styled secondary TrendLine will develop. The latter will be used for the real-time detection of breaks at that line:
Furthermore, the script allows you to add more conditions:
🔹 Length (Swings)
A swing develops when a high/low is the highest/lowest against x highs/lows on the left AND right of that bar. x can be set by "Length" in settings.
The following images clarify this. The script confirms a swing where the yellow flag is shown; the high (here visualized with a purple label) is the highest point against x bars left and right of that point.
At that moment, this swing is checked against the previous swing. If all conditions are fulfilled, an initial TrendLine is drawn on confirmation.
After that point, a secondary thicker solid line is seen which keeps progressing bar after bar, until:
• a new TrendLine is formed
• the TrendLine is broken
🔹 Breaks between Swings
Once there is confirmation that a TrendLine can be drawn, the script allows you to filter for breakthroughs on that line. This can be set with "Check breaks between"
Disabled : the initial TrendLine is allowed to be pierced:
Check breaks between point A - point B : no breaks are allowed between both Swing points:
Point A - Current bar : no breaks are allowed between the first Swing point and the point of confirmation ('current' bar):
🔹 TrendLine breaks
As mentioned, the secondary TrendLine (solid line) progresses bar after bar until a new TrendLine is formed or the TrendLine is broken. When a TrendLine is broken, the TrendLine stops progressing, but if there isn't a new TrendLine and price return back, the TrendLine will re-appear, potentially giving several signals when the TrendLine is broken again.
Minimal bars allow you to regulate the amount of signals when the TrendLine is broken.
-> The secondary TrendLine must be uninterrupted for at least x bars before a potential break can be considered.
The following example shows 1 signal against 3 by adjusting this setting from 2 to 5:
🔹 Angles
Angles should normally be calculated when the units of the X and Y axis are the same. However, on our charts, the unit of the X-axis is bar_index (bars), and on the Y-axis the unit is price (¥, €, £, $,...).
It is not easy to normalize and create reasonably valid angles. Often certain angle calculations can differ through price changes or volatility.
Our calculate_slope() function tries to make corresponding angles through all bars.
We do this by calculating the difference between the highest/lowest price values in a certain bar range. The bar range is our X-axis, and the price difference is our Y-axis.
Zooming in/out will not change the amount of bars or the price. Since it does change our view on the chart, and thereby how we see the angles, we have included a setting where you can personalize the ratio between X and Y-axis (Angles -> Ratio X-Y axis).
Settings: Angles - Ratio X-Y axis:
🔶 SETTINGS
🔹 Swings
Length: Lookback period for the detection of swing points.
🔹 Trendline validation
Check breaks between :
Disabled : the initial TrendLine is allowed to be pierced
Check breaks between point A - point B : no breaks are allowed between both Swing points
Point A - Current bar : no breaks are allowed between the first Swing point and the point of confirmation ('current' bar)
Source (breaks) : Source which invalidates TrendLine, default: close
🔹 TrendLine breaks
Minimal bars : The secondary TrendLine must be uninterrupted for at least x bars before a potential break can be considered.
🔹 Angles
Show : Toggle labels.
Ratio X-Y axis : Every user has his preferences regarding zoom, chart layout,...
If the shown angles are not according to your expectations, you can adjust this number.
Only TrendLine between : Only allow TrendLines between the minimum and maximum degrees. Set only the minimal and maximum values above 0.
Angles
Display Trade Volume with MA Angle and Price VelocityThis Pine Script indicator is designed to provide traders with a visual representation of trade volume, moving average (MA) angle, and price velocity on a chart. The primary components of this indicator are:
Trade Volume: The indicator compares the current bar's trade volume with the average volume over a user-defined lookback period. The volume is displayed as either "Low" or "Trade" in a table, with red or green background color, respectively, to indicate whether it's below or above the average volume.
MA Angle: The indicator calculates the angle of the moving average (either Simple, Exponential, or Hull) over a user-defined length. A positive angle is shown in green, while a negative angle is shown in red. The angle is displayed in degrees in the table.
Price Velocity: This component calculates the velocity of price movement by comparing the difference between high and low prices over a user-defined lookback period. It then displays the velocity as either "Slow" or "Fast" in the table, with red or green background color, respectively, depending on whether it's below or above the average difference.
The indicator also includes alert conditions for high and low volume situations, notifying the trader when the current bar's volume is significantly higher or lower than the average volume.
TrigLibrary "Trig"
Trigonometric functions
rt_get_angleAlpha(a, b, c, deg)
Get angle α of a right triangle, given the lengths of its sides
Parameters:
a : length of leg a (float)
b : length of leg b (float)
c : length of hypotenuse (float)
deg : flag to return angle in degrees (bool - default = false)
Returns: angle α in radians (or degrees if deg == true)
rt_get_angleAlphaFromLine(x1, y1, x2, y2, l, deg)
Get angle α of a right triangle formed by the given line
Parameters:
x1 : x coordinate 1 (int - optional, required if argument l is not specified)
y1 : y coordinate 1 (float - optional, required if argument l is not specified)
x2 : x coordinate 2 (int - optional, required if argument l is not specified)
y2 : y coordinate 2 (float - optional, required if argument l is not specified)
l : line object (line - optional, required if x1, y1, x2, and y2 agruments are not specified)
deg : flag to return angle in degrees (bool - default = false)
Returns: angle α in radians (or degrees if deg == true)
rt_get_angleBeta(a, b, c, deg)
Get angle β of a right triangle, given the lengths of its sides
Parameters:
a : length of leg a (float)
b : length of leg b (float)
c : length of hypotenuse (float)
deg : flag to return angle in degrees (bool - default = false)
Returns: angle β in radians (or degrees if deg == true)
rt_get_angleBetaFromLine(x1, y1, x2, y2, l, deg)
Get angle β of a right triangle formed by the given line
Parameters:
x1 : x coordinate 1 (int - optional, required if argument l is not specified)
y1 : y coordinate 1 (float - optional, required if argument l is not specified)
x2 : x coordinate 2 (int - optional, required if argument l is not specified)
y2 : y coordinate 2 (float - optional, required if argument l is not specified)
l : line object (line - optional, required if x1, y1, x2, and y2 agruments are not specified)
deg : flag to return angle in degrees (bool - default = false)
Returns: angle β in radians (or degrees if deg == true)
Chop Zone - SamXThis is my spin on the Chop Zone indicator. It was forked from the built-in TradingView Chop Zone indicator. There were several reasons for this effort...
The built-in indicator version had no real configuration options
It was hard-coded to use the 34-period EMA with fixed span sizes for identifying price range
There was no real context to the meaning of default color scheme
The separation points of the chop zone bars was at a fixed 1.43-degree scale
Note: If left at default settings, this indicator will exactly match the built-in Chop Zone indicator.
WARNING : Please be sure you understand the potential impact and implications before adjusting any of the settings in the "Advanced Configuration" section!!!
Chop Zone with discrete/standard coloring:
Chop Zone with gradient fill:
Moving Average angle plot with gradient fill:
Gann FanHello All,
For long time I have been getting many requests about Gann Fan indicator. now we have linefill() function in Pine Language and I think it's right time to make Gann Fan Indicator. Many Thanks to Pine Team for adding many new features to the Pine Language!
How this indicator works:
- It calculates midline (1/1)
- By using midline it calculates other lines (1/2, 1/3, 1/4...etc)
- It calculates highest/lowest Pivot Points in last 280 bars.( by default it's 280 bars, you can change it and pivot period )
- It checks the location of highest/lowest Pivot Points
- After the calculation of the Gann Fan lines, it draws lines, puts Labels and paints the zones between the lines according to the colors set by the user
Long time ago I created a special algorithm for calculating the line with 45 degree and I used it for "1/1" line. Anybody who needs it can use this algorithm freely ;)
Options:
You can change following items;
- The colors
- Transparency. Possible values for transparency are from 0 (not transparent) to 100 (invisible)
- Line styles
- Loopback Period (by default it's 280)
- Pivot Period (by default it's 5)
- Enable/disable Labels
- Label location (by default it's 50
Tradingview Gann Fan page : The Gann Fan is a technical analysis tool created by WD Gann. The tool is comprised of 9 diagonal lines (extending indefinitely) designed to show different support and resistance levels on a chart. These angles -drawn from main tops and bottoms- divide time and price into proportionate parts and are often used to predict areas of support and resistance, key tops and bottoms and future price moves. Please note that the chart needs to be scaled properly to ensure the market has a square relationship....
Enjoy!
Triple-Angle Trend SignalAn enhancement and iteration of lmatl's "angle bar colors " to enable multiple angle bars (up to 3) each with customisable price sources, angle periods, thresholds of degrees, line thicknesses and colours. Full history is displayed of when the selected angle bars have all been within higher degrees (green background) and lower degrees (red background).
This indicator is useful when it is customised to suit individual charts where it can specify conditions to find entries on uptrends and exits on downtrends.
Reference Angle Function - for developers█ OVERVIEW
This function should give you a correct output in a circle of 360°. It is meant to be used by developers/pine-script-coders to figure out reference angles.
Conditions :
1. If the angle given to this function is in between 0-360 then it would give you the same angle without any modifications
2. If the angle given is greater than 360° - for example : 540°, - then it would output 180° which is the angle after a complete revolution.
3. If the angle given is negative, then it would go counter clockwise and give you the angle.
4. If the angle is negative and less than -360°, then it would also give you the actual correct degree after counting the revolution and flipping it to positive.
Feel free to play with it or use it if you need to. I already included some test inputs to show you how it would work.
Cosmic AngleThis is a histogram that can display a moving average's angle and also show how volatile the change in angle is.
To use:
Add any moving average indicator to the chart
Click that indicator's More > Add Indicator on (MA)
Select the Cosmic Angle indicator
Adjust the Cosmic Angle 's Price To Bar Ratio value to reflect that of your chart's
Adjust the Cosmic Angle 's Threshold as per your liking (*1)
(*1) This setting affects the bar colors. It represents the minimum difference in degrees between the n and n-1 bars' angle to force a change of color.
angle bar colors [LM]Hello guys,
I would like to introduce you angle bar colors indicator. It colors bars depending the angle of the bar x length back and current one
lime angle > 70 degrees
green 20 < angle < 70 degrees
orange 0 > angle <= 20 degrees
purple 0 > angle >= -20 degrees
red -20 > angle > -70 degrees
maroon angle < -70 degrees
Any suggestions are welcome
ma angles - JDthis indicator gives you the angles of different moving averages
this can give an indication of the momentum of a move increasing or decreasing
you can also set a threshold for a minimum angle to filter out "no trade" zones
JD.
#NotTradingAdvice #DYOR
I build these indicators for myself and provide them open source, to use for free to use and improve upon,
as I believe the best way to learn is toghether.
Angular Trend [DW]This is an experimental study designed to outline the trend of a security based on the average angular change of price.
New lines are drawn whenever the source's angle of change is equal to zero.