Ultimate Moving Average Strategy
Jul 11, 2018

The Ultimate Moving Average Strategy indicator provides a versatile backtesting framework that utilizes multi-timeframe moving averages and directional color-coding to identify trend shifts and execute automated trades.
Usage
The Ultimate Moving Average Strategy is designed to capture trend reversals by monitoring the slope and interaction of various moving average types. It is particularly effective on higher timeframes, such as the 8-hour chart or higher, where market noise is reduced.
The strategy executes long entries when the primary moving average begins to trend upward (based on a user-defined smoothing period) and enters short positions when the average trends downward. Users can optionally enable a second moving average to visualize crossovers or act as a secondary filter.
Multi-Timeframe Analysis
The tool allows users to calculate moving averages based on a timeframe higher than the current chart. This enables "top-down" analysis, where a trader can view Daily trend data while executing trades on lower intraday intervals.
Directional Smoothing
To reduce "whipsaws" (false signals), the strategy includes a smoothing parameter. Instead of reacting to a single bar's change in direction, the color and signal only flip when the current value is higher or lower than its value X bars ago.
Details
The script is a strategy conversion of the CM_Ultimate_MA_MTF indicator, originally developed by @Virtual_Machinist. It integrates several types of moving average calculations into a single logic block:
- Standard Types: SMA, EMA, WMA, RMA, and VWMA.
- Advanced Types: Hull Moving Average (HMA) and Triple Exponential Moving Average (TEMA).
- Trailing Stop Mechanism: Includes a built-in trailing stop-loss feature using points and offset values to protect equity during trending phases.
The core logic evaluates the relationship between out and out[smoothe]. If the current value is greater than the value at the smoothing offset, the trend is considered bullish. If it is lower, it is considered bearish.
Settings
Primary MA Settings
- Use Current Chart Resolution?: When enabled, the MA uses the current chart's timeframe. When disabled, it uses the custom timeframe selected below.
- Use Different Timeframe?: Specifies the timeframe for MA calculation (e.g., Daily, Weekly).
- Moving Average Length: The lookback period for the primary calculation.
- MA Type: Selects the calculation method (1=SMA, 2=EMA, 3=WMA, 4=HullMA, 5=VWMA, 6=RMA, 7=TEMA).
- Change Color Based On Direction?: Toggles the visual color change when the trend shifts.
- Color Smoothing: Determines the number of bars to look back when checking for a change in direction.
Secondary MA & Crossings
- Optional 2nd Moving Average: Enables a secondary MA on the chart.
- Moving Average Length - Optional 2nd MA: The lookback period for the secondary MA.
- Show Dots on Cross of Both MA's: Plots a cross icon on the chart when the two moving averages intersect.
Strategy & Risk Management
- Use Trailing Stop?: Toggles the trailing stop-loss logic.
- Stop Loss Trail Points: The distance in points required to activate the trail.
- Stop Loss Trail Offset: The distance in points to maintain the stop behind the price.
FAQ
How do I use the multi-timeframe feature? To use a different timeframe, uncheck "Use Current Chart Resolution?" in the settings and select your desired timeframe (e.g., "D" for Daily) in the "Use Different Timeframe?" dropdown.
Which moving average type is best for reducing lag? The Hull Moving Average (Option 4) and TEMA (Option 7) are specifically designed to reduce the lag typically found in standard SMAs.
How can I access the Ultimate Moving Average Strategy? You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Trading & investing are risky and many will lose money in connection with trading and investing activities. All content on this site is not intended to, and should not be, construed as financial advice. Decisions to buy, sell, hold or trade in securities, commodities and other investments involve risk and are best made based on the advice of qualified financial professionals. Past performance does not guarantee future results.
Hypothetical or Simulated performance results have certain limitations. Unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, including, but not limited to, lack of liquidity. Simulated trading programs in general are designed with the benefit of hindsight, and are based on historical information. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.
Testimonials appearing on this website may not be representative of other clients or customers and is not a guarantee of future performance or success.
As a provider of technical analysis tools and strategies, we do not have access to the personal trading accounts or brokerage statements of our customers. As a result, we have no reason to believe our customers perform better or worse than traders as a whole based on any content, tool, or platform feature we provide.
Charts used on this site are by TradingView in which the majority of our technical indicators are built on. TradingView® is a registered trademark of TradingView, Inc. www.TradingView.com TradingView® has no affiliation with the owner, developer, or provider of the Services described herein.
Market data is provided by CBOE, CME Group, BarChart, Massive, CoinAPI. Select U.S. equities data is provided through Massive. CBOE BZX real-time U.S. equities data is licensed from CBOE and provided through BarChart. Real-time futures data is licensed from CME Group and provided through BarChart. Select cryptocurrency data, including major coins, is provided through CoinAPI. All data is provided “as is” and should be verified independently for trading purposes.
This does not represent our full Disclaimer. Please read our full disclaimer.
© 2026 LuxAlgo Global, LLC.

