All indicators

MACDouble & StochRSI w/ safeties and variable time interval v0.3

Aug 6, 2016

Static chart image
SignalsOscillatorsMoving Averages

The MACDouble & StochRSI w/ safeties and variable time interval v0.3 indicator is a multi-layered momentum strategy tool that combines two MACD calculations with a Stochastic RSI filter and price-action safeties to identify trend-following entries.

Usage

The script is designed to trigger long and short entries based on the alignment of multiple technical factors across potentially different timeframes.

  • MACD Alignment: The script looks for bullish or bearish momentum on both the local timeframe and a secondary, user-defined timeframe.
  • Stochastic RSI Filter: Entry signals are filtered by the Stochastic RSI to ensure the market is not overextended. It utilizes a "True" logic where K must be above D for long entries and below D for short entries.
  • Price Safeties: To reduce false breakouts, the script includes a primitive trend safety. A buy order only executes if the current price and high are greater than the previous bar's levels, while sell orders require a corresponding lower low/close.
  • Stop Loss: The strategy includes a built-in cap on losses for short positions to manage risk during unexpected upward volatility.

Details

The script executes a dual-timeframe analysis by utilizing the request.security function for both the second MACD and the Stochastic RSI. This allows users to observe macro trends while trading on micro timeframes.

  • MACD 1: Calculated using standard fast, slow, and signal lengths on the chart's current resolution.
  • MACD 2: Calculated on a secondary resolution (e.g., a 45-minute interval while viewing a 15-minute chart) to provide a higher-level trend bias.
  • StochRSI Logic: Unlike basic oscillators, this version requires the K line to cross the D line in the direction of the trade, ensuring momentum is actively shifting before an entry is confirmed.

Settings

MACD Settings

  • Uncheck to use custom res./intrv. for 2nd MACD indicator: Toggle between the chart timeframe and a custom timeframe for the secondary MACD.
  • Resolution/interval to use for 2nd MACD: Specifies the timeframe for the secondary trend calculation.
  • MACD fast/slow/signal length: Traditional parameters for the first MACD instance.
  • 2nd MACD fast/slow/signal length: Independent parameters for the secondary MACD instance.

Stochastic RSI Settings

  • Uncheck to use custom res/intrv for StochRSI: Allows the Stochastic RSI to be calculated on a different timeframe than the chart.
  • Resolution to use for StochRSI indicator: The timeframe for the StochRSI (higher resolutions are generally recommended for stability).
  • StochRSI Smooth K/D: Smoothing parameters for the Stochastic components.
  • StochRSI RSI/Stoch Length: Length inputs for the underlying RSI and Stochastic calculations.
  • RSI Buy/Sell Trigger: Thresholds used to define the boundaries for entry signals.

FAQ

How do I access the MACDouble & StochRSI w/ safeties and variable time interval v0.3? You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.

Why are no signals appearing on my chart? Ensure that both MACD indicators and the Stochastic RSI conditions are aligning simultaneously. If you have "Price Safeties" enabled, the price must also be making higher highs (for longs) or lower lows (for shorts) to trigger a signal.

What timeframe is best for this indicator? While it can be used on any timeframe, it is optimized for multi-timeframe analysis. For example, using a 15-minute chart while setting the secondary MACD and StochRSI to 30 or 45 minutes often yields more reliable trend-following signals.

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.