Persistency with Moving Averages

Apr 18, 2026

Static chart image
Signals
Dashboard
Moving Averages

The Persistency with Moving Averages tool tracks the durability of trends by measuring how long price remains on one side of key moving averages. It provides traders with quantitative data on trend resilience, helping to distinguish between temporary momentum and sustained market moves.

Usage

The Usage section describes how the script can be used to evaluate trend strength and time market entries or exits.

  • Trend Identification: The script monitors up to four customizable moving averages. A positive count indicates the price is consistently above the MA (bullish persistency), while a negative count indicates it is below (bearish persistency).
  • Decisive Exit Logic: Users can enable a "Decisive Exit" mechanism. Unlike a simple crossover, this feature initiates a "Pending Exit" when price shows initial weakness (e.g., closing below the MA). A final exit signal is only confirmed if the price subsequently breaches the low of the trigger bar. This helps filter out minor fluctuations or "whipsaws."
  • Max Persistency: On daily or higher timeframes, the script tracks the historical maximum consecutive bars the price has stayed on one side of a specific MA within a chosen lookback period (1, 3, 5, or 10 years). This provides a benchmark to compare current trend strength against historical extremes.
  • Momentum Assessment: A dashboard displays real-time counts, percentage returns since the signal, and a directional header (↑ for upward, ↓ for downward, and → for mixed/sideways momentum).

Details

The script is based on Pradeep Bonde's concept of "Persistency," which posits that stocks maintaining a trend consistently over time have a higher probability of continuation. While the original concept focuses on close-to-close comparisons, this implementation uses Moving Averages (EMA or SMA) as dynamic baselines.

The "Decisive Exit" logic introduces a two-step confirmation process:

  1. Pending State: Triggered when the selected price source (Close or High/Low) crosses the MA. The script stores the extreme (low for long, high for short) of that bar.
  2. Execution: The exit is executed only if price hits the stored level. If price recovers and crosses back over the MA before the level is hit, the pending exit is cancelled, and the count continues.

Settings

Customization

  • Dark Mode: Adjusts the visual theme of the dashboard.
  • Show color label column?: Toggles color-coded indicators in the table.
  • Show Entry/Exit on chart?: Displays markers at signal locations.
  • Show only the latest signal on chart?: Limits plot visibility to the most recent signal.

Decisive Exit

  • Use decisive exit for count?: Enables/disables the confirmation logic for trend changes.
  • Use decisive exit for count? (Price Type): Determines if the Close or High/Low is used to trigger the pending exit state.
  • Show pending exit column?: Adds a status indicator to the table showing if an exit is currently pending.

Table & Lookback

  • Table Size/Position: Standard adjustments for UI placement and scale.
  • Show Returns (%) Column?: Displays price performance since the current trend count began.
  • Select Lookback Period (Years): Sets the historical range for calculating "Max Persistency."
  • Show Max Persistency Column?: Toggles the display of historical trend records.

Moving Averages

  • MA #1 to #4: Toggle switches to enable or disable individual averages.
  • MA Type: Selection between Simple Moving Average (SMA) and Exponential Moving Average (EMA).
  • MA Length: The period for the calculation (e.g., 10, 21, 50, 200).
  • MA Color: Individual color selection for each MA line.

FAQ

How do I interpret a "Max Persistency" value? If the Max Persistency for a 50-day EMA is 100, it means that at some point in your selected lookback period, the price stayed above that EMA for 100 consecutive days. This helps you understand if a current count of 80 is approaching historical exhaustion or has more room to run.

What is the difference between a simple crossover and a Decisive Exit? A simple crossover triggers a signal the moment the price crosses the MA. A Decisive Exit requires the price to cross the MA and then break the extreme of the crossing bar, providing a filter against market noise.

How can I access this tool? You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.

Free access on the following platforms
tradingviewSymbolTradingView
ninjatraderNinjaTrader
metatrader4MetaTrader 4/5
thinkorswimThinkorswim

Unlock Unlimited Access to the LuxAlgo Library

Upgrade your plan to get all indicators, strategies, charts, and full access to Quant, our AI agent.

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.