FactorSage

Backtesting · Lesson 3.3

Sell levels and the final exit

FactorSage does not force you to either hold or sell the entire position. Sell levels let you peel off slices as conditions fire, and the final exit handles the rest.

Scaling out

A sell level defines sellPercent — how much of the current position to close — and the condition that triggers it. A typical pattern is to take a third off when MOS turns negative, another third on a 25% gain, and let the rest run.

Order matters

Sell levels evaluate top to bottom. If the first level fires and reduces the position, the next one acts on the reduced size, not the original.

The final exit

The final exit is a single condition group that closes the remaining position outright. Use it for hard rules like a stop loss based on LOSS_PCT IS_AT_OR_ABOVE 0.25 or a thesis-break valuation rule.