All indicators

Stochastic with MACD filter + SL/TP + Alerts

Mar 5, 2021

Static chart image
SignalsOscillatorsMoney ManagementMoving AveragesVolatility

The Stochastic with MACD filter + SL/TP + Alerts tool is a comprehensive trend-following momentum indicator that combines Stochastic crossovers, MACD positioning, and EMA filtering to identify high-probability entry points with integrated risk management levels.

Usage

The tool identifies potential trade entries based on a confluence of three technical conditions:

  • Trend Filter: Price must be above the EMA for long signals and below the EMA for short signals.
  • Momentum Filter: MACD must be below zero for longs (indicating potential mean reversion from a low) or above zero for shorts.
  • Timing: A Stochastic crossover must occur within an oversold (long) or overbought (short) zone.

When a valid signal is detected, the script plots triangle shapes on the chart along with three specific horizontal levels:

  • Stop Loss (Red): Calculated using an ATR-based offset from the recent swing low/high.
  • Take Profit 1 (Blue): A 1:1 risk-to-reward target.
  • Take Profit 2 (Green): A secondary target based on the user-defined Take Profit Multiplier (default is 2:1).

For improved results, it is recommended to align signals with higher timeframe trends or confirm entries with RSI divergences.

Details

The script integrates three popular indicators into a unified logic. The Stochastic component looks for crossovers while the %K line is near extreme levels (defined by the long/short levels). The MACD filter ensures that momentum is stretched before entry, and the 200-period EMA provides a baseline for the primary trend direction. The risk management levels are dynamic, utilizing the Average True Range (ATR) to account for market volatility, ensuring that stop losses are adjusted based on current market conditions.

Settings

MACD Settings

  • Fast Length: The period for the fast moving average in the MACD calculation.
  • Slow Length: The period for the slow moving average in the MACD calculation.
  • Source: The price data used for MACD calculations.
  • Signal Smoothing: The smoothing period for the MACD signal line.
  • Simple MA (Oscillator/Signal): Toggles between SMA and EMA for the MACD components.

Stochastic Settings

  • K/D/Smooth: Standard periods for the Stochastic oscillator components.
  • Stoch Long/Short Level: Thresholds to define overbought and oversold conditions.

Filters & Risk Management

  • EMA Length: The period for the trend filter baseline.
  • ATR Period/Multiplier: Controls the volatility-based calculation for the initial stop loss.
  • Take Profit Multiplier: Sets the risk-to-reward ratio for the secondary target.
  • Stop Loss Buffer (Ticks): Adds an extra margin of safety to the stop loss level.

FAQ

How do I use the Stochastic with MACD filter + SL/TP + Alerts?

Apply the indicator to your chart and look for the green/red triangles. Use the generated SL and TP lines to manage your trade exit parameters.

Can I change the risk-to-reward ratio?

Yes, you can adjust the "Take Profit Multiplier" in the settings to change the distance of the secondary TP level relative to your risk.

Where can I access this indicator?

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.