Type/to search

TradFi Equity Sector Long/Short Rotation Strategy

Common strategy
Created: 2026-09-16 15:14:55
Last modified: in 7 hours
2
Follow
526
Followers

Binance TradFi Equity Sector Long/Short Rotation Strategy

Risk warning: This strategy trades Binance USDT-margined TradFi equity perpetual contracts, not actual shares. Perpetual contracts involve leverage, funding fees, liquidity risk, tracking error, off-hours price divergence, and liquidation risk. The long and short legs are submitted sequentially and cannot be guaranteed to fill simultaneously. Fast markets may leave the portfolio temporarily incomplete, increase slippage, or create unintended net exposure. This description is not investment advice. Complete backtesting, online paper observation, and small-size live validation before enabling real trading.

Strategy Concept

This is a cross-sectional momentum strategy that compares the relative strength of multiple equity sectors. The user first defines sectors and their member contracts in SectorConfig. Using the same set of closed four-hour bars for every symbol, the strategy calculates each stock's return over the lookback window and takes the arithmetic mean of at least two valid members to obtain the sector-level momentum.

All valid sectors are ranked from strongest to weakest. The strategy buys every valid member of the top-ranked sector and shorts every valid member of the bottom-ranked sector. It does not select only one winning stock and one losing stock. The long and short baskets receive the same target notional, seeking to capture continued outperformance of the strong sector relative to the weak sector while reducing broad market direction exposure.

Members are not equally weighted. The strategy first reserves enough notional for each contract to satisfy the exchange minimum quantity, then allocates the remaining side budget in inverse proportion to each stock's volatility of four-hour returns. Lower-volatility members therefore receive larger weights and higher-volatility members receive smaller weights. This is a risk-allocation rule and does not imply that low-volatility stocks are inherently safe.

Signals and Entry

At each evaluation, the target portfolio is built through the following process:

text
Read closed 4H bars → Calculate stock momentum and volatility → Average momentum by sector and rank all sectors → Check the momentum gap between the strongest and weakest sectors → Buy every valid member of the strongest sector → Short every valid member of the weakest sector → Verify basket completeness and long/short exposure

A portfolio is opened only when the momentum gap between the strongest and weakest sectors reaches MinGapPct. If the gap is too small, the strategy remains flat and closes any managed positions. A sector must have at least two valid members to enter the ranking. Fewer than two valid sectors means no trading target can be formed.

With EnableTrading=false, the program only reads live market data, ranks sectors, and displays signals; it neither creates a simulated account nor sends orders. With EnableTrading=true, it sets leverage and submits real market orders for the target contracts in SectorConfig. Before rotating, it cancels related open orders and closes the previous basket, then opens the new legs sequentially. If any member fails to open, the program attempts to unwind the entire partially established basket.

Holding and Exit

After each rebalance interval, sector rankings are recalculated. If the strongest and weakest sectors are unchanged and current position directions still match the stored target, positions are held without automatic weight rebalancing for changes in price or volatility. If either target sector changes, the old basket is closed before a new one is established. If the momentum gap falls below the threshold, all managed positions are closed and the strategy moves to cash.

While holding positions, the program continuously reads real positions within the SectorConfig universe. A missing leg, wrong-side leg, extra position, or long/short notional deviation above NetExposureMaxPct triggers an attempt to flatten the whole basket and forces a fresh evaluation. If combined unrealized losses on managed positions reach PortfolioStopPct of the current total gross notional, the strategy closes all managed positions and enters a stopped state. Manual resume is required before trading can continue.

The status panel displays sector rankings, target allocation, real exchange positions, recent execution records, and key parameters. The flat command manually closes positions managed by the strategy, while rebalance requests an immediate re-evaluation. The program manages only contracts listed in the active SectorConfig. These contracts should not be shared with another strategy, because unrelated positions may be treated as extra legs and trigger a full exit.

Main Parameters

ParameterDefaultDescription
EnableTradingfalseDisplays live signals only when disabled; sends real Binance orders when enabled
SectorConfigFour preset groups: Semiconductors, Financials, Consumer, and HealthcareDefines sectors and FMZ contract codes; requires at least two sectors and two stocks per sector, with no symbol duplicated across groups
LookbackBars30Uses 30 closed four-hour bars to calculate stock momentum; minimum is 6
RebalanceHours24Re-evaluates relative sector strength every 24 hours
MinGapPct8Requires at least an 8-percentage-point gap between the strongest and weakest sector momentum
PerSideNotional100 USDTTarget total notional for the entire long basket and for the entire short basket, not per stock
Leverage1Leverage set on each equity perpetual contract, subject to exchange limits
MaxRepairRounds3Maximum repeated checks for cancellation, closing, and basket repair
NetExposureMaxPct10%Flattens the basket when the long/short notional imbalance exceeds this threshold
PortfolioStopPct5%Stops and flattens when managed unrealized loss reaches this share of current total gross notional; set to 0 to disable

Validation Status

The current version has passed JavaScript syntax checks, FMZ XML section and parameter-JSON checks, and consistency checks between the standalone JavaScript and the source embedded in the XML. Its companion extended version has passed 28 offline Node.js tests covering average sector momentum ranking, whole-sector long/short direction, per-side budget limits, inverse-volatility allocation, sector rotation, basket rollback, net exposure, portfolio stop, state recovery, and separation of paper and live interfaces.

These tests use deterministic synthetic markets and FMZ API stubs. They only demonstrate logical behavior in covered scenarios and do not represent actual execution performance. FMZ import verification, FMZ backtesting, online paper operation, and small-size live trading have not yet been completed. Before live use, verify regional product availability, contract codes, minimum order sizes, quantity precision, actual trading hours, funding rates, liquidity, and API behavior. Particular attention should be paid to turnover costs, sudden sector reversals, and asynchronous execution across multiple legs.

Source
JavaScript
/*
 * 币安 TradFi 股票板块多空轮动(FMZ JavaScript / 实盘版)
 *
 * 正确的比较层级:
 * 1. 先计算每个股票板块的整体动量;
 * 2. 做多整体最强的板块,做空整体最弱的板块;
 * 3. 每侧总名义金额相等,再按成分股波动率倒数分配仓位;
 * 4. 最强与最弱板块差距不足时不交易。
 *
 * EnableTrading=false 时只展示真实行情信号,不建立模拟账户。
 * EnableTrading=true 后发送币安真实委托。策略只管理 SectorConfig 内的合约。
 */
Strategy parameters
Strategy parameters
开启真实交易
股票板块配置 (Optional)
动量观察K线 (Optional)
复评间隔(小时) (Optional)
最小板块强弱差(%) (Optional)
每侧总名义金额(USDT) (Optional)
杠杆倍数 (Optional)
委托修复轮数 (Optional)
净敞口上限(%) (Optional)
管理仓位止损(%) (Optional)
Comment
All comments (0)
No data
No data
  • 1
Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)