Moving Averages Crossover
The Moving Averages Crossover indicator compares a fast and a slow moving average to identify trend changes.
Role in the strategy
| Slot | Available | Role |
|---|---|---|
| Entry Point | No | — |
| Entry Rule | Yes | Filters entries by the MA relationship or proposed entry price relative to either MA. |
| Exit Point | No | — |
| Exit Rule | Yes | Triggers exits by the fast MA position against the slow MA. |
The indicator 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 |
|---|---|---|
| Fast MA crosses Slow MA upward | Fast MA crossed above the Slow MA | Fast MA crossed below the Slow MA |
| Fast MA crosses Slow MA downward | Fast MA crossed below the Slow MA | Fast MA crossed above the Slow MA |
| Fast MA is higher than Slow MA | Fast MA is above the Slow MA | Fast MA is below the Slow MA |
| Fast MA is lower than Slow MA | Fast MA is below the Slow MA | Fast MA is above the Slow MA |
The comparison uses the previous bar's values for both lines.
Four entry-only rules compare the proposed Entry Point price with a named line: The position opens above/below Fast MA and The position opens above/below Slow MA. Each comparison uses the same named line for long and short entries; shorts reverse the inequality. The comparison is strict with a half-point dead zone.
Parameters
| Parameter | Type | Default | Range | Purpose |
|---|---|---|---|---|
| Fast MA method | select | Simple | Simple, Exponential, Weighted, Smoothed | Smoothing method of the fast MA |
| Slow MA method | select | Simple | Simple, Exponential, Weighted, Smoothed | Smoothing method of the slow MA |
| Fast MA period | number | 12 | 2 to 1000 | Period of the fast MA |
| Slow MA period | number | 26 | 2 to 1000 | Period of the slow MA |
Calculation
Both moving averages are calculated on the Close price series (tech.movingAverage in engine/indicator-engine/tech.ts) with their own method and period. The Fast MA line is drawn in red and the Slow MA line in blue on the main price chart.
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.