All indicators

Martingale with MACD+KDJ opening conditions

Oct 8, 2024

Static chart image
SignalsOscillatorsDashboardMoney ManagementMoving AveragesTrailing-Stop

The Martingale with MACD+KDJ opening conditions indicator provides an automated trading framework that combines trend-following filters with a dynamic position-scaling mechanism to manage entries and exits.

Usage

This tool is designed to identify entry points based on the confluence of the MACD and KDJ indicators. When both indicators signal a bullish crossover, a long position is initiated. Conversely, a bearish crossunder on both indicators triggers a short entry.

The strategy employs a Martingale-style pyramiding logic. If the price moves against the initial entry by a user-defined percentage, the script will add to the position up to a maximum number of additions. The size of these subsequent entries is determined by the "Add Multiplier," allowing for aggressive recovery or linear scaling.

For risk management, the script includes:

  • Trailing Stops: Automatically locks in profits as the price moves in your favor.
  • Stop Loss: A hard exit percentage based on the average position price.
  • Take Profit: A target percentage that triggers the trailing mechanism or a full exit.

Details

The script executes logic in three distinct phases:

  1. Signal Generation: It calculates the MACD (Fast, Slow, and Signal) and KDJ (%K, %D, and J) values. An entry is only valid when the MACD and KDJ confirm the same direction simultaneously.
  2. Averaging Down/Up: To manage drawdowns, the script tracks the "Next Add Price." If the price hits this level, it waits for a "Rebound Percent" (a minor move back in the trade's direction) before adding the next Martingale tier. This prevents adding positions during a vertical collapse.
  3. Dynamic Monitoring: An on-chart dashboard provides real-time data, including current average price, number of additions made, and the specific price levels required for the next addition or exit.

Settings

Basic Inputs

  • Initial Order: The starting quantity or value for the first trade.
  • MACD Settings: Customize the Fast Length, Slow Length, and Signal Smoothing.
  • KDJ Settings: Adjust the Length, Smooth K, and Smooth D parameters.
  • Enable Long/Short Trades: Toggle to restrict the strategy to specific trade directions.

Martingale & Pyramiding

  • Max Additions: The maximum number of additional trades allowed after the initial entry.
  • Add Position Percent: The price distance required before considering an additional entry.
  • Rebound Percent (%): A confirmation trigger that requires price to bounce slightly toward the target before an addition is executed.
  • Add Multiplier: The factor by which the position size increases for every subsequent addition (e.g., 1.0 is constant, 2.0 doubles each time).

Exit Parameters

  • Take Profit Trigger (%): The percentage gain at which the take-profit logic (and trailing stop) activates.
  • Trailing Stop (%): The distance from the peak price used to trail the exit.
  • Stop Loss Percent: The maximum loss allowed per trade based on the average price.

FAQ

How do I interpret the on-chart signals? Green/Red triangles indicate the initial entry conditions. Blue triangles (long) and Orange/Blue triangles (short) represent the additional Martingale positions being added to the trade.

What is the "Rebound Percent"? This is a safety feature. It ensures that the script doesn't just add positions while the price is falling/rising sharply; it waits for a small sign of reversal before increasing the position size.

How can I access Martingale with MACD+KDJ opening conditions? 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.