Directional Indicators
The +DI and -DI measure the strength of the upward and downward price movement to determine the trend direction.
Role in the strategy
| Slot | Available | Role |
|---|---|---|
| Entry Point | No | — |
| Entry Rule | Yes | Filters entries by the DI+ position against the DI- line. |
| Exit Point | No | — |
| Exit Rule | Yes | Triggers exits by the DI+ position against the DI- line. |
The Directional Indicators produce conditions, not order prices. As an entry rule they are ANDed with the entry point and the other entry rules; as an exit rule they are ORed with the other exit rules. See Indicators for the slot semantics.
Logic rules
| Rule | Long signal is 1 when | Short signal is 1 when |
|---|---|---|
| DI+ line crosses DI- line upward | DI+ crossed above DI- | DI+ crossed below DI- |
| DI+ line crosses DI- line downward | DI+ crossed below DI- | DI+ crossed above DI- |
| DI+ line is higher than DI- line | DI+ is above DI- | DI+ is below DI- |
| DI+ line is lower than DI- line | DI+ is below DI- | DI+ is above DI- |
The comparison uses the previous bar's values for both lines. DI+ above DI- marks an upward trend, DI- above DI+ a downward trend.
Parameters
| Parameter | Type | Default | Range | Purpose |
|---|---|---|---|---|
| Period | number | 10 | 1 to 1000 | Bars of the directional movement smoothing |
Calculation
tech.ADX in engine/indicator-engine/tech.ts computes the three lines:
- DI+ and DI-: exponential averages of the positive and negative directional movement, normalized by the true range.
- ADX: exponential average of the directional index (drawn for reference).
The ADX, DI+ and DI- lines are drawn in a separate chart pane.
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.