This strategy employs a hybrid quantitative analysis approach, combining binomial distribution model and regression analysis, to identify different market regimes. The strategy first calculates the Simple Moving Average (SMA) and Bollinger Bands (BB) indicators, then computes the Z-score based on the mean and standard deviation of historical returns. When the Z-score is below the lower threshold and the price is below the lower band, the strategy enters a long position; when the Z-score is above the upper threshold and the price is above the upper band, the strategy closes the position.
The core principle of this strategy is to use the Z-score to measure the position of current returns relative to the distribution of historical returns. The formula for calculating the Z-score is: (Current Return - Historical Return Mean) / Historical Return Standard Deviation. A higher Z-score indicates that the current return is more extreme and the probability of overbought is higher; a lower Z-score indicates that the current return is more extreme and the probability of oversold is higher. At the same time, the strategy also incorporates the Bollinger Bands indicator, using price breakouts above or below the bands as a secondary confirmation. The strategy generates trading signals only when both the Z-score and Bollinger Bands conditions are met simultaneously. This combination approach can effectively reduce the occurrence of false signals.
The Hybrid Binomial Z-Score Quantitative Strategy is a quantitative trading strategy based on statistical principles, identifying potential overbought and oversold opportunities by comparing current returns with the distribution of historical returns. Additionally, the strategy employs the Bollinger Bands indicator for secondary confirmation, enhancing signal reliability. The strategy rules are clear and easy to implement and optimize, but it also faces challenges such as parameter sensitivity, trend risk, overfitting risk, etc. In the future, the strategy can be optimized in terms of dynamic parameters, trend filtering, portfolio optimization, stop-loss and take-profit mechanisms, etc., to improve its adaptability and robustness. Overall, this strategy provides a simple yet effective approach for quantitative trading, worthy of further exploration and refinement.
/*backtest start: 2023-05-22 00:00:00 end: 2024-05-27 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=5 strategy("Estratégia Híbrida Quantitativa", overlay=true) // Definição de parâmetros sma_length = input.int(20, title="Período da SMA") threshold_high = input.float(1.5, title="Threshold Alto") threshold_low = input.float(-1.5, title="Threshold Baixo") lookback_period = input.int(252, title="Período de Retorno Histórico (dias)") // Funções auxiliares f_sma(source, length) => ta.sma(source, length) f_bollinger_band(source, length, mult) => basis = ta.sma(source, length) dev = mult * ta.stdev(source, length) [basis + dev, basis - dev] // Cálculo dos indicadores sma = f_sma(close, sma_length) [upper_band, lower_band] = f_bollinger_band(close, sma_length, 2) // Regime de Mercado: Binomial retornos = ta.change(close, 1) media_retornos = ta.sma(retornos, lookback_period) desvio_padrao_retornos = ta.stdev(retornos, lookback_period) // Indicador de Regime: Z-Score z_score = (retornos - media_retornos) / desvio_padrao_retornos // Sinal de Compra e Venda sinal_compra = z_score < threshold_low and close < lower_band sinal_venda = z_score > threshold_high and close > upper_band // Execução de Ordem if (sinal_compra) strategy.entry("Long", strategy.long) if (sinal_venda) strategy.close("Long") // Plotagem dos Indicadores plot(sma, title="SMA", color=color.blue) plot(upper_band, title="Upper Bollinger Band", color=color.red) plot(lower_band, title="Lower Bollinger Band", color=color.green) hline(threshold_high, "Threshold Alto", color=color.red, linestyle=hline.style_dashed) hline(threshold_low, "Threshold Baixo", color=color.green, linestyle=hline.style_dashed) plot(z_score, title="Z-Score", color=color.purple)