All indicators

- Moving Average Cross and/or Bbands bot

Sep 27, 2017

Static chart image
SignalsChannelsMoving AveragesTrailing-Stop

The Moving Average and/or Bbands bot indicator provides an automated signal framework designed to trigger alerts based on the intersection of trend-following and mean-reversion logic. By combining dual Moving Average crossovers with Bollinger Band boundaries, this tool offers a versatile environment for generating execution signals for various asset classes including Alts, Forex, and Equities.

Usage

The Usage section describes how the script can be used to generate specific trade entry and exit signals. Users can toggle between different logic modules depending on their market bias.

  • Trend Following: When "Use Moving Average Cross" is enabled, the script identifies bullish trends when the price and the fast MA are both above the slow MA, and vice versa for bearish trends.
  • Mean Reversion: When "Use Bollinger Bands" is enabled, the script identifies potential exhaustion points when the price pierces the upper or lower bands.
  • Confluence Mode: If both modules are enabled, the script requires price to be outside the Bollinger Bands while maintaining the Moving Average alignment, filtering for high-probability setups.
  • Risk Management: The script includes automated logic for Trailing Stops, Take Profits, and Stop Losses. These triggers can be used to automate exit alerts for trade management.

Details

The script operates using a multi-layered logic system to ensure signals are filtered for quality. It calculates internal variables for position tracking, such as sectionLongs and sectionShorts, which allow the user to control pyramiding (scaling into positions).

Execution is based on Heiken Ashi or standard candle data retrieved via request.security. The indicator also incorporates a margin call simulation logic based on specified leverage, providing a safety alert for high-risk trading. For automation, the script generates pre-formatted alert strings compatible with third-party execution tools, such as Autoview.

Settings

  • Altcoin / Forex: Adjusts the contract quantity (qty) calculation to align with specific market requirements (e.g., higher volume for Alts or standard lots for Forex).
  • Backtest Range: Sets the start and stop dates for the historical signal calculation period.
  • Use Moving Average Cross: Toggles the SMA-based trend filter.
  • Moving Average 1 & 2: Sets the length for the fast and slow simple moving averages.
  • Use Bollinger Bands: Toggles the mean-reversion filter.
  • BB Length / Multiplier: Defines the lookback period and standard deviation width for the bands.
  • Pyramiding: Configures the rules for multiple entries (less than, equal to, or greater than a specific count).
  • Trailing Stop / Take Profit / Stop Loss: Toggles and sets the price thresholds for various automated exit strategies.
  • Margin Call / Leverage: Toggles a simulated margin call alert based on the input leverage.

FAQ

How do I configure the indicator for automated trading? The script includes built-in alertcondition functions with pre-formatted syntax. You can set these alerts on TradingView to trigger external webhooks or local automation software.

Can I use both Moving Averages and Bollinger Bands at the same time? Yes. Enabling both will restrict signals to "Confluence Mode," meaning a long signal only triggers if the price is below the lower Bollinger Band AND the Moving Average trend is bullish.

How do I get access to the Moving Average and/or Bbands bot? 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.