Candle Color
Candle Color detects bullish and bearish candles by comparing their close and open prices.
Role in the strategy
| Slot | Available | Role |
|---|---|---|
| Entry Point | No | — |
| Entry Rule | Yes | Filters entries by consecutive candle bodies. |
| Exit Point | No | — |
| Exit Rule | Yes | Triggers exits by consecutive candle bodies. |
The Candle Color 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. See Indicators for the slot semantics.
Logic rules
| Rule | Long signal is 1 when | Short signal is 1 when |
|---|---|---|
| Bullish Candle formed | the last N candles closed at least Min body height above their open | the last N candles closed at least Min body height below their open |
| Bearish Candle formed | the last N candles closed at least Min body height below their open | the last N candles closed at least Min body height above their open |
N is the Consecutive candles parameter. The candles are evaluated on the closed bars preceding the current one.
Parameters
| Parameter | Type | Default | Range | Purpose |
|---|---|---|---|---|
| Min body height [pips] | number | 5 | 1 to 1000 | Minimum close-to-open distance of a candle body |
| Consecutive candles | number | 1 | 1 to 10 | Number of candles that must match in a row |
Calculation
engine/indicators/indicator-candle-color.ts scans the bars: a candle counts as bullish when Close − Open is at least the pip distance of the Min body height, and as bearish when Open − Close is at least that distance. The counter resets on a non-matching candle; the rule fires when the counter reaches Consecutive candles. The indicator draws no chart line.
Backtesting
- The rule fires on the bar after the matching candles have closed — it never uses the in-progress bar.
- 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.