ReverseTrendLine
ReverseTrendLine is a built-in TypeScript strategy from @tradejs/strategies.
It builds support/resistance trendlines from recent highs and lows, then researches rejection behavior around those lines instead of the primary breakout path.
Entry Logic
- Builds high and low trendline candidates from candle pivots.
- Skips until an enabled side (
HIGHSorLOWS) produces a valid reverse setup. - Applies volatility and timing filters.
- Selects the side config from the candidate direction.
- Places a stop from
REVERSE_TRENDLINE_STOP_BASE_PCT. - Computes target from
REVERSE_TRENDLINE_TARGET_R_MULT. - Sizes quantity from
MAX_LOSS_VALUE / riskDistance, withFEE_PERCENTbuffer. - Returns
entrywith reverse-trendline figures and signal seed indicators.
Entry code:
REVERSE_TRENDLINE_SIGNAL
Exits
When a position exists:
REVERSE_TRENDLINE_FAILED_BOUNCE_EXITwhen the expected bounce/rejection fails.- otherwise
POSITION_EXISTS.
Config Parameters
Trendline model:
TRENDLINE.minTouchesTRENDLINE.offsetTRENDLINE.epsilonTRENDLINE.epsilonOffsetREVERSE_TRENDLINE_STOP_BASE_PCTREVERSE_TRENDLINE_TARGET_R_MULT
Side configs:
HIGHS.enable,HIGHS.direction,HIGHS.minRiskRatioLOWS.enable,LOWS.direction,LOWS.minRiskRatio
Shared groups:
- runtime:
ENV,INTERVAL,MAKE_ORDERS,BACKTEST_PRICE_MODE - AI/ML:
AI_ENABLED,AI_MODE,MIN_AI_QUALITY,ML_ENABLED,ML_THRESHOLD - risk:
FEE_PERCENT,MAX_LOSS_VALUE - shared indicators: MA, OBV, ATR, BB, MACD fields
Signal Payload
The strategy stores:
- reverse-trendline figures from
buildReverseTrendLineFigures(...) - signal seed indicators from
buildReverseTrendlineSignalSeed(...) orderPlan.qtyorderPlan.stopLossPrice- one take-profit at the computed target
Common Skip Reasons
NO_TRENDLINEPOSITION_EXISTSDEV_TRADE_COOLDOWNVERY_VOLATILITYREVERSE_TRENDLINE_TIMING:<code>INVALID_QTYRISK_RATIO:<value>
Validation Notes
Trendline strategies are sensitive to pivot selection, candle gaps, and chart scaling. Inspect generated figures before interpreting metrics, especially when changing TRENDLINE.epsilon or timeframe.
Related: