Luxy Adaptive MA Cloud - Trend Strength & Signal Tracker V2Luxy Adaptive MA Cloud  - Professional Trend Strength & Signal Tracker
Next-generation moving average cloud indicator combining ultra-smooth gradient visualization with intelligent momentum detection. Built for traders who demand clarity, precision, and actionable insights.
 ═══════════════════════════════════════════════ 
  WHAT MAKES THIS INDICATOR SPECIAL? 
 ═══════════════════════════════════════════════ 
Unlike traditional MA indicators that show static lines, Luxy Adaptive MA Cloud creates a  living, breathing visualization  of market momentum. Here's what sets it apart:
 
 Exponential Gradient Technology 
This isn't just a simple fill between two lines. It's a professionally engineered gradient system with 26 precision layers using exponential density distribution. The result? An organic, cloud-like appearance where the center is dramatically darker (15% transparency - where crossovers and price action occur), while edges fade gracefully (75% transparency). Think of it as a visual "heat map" of trend strength.
  Dynamic Momentum Intelligence 
Most MA clouds only show  structure  (which MA is on top). This indicator shows  momentum strength  in real-time through four intelligent states:
- 🟢  Bright Green  = Explosive bullish momentum (both MAs rising strongly)
- 🔵  Blue  = Weakening bullish (structure intact, but momentum fading)
- 🟠  Orange  = Caution zone (bearish structure forming, weak momentum)
- 🔴  Deep Red  = Strong bearish momentum (both MAs falling)
The cloud literally  tells you  when trends are accelerating or losing steam.
  Conditional Performance Architecture 
Every calculation is optimized for speed. Disable a feature? It stops calculating entirely—not just hidden, but  not computed . The 26-layer gradient only renders when enabled. Toggle signals off? Those crossover checks don't run. This makes it one of the most efficient cloud indicators available, even with its advanced visual system.
  Zero Repaint Guarantee 
All signals and momentum states are based on  confirmed bar data only . What you see in historical data is  exactly  what you would have seen trading live. No lookahead bias. No repainting tricks. No signals that "magically" appear perfect in hindsight. If a signal shows in history, it would have triggered in real-time at that exact moment.
  Educational by Design 
Every single input includes comprehensive tooltips with:
- Clear explanations of what each parameter does
- Practical examples of when to use different settings
- Recommended configurations for scalping, day trading, and swing trading
- Real-world trading impact ("This affects entry timing" vs "This is visual only")
You're not just getting an indicator—you're learning  how to use it effectively .
 
  
 ═══════════════════════════════════════════════ 
  THE GRADIENT CLOUD - TECHNICAL DETAILS 
 ═══════════════════════════════════════════════ 
 Architecture: 
 
 26 precision layers  for silk-smooth transitions
 Exponential density curve  - layers packed tightly near center (where crossovers happen), spread wider at edges
 75%-15% transparency range  - center is highly opaque (15%), edges fade gracefully (75%)
 V-Gradient design  - emphasizes the action zone between Fast and Medium MAs
 
 The Four Momentum States: 
🟢  GREEN - Strong Bullish 
 
 Fast MA above Medium MA
 Both MAs rising with momentum > 0.02%
 Action: Enter/hold LONG positions, strong uptrend confirmed
 
🔵  BLUE - Weak Bullish 
 
 Fast MA above Medium MA
 Weak or flat momentum
 Action: Caution - bullish structure but losing strength, consider trailing stops
 
🟠  ORANGE - Weak Bearish 
 
 Medium MA above Fast MA
 Weak or flat momentum  
 Action: Warning - bearish structure developing, consider exits
 
🔴  RED - Strong Bearish 
 
 Medium MA above Fast MA
 Both MAs falling with momentum < -0.02%
 Action: Enter/hold SHORT positions, strong downtrend confirmed
 
 Smooth Transitions:  The momentum score is smoothed using an 8-bar EMA to eliminate noise and prevent whipsaws. You see the  true trend , not every minor fluctuation.
  
 ═══════════════════════════════════════════════ 
  FLEXIBLE MOVING AVERAGE SYSTEM 
 ═══════════════════════════════════════════════ 
 Three Customizable MAs: 
 
 Fast MA  (default: EMA 10) - Reacts quickly to price changes, defines short-term momentum
 Medium MA  (default: EMA 20) - Balances responsiveness with stability, core trend reference
 Slow MA  (default: SMA 200, optional) - Long-term trend filter, major support/resistance
 
 Six MA Types Available: 
 
 EMA  - Exponential; faster response, ideal for momentum and day trading
 SMA  - Simple; smooth and stable, best for swing trading and trend following
 WMA  - Weighted; middle ground between EMA and SMA
 VWMA  - Volume-weighted; reflects market participation, useful for liquid markets
 RMA  - Wilder's smoothing; used in RSI/ADX, excellent for trend filters
 HMA  - Hull; extremely responsive with minimal lag, aggressive option
 
 Recommended Settings by Trading Style: 
 Scalping (1m-5m): 
 
Fast: EMA(5-8)
Medium: EMA(10-15)
Slow: Not needed or EMA(50)
 
 Day Trading (5m-1h): 
 
Fast: EMA(10-12)
Medium: EMA(20-21)
Slow: SMA(200) for bias
 
 Swing Trading (4h-1D): 
 
Fast: EMA(10-20)
Medium: EMA(34-50)
Slow: SMA(200)
 
 Pro Tip:  Start with Fast < Medium < Slow lengths. The gradient works best when there's clear separation between Fast and Medium MAs.
  
 ═══════════════════════════════════════════════ 
  CROSSOVER SIGNALS - CLEAN & RELIABLE 
 ═══════════════════════════════════════════════ 
 Golden Cross  ⬆  LONG Signal 
 
 Fast MA crosses  above  Medium MA
 Classic bullish reversal or trend continuation signal
 Most reliable when accompanied by GREEN cloud (strong momentum)
 
 Death Cross  ⬇  SHORT Signal 
 
 Fast MA crosses  below  Medium MA  
 Classic bearish reversal or trend continuation signal
 Most reliable when accompanied by RED cloud (strong momentum)
 
 Signal Intelligence: 
 
 Anti-spam filter  - Minimum 5 bars between signals prevents noise
 Clean labels  - Placed precisely at crossover points
 Alert-ready  - Built-in ALERTS for automated trading systems
 No repainting  - Signals based on confirmed bars only
 
 Signal Quality Assessment: 
 High-Quality Entry: 
 
Golden Cross + GREEN cloud + Price above both MAs
= Strong bullish setup ✓
 
 Low-Quality Entry (skip or wait): 
 
Golden Cross + ORANGE cloud + Choppy price action
= Weak bullish setup, likely whipsaw ✗
 
  
 ═══════════════════════════════════════════════ 
  REAL-TIME INFO PANEL 
 ═══════════════════════════════════════════════ 
An at-a-glance dashboard showing:
 Trend Strength Indicator: 
 
 Visual display of current momentum state
 Color-coded header matching cloud color
 Instant recognition of market bias
 
 MA Distance Table: 
Shows percentage distance of price from each enabled MA:
 
 Green rows : Price ABOVE MA (bullish)
 Red rows : Price BELOW MA (bearish)
 Gray rows : Price AT MA (rare, decision point)
 
 Distance Interpretation: 
 
+2% to +5%: Healthy uptrend
+5% to +10%: Getting extended, caution
+10%+: Overextended, expect pullback
-2% to -5%: Testing support
-5% to -10%: Oversold zone
-10%+: Deep correction or downtrend
 
 Customization: 
 
 4 corner positions
 5 font sizes (Tiny to Huge)
 Toggle visibility on/off
 
 ═══════════════════════════════════════════════ 
  HOW TO USE - PRACTICAL TRADING GUIDE 
 ═══════════════════════════════════════════════ 
 STRATEGY 1: Trend Following 
 
 Identify trend : Wait for GREEN (bullish) or RED (bearish) cloud
 Enter on signal : Golden Cross in GREEN cloud = LONG, Death Cross in RED cloud = SHORT
 Hold position : While cloud maintains color
 Exit signals :
   • Cloud turns ORANGE/BLUE = momentum weakening, tighten stops
   • Opposite crossover = close position
   • Cloud turns opposite color = full reversal
 
 STRATEGY 2: Pullback Entries 
 
 Confirm trend : GREEN cloud established (bullish bias)
 Wait for pullback : Price touches or crosses below Fast MA
 Enter when : Price rebounds back above Fast MA with cloud still GREEN
 Stop loss : Below Medium MA or recent swing low
 Target : Previous high or when cloud weakens
 
 STRATEGY 3: Momentum Confirmation 
 
 Your setup triggers : (e.g., chart pattern, support/resistance)
 Check cloud color :
   • GREEN = proceed with LONG
   • RED = proceed with SHORT  
   • BLUE/ORANGE = skip or reduce size
 Use gradient as confluence : Not as primary signal, but as momentum filter
 
 Risk Management Tips: 
 
 Never enter against the cloud color (don't LONG in RED cloud)
 Reduce position size during BLUE/ORANGE (transition periods)
 Place stops beyond Medium MA for swing trades
 Use Slow MA (200) as final trend filter - don't SHORT above it in uptrends
 
  
 ═══════════════════════════════════════════════ 
  PERFORMANCE & OPTIMIZATION 
 ═══════════════════════════════════════════════ 
 Tested On: 
 
 Crypto: BTC, ETH, major altcoins
 Stocks: SPY, AAPL, TSLA, QQQ
 Forex: EUR/USD, GBP/USD, USD/JPY
 Indices: S&P 500, NASDAQ, DJI
 
 ═══════════════════════════════════════════════ 
  TRANSPARENCY & RELIABILITY 
 ═══════════════════════════════════════════════ 
 Educational Focus: 
 
 Detailed tooltips on every input
 Clear documentation of methodology
 Practical examples in descriptions
 Teaches you  why , not just  what 
 
 Open Logic: 
 
 Momentum calculation: (Fast slope + Medium slope) / 2
 Smoothing: 8-bar EMA to reduce noise
 Thresholds: ±0.02% for strong momentum classification
 Everything is transparent and explainable
 
 ═══════════════════════════════════════════════ 
  COMPLETE FEATURE LIST 
 ═══════════════════════════════════════════════ 
 Visual Components: 
 
 26-layer exponential gradient cloud
 3 customizable moving average lines
 Golden Cross / Death Cross labels
 Real-time info panel with trend strength
 MA distance table
 
 Calculation Features: 
 
 6 MA types (EMA, SMA, WMA, VWMA, RMA, HMA)
 Momentum-based cloud coloring
 Smoothed trend strength scoring
 Conditional performance optimization
 
 Customization Options: 
 
 All MA lengths adjustable
 All colors customizable (when gradient disabled)
 Panel position (4 corners)
 Font sizes (5 options)
 Toggle any feature on/off
 
 Signal Features: 
 
 Anti-spam filter (configurable gap)
 Clean, non-overlapping labels
 Built-in alert conditions
 No repainting guarantee
 
 ═══════════════════════════════════════════════ 
  IMPORTANT DISCLAIMERS 
 ═══════════════════════════════════════════════ 
 
 This indicator is for  educational and informational purposes only 
 Not financial advice - always do your own research
 Past performance does not guarantee future results
 Use proper risk management - never risk more than you can afford to lose
 Test on paper/demo accounts before using with real money
 Combine with other analysis methods - no single indicator is perfect
 Works best in trending markets; less effective in choppy/sideways conditions
 Signals may perform differently in different timeframes and market conditions
 The indicator uses historical data for MA calculations - allow sufficient lookback period
 
 ═══════════════════════════════════════════════ 
  CREDITS & TECHNICAL INFO 
 ═══════════════════════════════════════════════ 
 Version:  2.0
 Release:  October 2025
 Special Thanks: 
 
 TradingView community for feedback and testing
 Pine Script documentation for technical reference
 
 ═══════════════════════════════════════════════ 
  SUPPORT & UPDATES 
 ═══════════════════════════════════════════════ 
 Found a bug?  Comment below with:
 
 Ticker symbol
 Timeframe
 Screenshot if possible
 Steps to reproduce
 
 Feature requests?  I'm always looking to improve! Share your ideas in the comments.
 Questions?  Check the tooltips first (hover over any input) - most answers are there. If still stuck, ask in comments.
 ═══════════════════════════════════════════════ 
 Happy Trading!  
Remember: The best indicator is the one you understand and use consistently. Take time to learn how the cloud behaves in different market conditions. Practice on paper before going live. Trade smart, manage risk, and may the trends be with you! 🚀
Visual
Geo. Geo.
This library provides a comprehensive set of geometric functions based on 2 simple types for point and line manipulation, point array calculations, some vector operations (Borrowed from @ricardosantos ), angle calculations, and basic polygon analysis.  It offers tools for creating, transforming, and analyzing geometric shapes and their relationships.  
View the source code for detailed documentation on each function and type.
═════════════════════════════════════════════════════════════════════════
█  OVERVIEW 
This library enhances TradingView's Pine Script with robust geometric capabilities. It introduces the  Point  and  Line  types, along with a suite of functions for various geometric operations. These functionalities empower you to perform advanced calculations, manipulations, and analyses involving points, lines, vectors, angles, and polygons directly within your Pine scripts. The example is  at the bottom of the script. ( Commented out )
█  CONCEPTS 
This library revolves around two fundamental types:
 •  Point:  Represents a point in 2D space with x and y coordinates, along with optional 'a' (angle) and 'v' (value) fields for versatile use.  Crucially, for plotting, utilize the `.to_chart_point()` method to convert Points into plottable chart.point objects.
 •  Line:  Defined by a starting  Point  and a  slope , enabling calculations like getting y for a given x, or finding intersection points.
█  FEATURES 
 •  Point Manipulation:   Perform operations like addition, subtraction, scaling, rotation, normalization, calculating distances, dot products, cross products, midpoints, and more with  Point  objects.
 •  Line Operations:  Create lines, determine their slope, calculate y from x (and vice versa), and find the intersection points of two lines.
 •  Vector Operations:  Perform vector addition, subtraction, multiplication, division, negation, perpendicular vector calculation, floor, fractional part, sine, absolute value, modulus, sign, round, scaling, rescaling, rotation, and ceiling operations.
 •  Angle Calculations:   Compute angles between points in degrees or radians, including signed, unsigned, and 360-degree angles.
 •  Polygon Analysis:  Calculate the area, perimeter, and centroid of polygons. Check if a point is inside a given polygon and determine the convex hull perimeter.
 •  Chart Plotting:  Conveniently convert  Point  objects to  chart.point  objects for plotting lines and points on the chart.  The library also includes functions for plotting lines between individual and series of points.
 •  Utility Functions:  Includes helper functions such as square root, square, cosine, sine, tangent, arc cosine, arc sine, arc tangent, atan2, absolute distance, golden ratio tolerance check, fractional part, and safe index/check for chart plotting boundaries.
█  HOW TO USE 
1 — Include the library in your script using:
 
import kaigouthro/geo/1
 
2 — Create  Point  and  Line  objects:
 
p1 = geo.Point(bar_index, close)
p2 = geo.Point(bar_index , open)
myLine = geo.Line(p1, geo.slope(p1, p2))
// maybe use that line to detect a crossing for an alert ... hmmm
 
3 — Utilize the provided functions:
 
distance = geo.distance(p1, p2)
intersection = geo.intersection(line1, line2)
 
4 — For plotting labels, lines, convert  Point  to  chart.point :
 
label.new(p1.to_chart_point(), " Hi ")
line.new(p1.to_chart_point(),p2.to_chart_point())
 
█  NOTES 
This description provides a concise overview. Consult the library's source code for in-depth documentation, including detailed descriptions, parameter types, and return values for each function and method. The source code is structured with comprehensive comments using the `//@` format for seamless integration with TradingView's auto-documentation features.
█  Possibilities.. 
  
  
Library   "geo" 
This library provides a comprehensive set of geometric functions and types, including point and line manipulation, vector operations, angle calculations, and polygon analysis. It offers tools for creating, transforming, and analyzing geometric shapes and their relationships.
 sqrt(value) 
  Square root function
  Parameters:
     value (float) : (float) - The number to take the square root of
  Returns: (float) - The square root of the input value
 sqr(x) 
  Square function
  Parameters:
     x (float) : (float) - The number to square
  Returns: (float) - The square of the input value
 cos(v) 
  Cosine function
  Parameters:
     v (float) : (series float) - The value to find the cosine of
  Returns: (series float) - The cosine of the input value
 sin(v) 
  Sine function
  Parameters:
     v (float) : (series float) - The value to find the sine of
  Returns: (series float) - The sine of the input value
 tan(v) 
  Tangent function
  Parameters:
     v (float) : (series float) - The value to find the tangent of
  Returns: (series float) - The tangent of the input value
 acos(v) 
  Arc cosine function
  Parameters:
     v (float) : (series float) - The value to find the arc cosine of
  Returns: (series float) - The arc cosine of the input value
 asin(v) 
  Arc sine function
  Parameters:
     v (float) : (series float) - The value to find the arc sine of
  Returns: (series float) - The arc sine of the input value
 atan(v) 
  Arc tangent function
  Parameters:
     v (float) : (series float) - The value to find the arc tangent of
  Returns: (series float) - The arc tangent of the input value
 atan2(dy, dx) 
  atan2 function
  Parameters:
     dy (float) : (float) - The y-coordinate
     dx (float) : (float) - The x-coordinate
  Returns: (float) - The angle in radians
 gap(_value1, __value2) 
  Absolute distance between any two float values
  Parameters:
     _value1 (float) : First value
     __value2 (float) 
  Returns: Absolute Positive Distance
 phi_tol(a, b, tolerance) 
  Check if the ratio is within the tolerance of the golden ratio
  Parameters:
     a (float) : (float) The first number
     b (float) : (float) The second number
     tolerance (float) : (float) The tolerance percennt as 1 = 1 percent
  Returns: (bool) True if the ratio is within the tolerance, false otherwise
 frac(x) 
  frad Fractional
  Parameters:
     x (float) : (float) - The number to convert to fractional
  Returns: (float) - The number converted to fractional
 safeindex(x, limit) 
  limiting int to hold the value within the chart range
  Parameters:
     x (float) : (float) - The number to limit
     limit (int) 
  Returns: (int) - The number limited to the chart range
 safecheck(x, limit) 
  limiting int check if within the chartplottable range
  Parameters:
     x (float) : (float) - The number to limit
     limit (int) 
  Returns: (int) - The number limited to the chart range
 interpolate(a, b, t) 
  interpolate between two values
  Parameters:
     a (float) : (float) - The first value
     b (float) : (float) - The second value
     t (float) : (float) - The interpolation factor (0 to 1)
  Returns: (float) - The interpolated value
 gcd(_numerator, _denominator) 
  Greatest common divisor of two integers
  Parameters:
     _numerator (int) 
     _denominator (int) 
  Returns: (int) The greatest common divisor
 method set_x(self, value) 
  Set the x value of the point, and pass point for chaining
  Namespace types: Point
  Parameters:
     self (Point) : (Point) The point to modify
     value (float) : (float) The new x-coordinate
 method set_y(self, value) 
  Set the y value of the point, and pass point for chaining
  Namespace types: Point
  Parameters:
     self (Point) : (Point) The point to modify
     value (float) : (float) The new y-coordinate
 method get_x(self) 
  Get the x value of the point
  Namespace types: Point
  Parameters:
     self (Point) : (Point) The point to get the x-coordinate from
  Returns: (float) The x-coordinate
 method get_y(self) 
  Get the y value of the point
  Namespace types: Point
  Parameters:
     self (Point) : (Point) The point to get the y-coordinate from
  Returns: (float) The y-coordinate
 method vmin(self) 
  Lowest element of the point
  Namespace types: Point
  Parameters:
     self (Point) : (Point) The point
  Returns: (float) The lowest value between x and y
 method vmax(self) 
  Highest element of the point
  Namespace types: Point
  Parameters:
     self (Point) : (Point) The point
  Returns: (float) The highest value between x and y
 method add(p1, p2) 
  Addition
  Namespace types: Point
  Parameters:
     p1 (Point) : (Point) - The first point
     p2 (Point) : (Point) - The second point
  Returns: (Point) - the add of the two points
 method sub(p1, p2) 
  Subtraction
  Namespace types: Point
  Parameters:
     p1 (Point) : (Point) - The first point
     p2 (Point) : (Point) - The second point
  Returns: (Point) - the sub of the two points
 method mul(p, scalar) 
  Multiplication by scalar
  Namespace types: Point
  Parameters:
     p (Point) : (Point) - The point
     scalar (float) : (float) - The scalar to multiply by
  Returns: (Point) - the multiplied point of the point and the scalar
 method div(p, scalar) 
  Division by scalar
  Namespace types: Point
  Parameters:
     p (Point) : (Point) - The point
     scalar (float) : (float) - The scalar to divide by
  Returns: (Point) - the divided point of the point and the scalar
 method rotate(p, angle) 
  Rotate a point around the origin by an angle (in degrees)
  Namespace types: Point
  Parameters:
     p (Point) : (Point) - The point to rotate
     angle (float) : (float) - The angle to rotate by in degrees
  Returns: (Point) - the rotated point
 method length(p) 
  Length of the vector from origin to the point
  Namespace types: Point
  Parameters:
     p (Point) : (Point) - The point
  Returns: (float) - the length of the point
 method length_squared(p) 
  Length squared of the vector
  Namespace types: Point
  Parameters:
     p (Point) : (Point) The point
  Returns: (float) The squared length of the point
 method normalize(p) 
  Normalize the point to a unit vector
  Namespace types: Point
  Parameters:
     p (Point) : (Point) - The point to normalize
  Returns: (Point) - the normalized point
 method dot(p1, p2) 
  Dot product
  Namespace types: Point
  Parameters:
     p1 (Point) : (Point) - The first point
     p2 (Point) : (Point) - The second point
  Returns: (float) - the dot of the two points
 method cross(p1, p2) 
  Cross product result (in 2D, this is a scalar)
  Namespace types: Point
  Parameters:
     p1 (Point) : (Point) - The first point
     p2 (Point) : (Point) - The second point
  Returns: (float) - the cross of the two points
 method distance(p1, p2) 
  Distance between two points
  Namespace types: Point
  Parameters:
     p1 (Point) : (Point) - The first point
     p2 (Point) : (Point) - The second point
  Returns: (float) - the distance of the two points
 method Point(x, y, a, v) 
  Point Create Convenience
  Namespace types: series float, simple float, input float, const float
  Parameters:
     x (float) 
     y (float) 
     a (float) 
     v (float) 
  Returns: (Point) new point
 method angle(p1, p2) 
  Angle between two points in degrees
  Namespace types: Point
  Parameters:
     p1 (Point) : (Point) - The first point
     p2 (Point) : (Point) - The second point
  Returns: (float) - the angle of the first point and the second point
 method angle_between(p, pivot, other) 
  Angle between two points in degrees from a pivot point
  Namespace types: Point
  Parameters:
     p (Point) : (Point) - The point to calculate the angle from
     pivot (Point) : (Point) - The pivot point
     other (Point) : (Point) - The other point
  Returns: (float) - the angle between the two points
 method translate(p, from_origin, to_origin) 
  Translate a point from one origin to another
  Namespace types: Point
  Parameters:
     p (Point) : (Point) - The point to translate
     from_origin (Point) : (Point) - The origin to translate from
     to_origin (Point) : (Point) - The origin to translate to
  Returns: (Point) - the translated point
 method midpoint(p1, p2) 
  Midpoint of two points
  Namespace types: Point
  Parameters:
     p1 (Point) : (Point) - The first point
     p2 (Point) : (Point) - The second point
  Returns: (Point) - The midpoint of the two points
 method rotate_around(p, angle, pivot) 
  Rotate a point around a pivot point by an angle (in degrees)
  Namespace types: Point
  Parameters:
     p (Point) : (Point) - The point to rotate
     angle (float) : (float) - The angle to rotate by in degrees
     pivot (Point) : (Point) - The pivot point to rotate around
  Returns: (Point) - the rotated point
 method multiply(_a, _b) 
  Multiply vector _a with _b
  Namespace types: Point
  Parameters:
     _a (Point) : (Point) The first point
     _b (Point) : (Point) The second point
  Returns: (Point) The result of the multiplication
 method divide(_a, _b) 
  Divide vector _a by _b
  Namespace types: Point
  Parameters:
     _a (Point) : (Point) The first point
     _b (Point) : (Point) The second point
  Returns: (Point) The result of the division
 method negate(_a) 
  Negative of vector _a
  Namespace types: Point
  Parameters:
     _a (Point) : (Point) The point to negate
  Returns: (Point) The negated point
 method perp(_a) 
  Perpendicular Vector of _a
  Namespace types: Point
  Parameters:
     _a (Point) : (Point) The point
  Returns: (Point) The perpendicular point
 method vfloor(_a) 
  Compute the floor of argument vector _a
  Namespace types: Point
  Parameters:
     _a (Point) : (Point) The point
  Returns: (Point) The floor of the point
 method fractional(_a) 
  Compute the fractional part of the elements from vector _a
  Namespace types: Point
  Parameters:
     _a (Point) : (Point) The point
  Returns: (Point) The fractional part of the point
 method vsin(_a) 
  Compute the sine of argument vector _a
  Namespace types: Point
  Parameters:
     _a (Point) : (Point) The point
  Returns: (Point) The sine of the point
 lcm(a, b) 
  Least common multiple of two integers
  Parameters:
     a (int) : (int) The first integer
     b (int) : (int) The second integer
  Returns: (int) The least common multiple
 method vabs(_a) 
  Compute the absolute of argument vector _a
  Namespace types: Point
  Parameters:
     _a (Point) : (Point) The point
  Returns: (Point) The absolute of the point
 method vmod(_a, _b) 
  Compute the mod of argument vector _a
  Namespace types: Point
  Parameters:
     _a (Point) : (Point) The point
     _b (float) : (float) The mod
  Returns: (Point) The mod of the point
 method vsign(_a) 
  Compute the sign of argument vector _a
  Namespace types: Point
  Parameters:
     _a (Point) : (Point) The point
  Returns: (Point) The sign of the point
 method vround(_a) 
  Compute the round of argument vector _a
  Namespace types: Point
  Parameters:
     _a (Point) : (Point) The point
  Returns: (Point) The round of the point
 method normalize_y(p, height) 
  normalizes the y value of a point to an input height
  Namespace types: Point
  Parameters:
     p (Point) : (Point)      - The point to normalize
     height (float) : (float) - The height to normalize to
  Returns: (Point)      - the normalized point
 centroid(points) 
  Calculate the centroid of multiple points
  Parameters:
     points (array) : (array) The array of points
  Returns: (Point) The centroid point
 random_point(_height, _width, _origin, _centered) 
  Random Point in a given height and width
  Parameters:
     _height (float) : (float) The height of the area to generate the point in
     _width (float) : (float) The width of the area to generate the point in
     _origin (Point) : (Point) The origin of the area to generate the point in (default: na, will create a Point(0, 0))
     _centered (bool) : (bool) Center the origin point in the area, otherwise, positive h/w (default: false)
  Returns: (Point) The random point in the given area
 random_point_array(_origin, _height, _width, _centered, _count) 
  Random Point Array in a given height and width
  Parameters:
     _origin (Point) : (Point) The origin of the area to generate the array (default: na, will create a Point(0, 0))
     _height (float) : (float) The height of the area to generate the array
     _width (float) : (float) The width of the area to generate the array
     _centered (bool) : (bool) Center the origin point in the area, otherwise, positive h/w (default: false)
     _count (int) : (int) The number of points to generate (default: 50)
  Returns: (array) The random point array in the given area
 method sort_points(points, by_x) 
  Sorts an array of points by x or y coordinate
  Namespace types: array
  Parameters:
     points (array) : (array) The array of points to sort
     by_x (bool) : (bool) Whether to sort by x-coordinate (true) or y-coordinate (false)
  Returns: (array) The sorted array of points
 method equals(_a, _b) 
  Compares two points for equality
  Namespace types: Point
  Parameters:
     _a (Point) : (Point) The first point
     _b (Point) : (Point) The second point
  Returns: (bool) True if the points are equal, false otherwise
 method max(origin, _a, _b) 
  Maximum of two points from origin, using dot product
  Namespace types: Point
  Parameters:
     origin (Point) 
     _a (Point) : (Point) The first point
     _b (Point) : (Point) The second point
  Returns: (Point) The maximum point
 method min(origin, _a, _b) 
  Minimum of two points from origin, using dot product
  Namespace types: Point
  Parameters:
     origin (Point) 
     _a (Point) : (Point) The first point
     _b (Point) : (Point) The second point
  Returns: (Point) The minimum point
 method avg_x(points) 
  Average x of point array
  Namespace types: array
  Parameters:
     points (array) : (array) The array of points
  Returns: (float) The average x-coordinate
 method avg_y(points) 
  Average y of point array
  Namespace types: array
  Parameters:
     points (array) : (array) The array of points
  Returns: (float) The average y-coordinate
 method range_x(points) 
  Range of x values in point array
  Namespace types: array
  Parameters:
     points (array) : (array) The array of points
  Returns: (float) The range of x-coordinates
 method range_y(points) 
  Range of y values in point array
  Namespace types: array
  Parameters:
     points (array) : (array) The array of points
  Returns: (float) The range of y-coordinates
 method max_x(points) 
  max of x values in point array
  Namespace types: array
  Parameters:
     points (array) : (array) The array of points
  Returns: (float) The max of x-coordinates
 method min_y(points) 
  min of x values in point array
  Namespace types: array
  Parameters:
     points (array) : (array) The array of points
  Returns: (float) The min of x-coordinates
 method scale(_a, _scalar) 
  Scale a point by a scalar
  Namespace types: Point
  Parameters:
     _a (Point) : (Point) The point to scale
     _scalar (float) : (float) The scalar value
  Returns: (Point) The scaled point
 method rescale(_a, _length) 
  Rescale a point to a new magnitude
  Namespace types: Point
  Parameters:
     _a (Point) : (Point) The point to rescale
     _length (float) : (float) The new magnitude
  Returns: (Point) The rescaled point
 method rotate_rad(_a, _radians) 
  Rotate a point by an angle in radians
  Namespace types: Point
  Parameters:
     _a (Point) : (Point) The point to rotate
     _radians (float) : (float) The angle in radians
  Returns: (Point) The rotated point
 method rotate_degree(_a, _degree) 
  Rotate a point by an angle in degrees
  Namespace types: Point
  Parameters:
     _a (Point) : (Point) The point to rotate
     _degree (float) : (float) The angle in degrees
  Returns: (Point) The rotated point
 method vceil(_a, _digits) 
  Ceil a point to a certain number of digits
  Namespace types: Point
  Parameters:
     _a (Point) : (Point) The point to ceil
     _digits (int) : (int) The number of digits to ceil to
  Returns: (Point) The ceiled point
 method vpow(_a, _exponent) 
  Raise both point elements to a power
  Namespace types: Point
  Parameters:
     _a (Point) : (Point) The point
     _exponent (float) : (float) The exponent
  Returns: (Point) The point with elements raised to the power
 method perpendicular_distance(_a, _b, _c) 
  Distance from point _a to line between _b and _c
  Namespace types: Point
  Parameters:
     _a (Point) : (Point) The point
     _b (Point) : (Point) The start point of the line
     _c (Point) : (Point) The end point of the line
  Returns: (float) The perpendicular distance
 method project(_a, _axis) 
  Project a point onto another
  Namespace types: Point
  Parameters:
     _a (Point) : (Point) The point to project
     _axis (Point) : (Point) The point to project onto
  Returns: (Point) The projected point
 method projectN(_a, _axis) 
  Project a point onto a point of unit length
  Namespace types: Point
  Parameters:
     _a (Point) : (Point) The point to project
     _axis (Point) : (Point) The unit length point to project onto
  Returns: (Point) The projected point
 method reflect(_a, _axis) 
  Reflect a point on another
  Namespace types: Point
  Parameters:
     _a (Point) : (Point) The point to reflect
     _axis (Point) : (Point) The point to reflect on
  Returns: (Point) The reflected point
 method reflectN(_a, _axis) 
  Reflect a point to an arbitrary axis
  Namespace types: Point
  Parameters:
     _a (Point) : (Point) The point to reflect
     _axis (Point) : (Point) The axis to reflect to
  Returns: (Point) The reflected point
 method angle_rad(_a) 
  Angle in radians of a point
  Namespace types: Point
  Parameters:
     _a (Point) : (Point) The point
  Returns: (float) The angle in radians
 method angle_unsigned(_a, _b) 
  Unsigned degree angle between 0 and +180 by given two points
  Namespace types: Point
  Parameters:
     _a (Point) : (Point) The first point
     _b (Point) : (Point) The second point
  Returns: (float) The unsigned angle in degrees
 method angle_signed(_a, _b) 
  Signed degree angle between -180 and +180 by given two points
  Namespace types: Point
  Parameters:
     _a (Point) : (Point) The first point
     _b (Point) : (Point) The second point
  Returns: (float) The signed angle in degrees
 method angle_360(_a, _b) 
  Degree angle between 0 and 360 by given two points
  Namespace types: Point
  Parameters:
     _a (Point) : (Point) The first point
     _b (Point) : (Point) The second point
  Returns: (float) The angle in degrees (0-360)
 method clamp(_a, _vmin, _vmax) 
  Restricts a point between a min and max value
  Namespace types: Point
  Parameters:
     _a (Point) : (Point) The point to restrict
     _vmin (Point) : (Point) The minimum point
     _vmax (Point) : (Point) The maximum point
  Returns: (Point) The restricted point
 method lerp(_a, _b, _rate_of_move) 
  Linearly interpolates between points a and b by _rate_of_move
  Namespace types: Point
  Parameters:
     _a (Point) : (Point) The starting point
     _b (Point) : (Point) The ending point
     _rate_of_move (float) : (float) The rate of movement (0-1)
  Returns: (Point) The interpolated point
 method slope(p1, p2) 
  Slope of a line between two points
  Namespace types: Point
  Parameters:
     p1 (Point) : (Point) - The first point
     p2 (Point) : (Point) - The second point
  Returns: (float) - The slope of the line
 method gety(self, x) 
  Get y-coordinate of a point on the line given its x-coordinate
  Namespace types: Line
  Parameters:
     self (Line) : (Line) - The line
     x (float) : (float) - The x-coordinate
  Returns: (float) - The y-coordinate
 method getx(self, y) 
  Get x-coordinate of a point on the line given its y-coordinate
  Namespace types: Line
  Parameters:
     self (Line) : (Line) - The line
     y (float) : (float) - The y-coordinate
  Returns: (float) - The x-coordinate
 method intersection(self, other) 
  Intersection point of two lines
  Namespace types: Line
  Parameters:
     self (Line) : (Line) - The first line
     other (Line) : (Line) - The second line
  Returns: (Point) - The intersection point
 method calculate_arc_point(self, b, p3) 
  Calculate a point on the arc defined by three points
  Namespace types: Point
  Parameters:
     self (Point) : (Point) The starting point of the arc
     b (Point) : (Point) The middle point of the arc
     p3 (Point) : (Point) The end point of the arc
  Returns: (Point) A point on the arc
 approximate_center(point1, point2, point3) 
  Approximate the center of a spiral using three points
  Parameters:
     point1 (Point) : (Point) The first point
     point2 (Point) : (Point) The second point
     point3 (Point) : (Point) The third point
  Returns: (Point) The approximate center point
 createEdge(center, radius, angle) 
  Get coordinate from center by radius and angle
  Parameters:
     center (Point) : (Point) - The center point
     radius (float) : (float) - The radius of the circle
     angle (float) : (float) - The angle in degrees
  Returns: (Point) - The coordinate on the circle
 getGrowthFactor(p1, p2, p3) 
  Get growth factor of spiral point
  Parameters:
     p1 (Point) : (Point) - The first point
     p2 (Point) : (Point) - The second point
     p3 (Point) : (Point) - The third point
  Returns: (float) - The growth factor
 method to_chart_point(point) 
  Convert Point to chart.point using chart.point.from_index(safeindex(point.x), point.y)
  Namespace types: Point
  Parameters:
     point (Point) : (Point) - The point to convert
  Returns: (chart.point) - The chart.point representation of the input point
 method plotline(p1, p2, col, width) 
  Draw a line from p1 to p2
  Namespace types: Point
  Parameters:
     p1 (Point) : (Point) First point
     p2 (Point) : (Point) Second point
     col (color) 
     width (int) 
  Returns: (line) Line object
 method drawlines(points, col, ignore_boundary) 
  Draw lines between points in an array
  Namespace types: array
  Parameters:
     points (array) : (array) The array of points
     col (color) : (color) The color of the lines
     ignore_boundary (bool) : (bool) The color of the lines
 method to_chart_points(points) 
  Draw an array of points as chart points on the chart with line.new(chartpoint1, chartpoint2, color=linecolor)
  Namespace types: array
  Parameters:
     points (array) : (array) - The points to draw
  Returns: (array) The array of chart points
 polygon_area(points) 
  Calculate the area of a polygon defined by an array of points
  Parameters:
     points (array) : (array) The array of points representing the polygon vertices
  Returns: (float) The area of the polygon
 polygon_perimeter(points) 
  Calculate the perimeter of a polygon
  Parameters:
     points (array) : (array) Array of points defining the polygon
  Returns: (float) Perimeter of the polygon
 is_point_in_polygon(point, _polygon) 
  Check if a point is inside a polygon
  Parameters:
     point (Point) : (Point) The point to check
     _polygon (array) 
  Returns: (bool) True if the point is inside the polygon, false otherwise
 method perimeter(points) 
  Calculates the convex hull perimeter of a set of points
  Namespace types: array
  Parameters:
     points (array) : (array) The array of points
  Returns: (array) The array of points forming the convex hull perimeter
 Point 
  A Point, can be used for vector, floating calcs, etc. Use the cp method for plots
  Fields:
     x (series float) : (float) The x-coordinate
     y (series float) : (float) The y-coordinate
     a (series float) : (float) An Angle storage spot
     v (series float) : (float) A Value
 Line 
  Line
  Fields:
     point (Point) : (Point) The starting point of the line
     slope (series float) : (float) The slope of the line
GOMTRY.
Background ZonesThis script provides up to 5 zones to apply background colors. This is especially useful for applying to indices such as  USI:TICK ,  USI:ADD , and  USI:VOLD , where certain levels provides significant meaning to market sentiment and directions. This script will give you the visual cue to help with your trading.
All levels and colors are fully customizable.
Enjoy~!!
Example:
 
Close Combination Lock Style - Visual AppealThis creates a combination style closing price change on each tick.  
 
  It has two theme options, one as silver dials for Dark Theme and the other as black dials for White Theme.
  We get fixated to watching closing prices on charts and it gets visually daunting. This creates a combination style price change which updates on each tick, which is quite pleasing to the eye. 
  When new price is above current center line, it shift the above prices showing ▲ arrow, and if new price is lower, it will shift the bottom prices showing ▼ arrow. If there is no change in price between the ticks, it will show =. 
 
MA VisualizerThe MA Visualizer is made up of 5 Moving Averages (MA)
All MA change color when the price closes above or below the MA line.
The background between the MA line and price will also change color, this creates the Visualizer.
When two or more MA are selected the two visualizer's will combine and create a gradient effect.
Each MA can be adjusted with 6 source selection's to choose from (SMA , EMA , WMA , HMA , RMA , WVMA).
The Visualizer can be turned off while leaving the MA lines turned on and vice versa.
Their is also a MA Cross indicator built-in.
Heikin Ashi Candle OverlayHello Friend,
This is a very simple script for fun to demonstrate the new ability to change the colors of attributes pertaining to the plotbar() and plotcandle() functions using series inputs. 
For Heiken Ashi lovers, this script does several things. It gives you both bars and hollow candles with Heikin Ashi values - something TV does not currently support. 
It also gives you the ability to see your favorite HA candles while on the main series plot. When viewing indicators in the "Heikin Ashi" candle setting on TradingView, the input values are "smoothed' with HA values. This skews the way your indicators behave as the OLHC are calculated averages. Only the regular candle settings will give your indicators "real close" etc. 
By 'Muting' the main series bars by toggling the 👁 symbol next to your ticker id, it makes the normal candles invisible. You then overlay this script, which allows you to see the HA Candle of your choice, while not affecting the way your indicators behave.
You now have the best of 2 worlds. Smoothed behavior of price action to help visualize trends, and accurate indicator values derived from actual OLHC data. 
Plus, something about hollow HA candles is just kind of clean and soothing isn't it? 
Cheers,
Bjorgum
 Hollow Setting: 
  
 Bars 
  
 Or just plain old regular, but on the main chart 
 
Visual Candlestick Blender (Analysis Tool), by @BlueJayBird- This is a analysis tool.
 Brief Description 
- It generates candlestick containers for current timeframe, using OPEN/HIGH/CLOSE/LOW data from higher time frames.
- Current version supports up to 4 CVB at the same time. Usually using only 2 is enough.
- Vertical extended divisions for 1h, 4h, 1D and 1W using background lines are included too.
* Report any bugs or feedback you have.
NOTE. At current unclosed candlestick , some weird line painting it is expected. It is not a bug, it is a Trading View feature that I haven't been able to solve yet. To solve this, setting the VCB off and then on should be enough.
Trading With Colors7 hours ago
Hello friends. This is simply a moving average ribbon, per se. The values for the colored ribbon can have their length calculated to fit their chosen resolution on the current one. This solved problems for me, but it was my own solution. Maybe I'll learn something new from sharing this.
To everybody else who is learning as well, this script essentially serves to introduce other time-frame moving averages. This intends to helps traders find the scope of relevance and not get lost in the current time-frame.
Besides the colored moving averages (2 sets, different resolutions, great zoomed in our out), I included optional check-boxes to allow comparison of sets of moving averages at will, so that the most important to the individual trader can be compared and selected specifically.
I kept the default options set to keep it clean. It likely won't be the only indicator on one's chart, so it's naturally best to reduce indicator noise from one, as to not subtract from the benefit of the other indicators.
I integrated tons of acquired knowledge into this, so I hope somebody finds a missing piece to their collection or a solution to a coding problem within. I also hope this provides a new insight and helps others on their path to financial freedom.
Best wishes.
PS: I left some old code in comments in case it helps to understand the evolution of my code. I'll update this again once it works on the Daily. You might figure it out before I do, in wish case, do share :)
Visual RSI [LucF]Visual RSI offers a different way of looking at RSI by providing a composite representation of 9 different RSI-generated components. Instead of focusing on one line only, this approach blends multiple sources to provide the viewer with a larger context RSI-based picture.
 For those who don’t want to read 
• Green in bullish (>50) zone is the most bullish.
• Red in bullish zone doesn’t necessarily mean bearish—it just means bullish strength is weakening. It may be just a pause before a reprise or exhaustion signalling a reversal—impossible to tell.
• The same in inverse applies to the bearish zone (<50).
 For those who want to understand 
The nine components making up Visual RSI are:
• a current timeframe RSI
• a higher timeframe RSI
• the delta between these two RSI lines
• for each of these three basic components, two independent Bollinger band: one calculated for the bullish section of the scale (>50) and a separate one calculated for the lower bearish region.
 Dual BBs 
In my view, RSI’s position with regards to the centerline is much more important than its position in extreme areas. Why? Because the building block of RSI is the  ratio  of the averages of up/down moves during the RSI period. When the average of ups is greater, RSI is > 50. So while a rising signal starting from 20 let’s say, indicates that the rate of change is increasing, only when it crosses 50 can we say that sentiment balance has truly become bullish, and this information is more reliable than the signal being at a level corresponding to whatever estimate we make of what constitutes an extreme value. In my landscape, the general balance of a ratio provides more valuable information than the ratio’s exact value.
The idea behind the dual BBs is to provide independent tracking information for both halves of the indicator’s space, which I find more useful than the normal method of simply adding a multiple of the standard deviation on both sides of the mean. With dual BBs, the upper BB will never go lower than the indicator’s centerline, and the lower BB will never go higher. The upper BB focuses on upper-bound volatility when the signal is bearish, and the lower BB focuses on downside volatility when the signal is bearish.
The functions used to calculate the independent BBs are reusable on other signals if a centerline can be defined for them. A clamping percentage is implemented, so that when a BB line is hugging the centerline it clamps to it. This helps in providing earlier signals when they use the BB line states.
 Providing context to RSI 
What RSI measures indirectly is the balance in the rate of change—or the speed of price movement, but not its instant value, otherwise RSI would be even noisier. More precisely, RSI represents the relative strength of the up/down movement in the last n bars of RSI’s length, with 14 often used because that’s what Wilder proposed (Visual RSI’s defaults are 20 for the current timeframe and 40 for the higher timeframe). At every bar, a new value is added to the equation and an old value carrying equal weight is dropped, so a large dropped off value will have more impact on RSI’s value if the new bar’s move is small. This accounts for some of RSI’s speed in identifying exhaustion after important moves, but almost for some of its noise.
 
Visual RSI is the result of trying to drown RSI’s noise in the context of other informational streams, while simultaneously providing even faster information than RSI alone, by giving more visual weight to the delta between the current and higher timeframe RSI’s.
 How to read Visual RSI 
The default settings show all 9 basic components as green/red areas of intensities varying with their importance. The most intense colors are reserved for the delta RSI and the BBs have the lightest intensities. The individual lines of components are intentionally difficult to distinguish so that focus is first on the general picture, including the all-important six-state background, and then on the delta RSI.
One entry setup could be reversals in a larger trend context, so low pivots of the delta in a fully bullish context (a green background in the upper section of the indicator), and inversely, high pivots in a fully bearish context (a red background in the lower section of the indicator).
Please resist the common misconception, when interpreting RSI, that a reversal in the signal will necessarily lead to a reversal in price. Each trend has its rhythm. Only machine-generated price action can progress regularly. It’s normal for trends to take a breather for some time before they continue or reverse, as traders driving the trend experience emotional fatigue and gradual fear. RSI reversals merely signify that such a breather has occurred—nothing more. Only the larger context can provide information that can situate that pause and put more meaningful odds on it having more probability of continuing in one direction or the other. This is the reasoning behind the setup just described.
 Features 
• All components can be hidden, displayed as a simple line, a uniformly colored fill, or a green/red fill (the default).
• The background can be colored using 9 different methods, including 3 six-state methods using the rising/falling BB lines of the 3 basic components. These six states allow for bullish/bearish/neutral sentiment in both the upper and lower regions of the indicator. A bearish (dark red) background in the bullish (>50) section of the indicator represents decreasing bullishness. A bearish (slightly brighter red) in the bearish (<50) section of the indicator means incresingly bearish sentiment. The six-state backgrounds allow for neutral (no color) sentiment when no compelling signs can be found to conclude anything with meaningful odds. The default background uses the six-state method on the higher timeframe RSI’s BBs because I find it the most useful, as it represents the largest—and slowest—context sentiment among all the indicator’s components.
• A thin status bar in the top part of the indicator also allows selection of the same 9 methods to color it. The default is a triple-state system using the rising/falling characteristics of the current timeframe RSI’s BBs to provide a short-term counterbalance to the long-term background.
• Three different markers can be configured using approximately 70 permutations each, each filtered by 20 different filter permutations. When modification of the relevant parameters in the script’s  Settings/Settings/Parameters  section is added, possibilities are almost endless. If the generated signals are then fed into the PineCoders Engine and combined with the Engine’s own options, the permutations go up another order of magnitude, and changes to any setting can be instantly evaluated using the Engine’s backtesting results.
• Five simple filters can be combined. They are additive. They include volume-related conditions and a chandelier, which I find useful because both volume and volatility (the chandelier using highs/lows and ATR) are sensible complementary sources to RSI’s momentum information. The filter’s state can be shown as a thin line at the bottom of the indicator.
• Alerts can be configured using any of the marker/filter combinations mentioned. As usual, once your markers/filters are set up the way you want, create your alert from the chart/timeframe you want the alert to run on and be sure to use the “Once Per Bar Close” triggering condition. Use an alert message that will remind you of which combination of markers were used when creating the alert.
• A plot providing entry signals for the PineCoders Backtesting & Trading Engine is supplied. It will use whichever marker/filter configuration is active to generate signals.
• All higher timeframe information is non-repainting. Higher timeframe lines can be smoothed (the default). The selection of the higher timeframe can be made using 3 different methods:
1. By steps (if current timeframe <= 1 minute: 60 min, <= 60 min: 1D, <= 6H: 3D, <= 1D: 1W, <=1W: 1M, >1W: 12M)
2. By a user-defined multiple of the current timeframe
3. Using a fixed timeframe
 Thanks to: 
• Alex Orekhov aka @everget for the chandelier code.
• @RicardoSantos who through a small remark early on, unknowingly put me on the track of eliminating noise through visual crowding.
• The brilliant guys in the PineCoders Pro room for your knowledge, limitless creativity and constant companionship.
Dominant Cycle Tuned Rsi BackgroundBackground version of the  Dominant Cycle Tuned Rsi Background  published here 
Multi BB Heat Vis - SMA/EMA/Breakout - r2I don't expect to iterate any further on this script, unless any weird issue crops up.
Description and usage detailed in the comments at the top of the script. Cheers!
To repaint or not to repaint, all the relevant sources are exposed as inputs for customisation - so the choice is yours.
Cheers!
Price above/below EMAThis script will give you red/green columns to indicate if price is above or below a certain EMA.  With Candlestick charting, we are looking for price in relation to the 8 ema Trigger Line (T-Line).  You can adjust this indicator to fit your need.  Simple, but nice to quickly see.
Oops.  Last line's title should be "Sell".  Doesn't affect display though.












