Skip to main content

MACD (Moving Average Convergence Divergence) in the Trade Rule Block

MACD measures momentum and trend strength using EMAs. Detect shifts with line crossovers and changes in slope.

Updated over 4 months ago

Purpose of the MACD

The MACD is a trend-following momentum indicator that shows the relationship between two moving averages of price. It helps traders identify potential trend direction, momentum shifts, and entry/exit points.


How It Works

When you select MACD in the Trade Rule block, you can configure it with the following settings:

Fast EMA Period of MACD

  • The number of candles used for the fast-moving average.

  • Reacts quickly to price changes and is more sensitive to short-term movements.

Slow EMA Period of MACD

  • The number of candles used for the slow-moving average.

  • Reacts more slowly, filtering out short-term noise.

Signal Period of MACD

  • The number of candles used to calculate the signal line (a moving average of the MACD line).

  • Often used to generate buy/sell signals when crossed by the MACD line.

Applied Price of MACD (Source for calculation)

  • Close Price – Candle closing price.

  • Open Price – Candle opening price.

  • High Price – Candle highest point.

  • Low Price – Candle lowest point.

  • Median Price – (High + Low) ÷ 2

  • Typical Price – (High + Low + Close) ÷ 3

  • Weighted Price – (High + Low + Open + Close) ÷ 4

MACD Mode

  • Main Line – The difference between the Fast EMA and Slow EMA.

  • Signal Line – A moving average of the Main Line, used for crossovers.

Time Frame of MACD

  • Select the chart time frame for MACD calculation.

  • Can be replaced with a variable or input for faster backtesting and easy adjustments.

Candle ID of MACD

  • 0 – Current forming candle.

  • 1 – Most recently closed candle.

  • Higher IDs = older candles.

Adjust of MACD (Modify Output)

  • Add, subtract, multiply, or divide the calculated value by a chosen number.


Example

If you set:

  • Fast EMA Period: 12

  • Slow EMA Period: 26

  • Signal Period: 9

  • MACD Mode: Main Line

  • Candle ID: 1
    You get the MACD main line value for the most recently closed candle, based on the difference between the 12-period and 26-period EMAs.


Use Cases

  • Detect trend direction and momentum shifts.

  • Use MACD line crossovers with the Signal line for potential entries/exits.

  • Combine with other indicators for confirmation.


Tip: MACD can lag in volatile markets — consider combining it with faster indicators for timely entries.

Did this answer your question?