This strategy combines RSI, MACD, Bollinger Bands and limit up/down factors to implement multi-factor momentum rotation trading. The strategy first judges if multiple technical indicators give buy or sell signals simultaneously. If so, corresponding buy or sell operations will be executed. Meanwhile, the strategy adopts moving stop profit and stop loss to lock in profits and control risks.
The main components of this strategy are:
Factor judgement
Entry and exit
Strategy optimization
The strategy considers multiple factors like RSI and MACD rather than just single indicator. This reduces false signals and improves entry accuracy.
Indicators like RSI and MACD have obvious momentum characteristic, which capture price trend changes. They are more sensitive than trend following indicators like MAs.
Moving stop profit can lock in profits dynamically following the market. Stop loss setting controls single trade loss.
The strategy combines common technical indicators and has certain universality. Its rules are relatively simple and clear.
The strategy focuses on mean-reversion trading. It may trigger frequent stop loss in a bull market.
If parameters are set too sensitively, trading frequency may be too high, increasing costs and slippage.
The strategy relies on consistent signals across indicators, but sometimes divergences may happen, resulting in wrong signals.
Fixed stop loss points may be penetrated. Dynamic stop loss or stock change may help avoid this risk.
Test RSI parameters and MA periods to find combinations with lower trading frequency.
Incorporate stock-specific stats like volatility and liquidity to set parameters and improve efficiency.
Adjust strategy parameters based on market panic indicators like VIX to reduce trading frequency during market-wide crashes.
Test long-term holding versus short-term rotation to see their impact on strategy performance.
Research more advanced dynamic stop profit/loss techniques and backtest them.
This strategy combines multiple technical indicators and adopts moving stop profit/loss to lock in profits and control risks while ensuring high entry accuracy. The logic is simple and clear. Performance can be further improved through parameter optimization and indicator selection. But the strategy is more suitable for mean-reversion and range-bound markets. It may underperform in persistent uptrends. In summary, this is a typical multi-factor mean-reversion momentum strategy that provides ideas and reference for stock rotation trading.
/*backtest start: 2023-09-24 00:00:00 end: 2023-10-24 00:00:00 period: 2h basePeriod: 15m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=2 strategy("RSI, TD Seq, MACD, BB Strategy - Calculation Trailing Profit",overlay=true) RSIDifference = input(-7, minval=-50, maxval=50, title="RSI Difference") TD = close > close[4] ?nz(TD[1])+1:0 TS = close < close[4] ?nz(TS[1])+1:0 TDUp = TD - valuewhen(TD < TD[1], TD , 1 ) TDDn = TS - valuewhen(TS < TS[1], TS , 1 ) TDcheckUP = iff(TD == 2, true, false) TDCheckDOWN = iff(TS == 2, true, false) [_, _, histLine] = macd(close, 12, 26, 9) MACDCheckDown = iff(histLine > 0 and histLine[1] > 0 and histLine[2] > 0 and histLine[3] > 0 and histLine[4] > 0, true, false) MACDCheckUp = iff(histLine < 0 and histLine[1] < 0 and histLine[2] < 0 and histLine[3] < 0 and histLine[4] < 0, true, false) RSICal = rsi(close, 14) RSICalNewUp = 50 + RSIDifference RSICalNewDown = 50 - RSIDifference RSICheckUp = iff(RSICal <= RSICalNewUp, true, false) RSICheckDown = iff(RSICal >= RSICalNewDown, true, false) basis = sma(close, 20) dev = 2 * stdev(close, 20) upperBB = basis + dev lowerBB = basis - dev BBCheckUp = iff(close > upperBB, true, false) BBCheckDown = iff(close < lowerBB, true, false) //BBCheckUp = false //BBCheckDown = false BuyCheck = iff(TDcheckUP == true and MACDCheckUp == true and RSICheckUp == true and BBCheckUp == false, true, false) SellCheck = iff(TDCheckDOWN == true and MACDCheckDown == true and RSICheckDown == true and BBCheckDown == false, true, false) ProfitStratA = input(50, minval=0, maxval=10000, title="Profit", step=0.5) ProfitTrailingA = input(10, minval=0, maxval=10000, title="Profit", step=0.5) useStopLoss = input(false, title="Use Stop Loss?") LossstratA = input(145, minval=0, maxval=10000, title="Stop Loss", step=0.5) colB = input(100, minval=0, maxval=100, title="0-show / 100-hide Strategy", step=100) ProfitStrat = ProfitStratA * 10 ProfitTrailing = ProfitTrailingA * 10 Lossstrat = useStopLoss ? LossstratA * 10 : 1000000 if (strategy.position_size > 0) strategy.exit("BuyClose", "Buy", trail_points=ProfitStrat, trail_offset=ProfitTrailing, loss=Lossstrat) if (strategy.position_size < 0) strategy.exit("SellClose", "Sell", trail_points=ProfitStrat, trail_offset=ProfitTrailing, loss=Lossstrat) if (BuyCheck == true and strategy.position_size == 0) strategy.entry("Buy", strategy.long, comment="Long Entry") if (SellCheck == true and strategy.position_size == 0) strategy.entry("Sell", strategy.short, comment="Short Entry") plotshape(BuyCheck, color=blue, transp=colB, style=shape.arrowup, text="Buy\n", location=location.belowbar) plotshape(SellCheck, color=orange, transp=colB, style=shape.arrowdown, text="Sell\n", location=location.abovebar)