Files
ai/gateway/knowledge/trading/strategies/stocks/three-moving-averages.md
Tim Olson 47471b7700 Expand model tag support: add GLM-5.1, simplify Anthropic IDs, scan tags anywhere in message
- Flink update_bars debouncing
- update_bars subscription idempotency bugfix
- Price decimal correction bugfix of previous commit
- Add GLM-5.1 model tag alongside renamed GLM-5
- Use short Anthropic model IDs (sonnet/haiku/opus) instead of full version strings
- Allow @tags anywhere in message content, not just at start
- Return hasOtherContent flag instead of trimmed rest string
- Only trigger greeting stream when tag has no other content
- Update workspace knowledge base references to platform/workspace and platform/shapes
- Hierarchical knowledge base catalog
- 151 Trading Strategies knowledge base articles
- Shapes knowledge base article
- MutateShapes tool instead of workspace patch
2026-04-28 15:05:15 -04:00

2.8 KiB
Raw Blame History

description, tags
description tags
Uses three moving averages of ascending length to filter false signals, requiring full alignment of all three MAs before establishing or liquidating long or short positions.
stocks
trend-following
moving-average
technical-analysis

Three Moving Averages

Section: 3.13 | Asset Class: Stocks | Type: Trend-Following / Technical Analysis

Overview

Adding a third moving average helps filter false signals that arise in the two-MA strategy. A long position is established only when all three MAs are in descending order by length (shortest on top), confirming a strong uptrend. Liquidation occurs as soon as the shortest MA drops below the middle MA — an earlier warning than waiting for a full cross of the two outer MAs.

Construction / Signal

Three MAs with lengths T_1 < T_2 < T_3 (e.g., T_1 = 3, T_2 = 10, T_3 = 21):

Signal = { Establish long position if MA(T_1) > MA(T_2) > MA(T_3)
          { Liquidate long position if MA(T_1) <= MA(T_2)
          { Establish short position if MA(T_1) < MA(T_2) < MA(T_3)
          { Liquidate short position if MA(T_1) >= MA(T_2)             (324)
  • Long trigger: All three MAs are in bullish alignment (T_1 > T_2 > T_3 in value).
  • Long liquidation: Early warning — the short MA drops back below the middle MA (even if still above the long MA).
  • Short trigger: All three MAs are in bearish alignment (T_1 < T_2 < T_3 in value).
  • Short liquidation: Early warning — the short MA rises back above the middle MA.

Entry / Exit Rules

  • Long entry: MA(T_1) > MA(T_2) > MA(T_3)
  • Long exit: MA(T_1) <= MA(T_2)
  • Short entry: MA(T_1) < MA(T_2) < MA(T_3)
  • Short exit: MA(T_1) >= MA(T_2)

Key Parameters

  • Short MA length T_1: Typically 310 trading days
  • Middle MA length T_2: Typically 1021 trading days
  • Long MA length T_3: Typically 2150 trading days; must have T_1 < T_2 < T_3
  • Example: T_1 = 3, T_2 = 10, T_3 = 21
  • MA type: SMA or EMA

Variations

  • Different exit rule: Liquidate when T_1 falls below T_3 (slower exit) instead of T_2
  • Combined with stop-loss: Add price-based stop-loss as in the two-MA strategy (Section 3.12)
  • Four or more MAs: Further extension possible but increases complexity and reduces signal frequency

Notes

  • The three-MA strategy generates fewer signals than the two-MA strategy, filtering out some false crossovers.
  • The early liquidation rule (based on T_1 vs T_2 only) provides faster exit than waiting for full reversal.
  • Like all MA-based strategies, considered "unscientific" by academics but widely used by practitioners.
  • Best applied in trending markets; whipsaw losses occur in range-bound (mean-reverting) markets.
  • Applicable single-stock or across a universe; parameter selection should be done via backtesting.