FactorSage

Strategy Examples ยท Lesson 4.4

EMA crossover with valuation

Crossovers fire on a single bar, so they make precise entry triggers. Pairing them with a valuation precondition avoids buying purely on momentum.

The rules

  • Buy signal (`ALL`): MARGIN_OF_SAFETY IS_AT_OR_ABOVE 0.15 AND EMA_21 CROSSES_ABOVE EMA_50
  • Sell level: EMA_21 CROSSES_BELOW EMA_50, sellPercent = 50
  • Final exit: MARGIN_OF_SAFETY IS_AT_OR_BELOW -0.05