MACD Signal
The MACD Signal is a moving average of the MACD line that generates trading signals.
Role in the strategy
| Slot | Available | Role |
|---|---|---|
| Entry Point | No | — |
| Entry Rule | Yes | Filters entries by the MACD line position against the Signal line. |
| Exit Point | No | — |
| Exit Rule | Yes | Triggers exits by the MACD line position against the Signal line. |
The MACD Signal produces conditions, not order prices. As an entry rule it is ANDed with the entry point and the other entry rules; as an exit rule it is ORed with the other exit rules.
Logic rules
| Rule | Long signal is 1 when | Short signal is 1 when |
|---|---|---|
| MACD line crosses the Signal line upward | MACD line crossed above the Signal line | MACD line crossed below the Signal line |
| MACD line crosses the Signal line downward | MACD line crossed below the Signal line | MACD line crossed above the Signal line |
| MACD line is higher than the Signal line | MACD line is above the Signal line | MACD line is below the Signal line |
| MACD line is lower than the Signal line | MACD line is below the Signal line | MACD line is above the Signal line |
The comparison uses the previous bar's values for both lines.
Parameters
| Parameter | Type | Default | Range | Purpose |
|---|---|---|---|---|
| Apply to | select | Close | Open, High, Low, Close, Median, Typical, Weighted | Price series the MACD is calculated from |
| Fast EMA | number | 12 | 2 to 1000 | Period of the fast exponential average |
| Slow EMA | number | 26 | 2 to 1000 | Period of the slow exponential average |
| MACD SMA | number | 9 | 2 to 1000 | Period of the signal line |
Calculation
tech.MACD and tech.MACDSignal in engine/indicator-engine/tech.ts compute the MACD line (Fast EMA − Slow EMA) and the Signal line (SMA of the MACD line over MACD SMA bars). Both lines are drawn in a separate chart pane: the MACD line as bars and the Signal line as a dotted line.
Backtesting
- The rule is evaluated on the previous (closed) bar with the standard dead zone (
SIGMA = 0.000001). - The indicator contributes only long/short signal arrays — it never changes the entry or exit order price.
- An entry happens only when the entry point allows the direction and every entry rule passes; an exit happens when the exit point is reached and any exit rule passes.