StructureZones
StructureZones is a built-in TypeScript strategy from @tradejs/strategies.
It researches market-structure zones built from swing points, then trades reactions or transition breakouts from those zones.
Entry Logic
- Replays candles through
createStructureZonesEngine(...). - Reads
runtimeState.signalandruntimeState.snapshot. - Skips until a structure-zone signal exists.
- Selects
LONGorSHORTside config from signal direction. - Places the stop outside the signal zone, using ATR and percent buffers.
- Computes target from
STRUCTURE_ZONES_TARGET_R_MULT. - Sizes quantity from
MAX_LOSS_VALUE / riskDistance, withFEE_PERCENTbuffer. - Returns
entrywith structure-zone figures andstructureZonesContext.
Entry codes are based on the signal kind and direction:
STRUCTURE_ZONES_<KIND>_LONGSTRUCTURE_ZONES_<KIND>_SHORT
Exits
When a position exists:
STRUCTURE_ZONES_OPPOSITE_SIGNAL_EXITwhenSTRUCTURE_ZONES_EXIT_ON_OPPOSITE_SIGNAL=trueand the engine emits an opposite signal.- otherwise
POSITION_EXISTS.
Config Parameters
Zone model:
STRUCTURE_ZONES_PIVOT_LENGTHSTRUCTURE_ZONES_ATR_LENGTHSTRUCTURE_ZONES_MIN_SWING_ATRSTRUCTURE_ZONES_ZONE_WIDTH_ATRSTRUCTURE_ZONES_ACCEPT_BARSSTRUCTURE_ZONES_REACTION_CLOSE_BEYOND_ZONESTRUCTURE_ZONES_REQUIRE_REACTION_BODYSTRUCTURE_ZONES_TRADE_TRANSITION_BREAKOUTSSTRUCTURE_ZONES_STOP_ZONE_BUFFER_MULTSTRUCTURE_ZONES_STOP_BUFFER_PCTSTRUCTURE_ZONES_TARGET_R_MULTSTRUCTURE_ZONES_EXIT_ON_OPPOSITE_SIGNALSTRUCTURE_ZONES_MAX_FIGURE_POINTS
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,LONG.*,SHORT.* - shared indicators: MA, OBV, ATR, BB, MACD fields
Signal Payload
The strategy stores:
additionalIndicators.structureZonesContext- zone, signal, stop, and target figures from
buildStructureZonesFigures(...) orderPlan.stopLossPrice- one take-profit at the computed target
Common Skip Reasons
NO_STRUCTURE_ZONE_SIGNALPOSITION_EXISTSDEV_TRADE_COOLDOWNSTRATEGY_DISABLEDINVALID_STOPINVALID_QTYRISK_RATIO:<value>
Validation Notes
Keep zone detection causal and inspect chart artifacts before trusting aggregate metrics. STRUCTURE_ZONES_TRADE_TRANSITION_BREAKOUTS changes the strategy surface, so compare it as a separate experiment.
Related: