
This strategy is a quantitative trading system based on linear signals and Z-score normalization. It constructs standardized trading signals by combining exogenous variables like RSI with price data and triggers trades using thresholds. The strategy is suitable for intraday and high-frequency trading scenarios, offering strong adaptability and configurability.
The core principles include several key steps: 1. Linear Signal Construction: Uses configurable weights (signal_alpha) to linearly combine RSI indicator with price data to form initial signals. 2. Z-Score Normalization: Calculates mean and standard deviation of linear signals based on a lookback period, normalizing signals into Z-scores. 3. Threshold Trigger Mechanism: Opens long positions when Z-score falls below negative threshold and short positions when above positive threshold, controlled by risk_adjustment_factor. 4. Risk Management: Sets stop-loss and take-profit levels for each trade, with flexible risk-reward ratio adjustment through percentage parameters.
This is a well-structured and logically rigorous quantitative trading strategy. It builds a robust trading signal system through linear combination and standardization processing. The strategy offers strong configurability and comprehensive risk management but requires attention to parameter optimization and market adaptability. Through the suggested optimization directions, the strategy’s stability and profitability can be further enhanced.
/*backtest
start: 2024-12-29 00:00:00
end: 2025-01-05 00:00:00
period: 15m
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Linear Signal-Based Strategy", shorttitle = "LSB_V1", overlay=true)
// Inputs
lookback_period = input.int(14, title="Lookback Period for Moving Averages")
signal_alpha = input.float(0.5, title="Signal Weight Alpha (Exogenous Variable)")
take_profit_percent = input.float(0.02, title="Take Profit (%)")
stop_loss_percent = input.float(0.01, title="Stop Loss (%)")
risk_adjustment_factor = input.float(1.5, title="Risk Adjustment Factor")
// Fetch Exogenous Variable (Example: RSI as a Proxy)
rsi_value = ta.rsi(close, lookback_period)
// Linear Signal Calculation
linear_signal = signal_alpha * rsi_value + (1 - signal_alpha) * close
// Z-Score Normalization for Signal
mean_signal = ta.sma(linear_signal, lookback_period)
stddev_signal = ta.stdev(linear_signal, lookback_period)
z_score_signal = (linear_signal - mean_signal) / stddev_signal
// Entry Conditions
long_condition = z_score_signal < -risk_adjustment_factor
short_condition = z_score_signal > risk_adjustment_factor
// Risk Management
long_take_profit = close * (1 + take_profit_percent)
long_stop_loss = close * (1 - stop_loss_percent)
short_take_profit = close * (1 - take_profit_percent)
short_stop_loss = close * (1 + stop_loss_percent)
// Execute Trades
if (long_condition)
strategy.entry("Long", strategy.long, qty=1)
strategy.exit("Exit Long", "Long", stop=long_stop_loss, limit=long_take_profit)
if (short_condition)
strategy.entry("Short", strategy.short, qty=1)
strategy.exit("Exit Short", "Short", stop=short_stop_loss, limit=short_take_profit)