Oscillator Candles Momentum Trading Strategy
Overview
This is a momentum-based strategy that uses oscillators indicators like RSI, Stoch, MACD to generate trading signals. The main idea is to identify trend direction when price oscillates by using indicators and enter trades based on indicator signals. The strategy also uses delayed supertrend for stop loss.
Strategy Logic
The strategy first calls custom function f_getOscilatorValues to get values of different oscillator indicators including RSI, Stoch, MACD etc. Then it calculates delayed supertrend values with f_getSupertrend to track stop loss.
After calculating the indicators, the strategy calls f_getBuySellStops to compute entry stops and profit targets based on indicator values. Specifically, it calculates ATR and uses ATR multiplied by a stop loss coefficient as entry stop, and ATR multiplied by a take profit coefficient as profit target. The stops and targets will adjust when trend reverses.
Next, the strategy determines the candle direction. Uptrend candles are colored green and downtrend candles are colored red. After plotting candles and indicators, the strategy checks if entry conditions are met. The entry conditions are buying when indicator shows overbought and price breaks above upper band, and selling when indicator shows oversold and price breaks below lower band. There is also a filtering condition requiring price to break higher timeframe moving average.
After entry, stop loss is trailed by upper/lower band whichever is closer. When stop loss is triggered, the position is closed. When price reaches profit target, partial profit is taken.
Advantage Analysis
The advantages of this strategy are:
-
Using oscillators to identify trend direction can capture short-term reversal opportunities timely.
-
Applying delayed supertrend stop loss can stop out before loss increases, limiting single trade loss.
-
Calculating stop loss and profit target based on dynamic ATR helps adjust position sizing.
-
Filtering with higher timeframe moving average avoids being trapped in consolidations.
-
Partial profit taking lets profits run while locking some profit.
-
The logic is simple and easy to understand for quant trading beginners.
Risk Analysis
Some risks of this strategy include:
-
Oscillators may have lagging issues, causing delayed entry and premature exit signals. This can be improved by optimizing parameters or adding trend following indicators.
-
Tight stop loss may get hit. Stop loss range could be widened or dynamic stops like Chandelier can be used.
-
Remaining position after partial profit taking may be stopped out. The partial profit ratio could be lowered.
-
Backtest overfitting risk. The strategy should be validated across different markets.
-
Failure of higher timeframe moving average filter. Trend classification methods should be used together.
Enhancement Directions
The strategy can be optimized in the following aspects:
-
Test different combinations of oscillators parameters and find the ones that provide quality signals.
-
Try replacing partial profit taking with trailing profit stop based on ATR or moving averages.
-
Add machine learning algorithms to replace moving average for trend analysis and improve accuracy.
-
Add volume indicators as filtering conditions to avoid unnecessary reversals.
-
Ensemble and weight optimize indicators to find the optimal combination for the asset.
-
Add machine learning risk control modules to dynamically optimize stops, targets and position sizing.
-
Incorporate triangular arbitrage or basis trading signals using price spreads between futures and spot.
Conclusion
Overall this is a great strategy for quant trading beginners with clear logic focusing on indicators and risk management. But parameter optimization and risk reduction are still needed for live trading. It can also be enhanced in aspects like trend analysis, stop loss optimization, ensemble models etc to improve robustness. As a trading strategy template, it provides valuable reference.
/*backtest
start: 2023-08-26 00:00:00
end: 2023-09-25 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © HeWhoMustNotBeNamed
//@version=4- 1
