AMA (filtered)
Download scriptThis script is a specialized trading indicator designed to analyze price movement by combining high-speed momentum tracking with a sophisticated noise-reduction system. It aims to identify the underlying trend of a financial asset while filtering out insignificant "market noise" or minor fluctuations that might trigger false signals.
Core Logic and Mechanism
1. Dynamic Price Mapping The script begins by establishing a baseline for what constitutes a "price." It is versatile enough to look at various data points—such as the closing price, opening price, highs, lows, or even weighted averages of these figures. This flexibility allows users to customize exactly which part of the market movement they want the indicator to follow.
2. Range-Based Momentum Calculation Unlike standard moving averages that simply look at historical prices, this script calculates a "multiplication factor" based on where the current price sits within its recent range (the distance between the highest high and lowest low over a specific period).
- If the price is pushing toward the upper end of the range, it registers stronger upward momentum.
- If it is toward the lower end, it registers downward momentum. This creates a weighted value that reacts more dynamically to active price expansion than traditional linear calculations.
3. Adaptive Smoothing (The "AMA" Component) The indicator uses an Adaptive Moving Average (AMA) logic. Instead of using a fixed weight for every piece of data, it adjusts the influence of new information based on the calculated momentum.
- When the market is moving strongly and consistently, the indicator reacts faster to stay aligned with the price.
- When the market is moving sideways or erratically, the indicator becomes "heavier" and more stable to prevent reacting to every small twitch in the data.
4. Advanced Noise Filtering (The CFilter Class) The most distinct feature of this script is its dedicated filtering engine. This component evaluates the volatility and the average strength of price changes over a user-defined period.
- It calculates the "power" of recent movements—essentially measuring how much "effort" the market is putting into a move.
- The Filter Logic: If a recent price change is smaller than a specific threshold (relative to the average power of the market), the script considers it "noise." In these instances, the indicator will intentionally ignore the new data point and maintain its previous value until a significant enough move occurs to break through the filter.
Visual Representation
On your trading chart, the indicator provides more than just a line; it provides directional context:
- Color Transitions: The line changes color dynamically to signal shifts in trend direction (e.g., switching between colors for upward and downward momentum).
- Smoothness: Because of the dual-layer smoothing (AMA + CFilter), the resulting line appears much cleaner than standard indicators, showing the "true" path of the price without the jagged edges caused by minor market volatility.
ÿþ/ / - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# p r o p e r t y c o p y r i g h t "