All indicators

Scripting Tutorial 9 - TManyMA Strategy - Long Market Order Only

Oct 22, 2019

Static chart image
Dynamic OverlaysSignalsForecastingMoving Averages

The TManyMA Strategy indicator provides a triple moving average trading system that enables users to backtest long-only crossover strategies with highly customizable smoothing types, multi-timeframe resolutions, and predictive forecasting.

Usage

The Usage section describes how the script can be used to identify trend shifts and execute automated strategy tests. Users can enable up to three distinct moving averages to find confluence or crossover signals.

  • Strategy Execution: The script automatically enters long positions using market orders when a faster MA crosses over a slower MA. It exits these positions when the faster MA crosses back under. By default, the strategy utilizes 100% of equity for each trade.
  • Visual Crossovers: When enabled, the indicator plots labeled icons on the chart detailing exactly which moving averages crossed (e.g., "50 SMA crossed over 200 SMA").
  • Ribbons: If the moving averages share the same type, resolution, and source, the script generates 10 intermediate ribbons (5 between MA1/MA2 and 5 between MA2/MA3). These are alpha-color coded to visualize the spread and trend strength between the primary levels.
  • Forecasting: The tool projects moving average values five bars into the future. This can be adjusted based on a "Bias" setting to simulate how the averages might react to anticipated bullish, bearish, or neutral market movements.

Details

The script is built to handle complex calculations across multiple timeframes using request.security. It supports eight different smoothing methods: RMA, SMA, EMA, WMA, HMA, DEMA, TEMA, and VWMA.

The forecasting logic uses a weighted approach based on the Average True Range (ATR) to apply "Bias Magnitude." If a Bullish bias is selected, the forecast adds an ATR-based value to the projection; a Bearish bias subtracts it. This allows traders to see potential crossover timings before they occur based on specific volatility expectations.

Settings

Moving Average Settings (MA1, MA2, MA3)

  • Period: Sets the lookback period for the specific moving average.
  • Type: Selects the calculation method (e.g., SMA, EMA, HMA).
  • Source: Determines the price data used (Close, Open, HL2, etc.).
  • Resolution: Sets the timeframe for the calculation, allowing for multi-timeframe analysis on a single chart.
  • Visible: Toggles the visibility of the specific moving average.

Forecasting & Strategy

  • Show Crosses: Toggles the display of descriptive labels at crossover points.
  • Forecast Bias: Adjusts the directional assumption for the 5-bar projection (Neutral, Bullish, or Bearish).
  • Forecast Bias Period/Magnitude: Controls the sensitivity and volatility calculation for the forecasted lines.
  • Show Ribbons: Toggles the intermediate transition lines between the primary moving averages.
  • Trade MA Crosses: Individual toggles (1-2, 1-3, 2-3) to determine which specific crossovers trigger strategy entries and exits.

FAQ

How do I change the timeframe of only one moving average? You can use the "Resolution" dropdown in the settings menu for MA1, MA2, or MA3 to select a specific timeframe like "1D" or "4h" regardless of your current chart interval.

Why are the ribbons not appearing on my chart? Ribbons only appear when the moving averages being compared share the same Type, Resolution, and Source. Ensure these settings match to enable the ribbon calculations.

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

Free indicator

Get free access to this indicator on the platforms below.

TradingView
NinjaTrader
MetaTrader 4/5

Unlock the entire LuxAlgo Library

Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.