tangoline_v1.1
Download scriptThis script, known as the Tango Moving Average, is a sophisticated technical analysis tool designed to identify market trends and volatility. Unlike standard moving averages that simply follow price, this indicator uses a unique "spike filtering" logic to distinguish between meaningful price movements and temporary market noise.
Here is a breakdown of how the logic works in plain English:
1. Intelligent Spike Detection
The core innovation of this script is its ability to identify "spikes"—extreme high or low price points that occur within a specific window of time (the Period).
- Noise Filtering: It looks for significant reversals by checking if a new low or high is actually distinct from the previous ones. If a move is too small, the script ignores it as "noise."
- Identifying Key Points: By isolating these true highs and lows, the script identifies the "peak" and "bottom" of a price swing rather than just reacting to every minor fluctuation.
2. Dynamic Range Calculation
Once the script identifies a significant spike (a top or a bottom), it performs a smart calculation of the price range:
- Symmetry Logic: If a move is identified as a "top," the script adjusts the lower boundary of the range to ensure it reflects the actual price structure.
- Balanced Midpoints: It calculates a "Tango Line" based on the midpoint of these filtered extremes. This creates a more stable baseline than traditional averages because it is anchored to significant structural points in the chart rather than every single candle's close.
3. Smoothing and Trend Analysis
After establishing the core Tango Line, the script applies a second layer of mathematical refinement:
- Moving Average: The "Tango Line" is smoothed out over a secondary period. This prevents the indicator from looking jagged, making it easier for a human trader to see the overall direction of the trend.
- Volatility Bands: Finally, the script calculates the Standard Deviation—a measure of how much the price typically "wiggles" around its average. It then projects an Upper and Lower Band based on this volatility.
Summary for the Trader
- The Tango Line (Main Line): Represents the smoothed "true" trend of the market, filtered to ignore minor price spikes.
- The Bands (Dotted Lines): Act as a boundary for normal price behavior. When the price pushes toward or outside these bands, it suggests the market is becoming overextended relative to its recent history.
- Visual Advantage: By filtering out "noise" and focusing on structural highs and lows, this indicator aims to provide a cleaner, more reliable trend signal than standard moving averages, which can often be "fooled" by sudden, insignificant price jumps.
ÿþ/ / + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
/ / | T a n g o M o v i n g A v e r a g e . m q 4 |
/ / | C o p y r i g h t 2 0 1 5 , f x b o r g |
/ / | h t t p : / / b l o g . l i v e d o o r . j p / f x b o r g / |
/ / + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
# p r o p e r t y c o p y r i g h t "