Moving Averages Crossover

The Moving Averages Crossover indicator compares a fast and a slow moving average to identify trend changes.

Role in the strategy

SlotAvailableRole
Entry PointNo—
Entry RuleYesFilters entries by the MA relationship or proposed entry price relative to either MA.
Exit PointNo—
Exit RuleYesTriggers 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

RuleLong signal is 1 whenShort signal is 1 when
Fast MA crosses Slow MA upwardFast MA crossed above the Slow MAFast MA crossed below the Slow MA
Fast MA crosses Slow MA downwardFast MA crossed below the Slow MAFast MA crossed above the Slow MA
Fast MA is higher than Slow MAFast MA is above the Slow MAFast MA is below the Slow MA
Fast MA is lower than Slow MAFast MA is below the Slow MAFast 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

ParameterTypeDefaultRangePurpose
Fast MA methodselectSimpleSimple, Exponential, Weighted, SmoothedSmoothing method of the fast MA
Slow MA methodselectSimpleSimple, Exponential, Weighted, SmoothedSmoothing method of the slow MA
Fast MA periodnumber122 to 1000Period of the fast MA
Slow MA periodnumber262 to 1000Period 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.