Quant Strategy with Stochastic Signal, SMA Filter and Random Stop loss/take profit
Overview
The strategy is named "DayLight Hunter Quant Strategy with Two-way Position, Stochastic Signal and Random Stop loss/take profit". The main idea is to generate trading signals with Stochastic indicator, filter the signals with SMA, implement two-way position opening, and set random stop loss and take profit points to lock in profits.
Strategy Logic
The strategy uses 5-day Stochastic Indicator %K and %D line crossovers to generate trading signals. When %K crosses over %D from below, a buy signal is generated. When %K crosses below %D from above, a sell signal is generated. To filter false signals, 50-day SMA lines are used - only when close price is below SMA low point, a buy signal is valid; only when close price is above SMA high point, a sell signal is valid.
Upon receiving a buy signal, the strategy will open long position with fixed quantity. Upon receiving a sell signal, if in one-way trading mode, it will close previous long position and open short position. If in hedging mode, it will simply open additional short position to hedge. For every trading unit, random stop loss and take profit points are set based on certain percentage of current price. This allows locking in profits and controlling risks.
Advantages
The biggest advantage of this strategy is it uses Stochastic signals with SMA filter to achieve relatively low false signal rate in two-way trading. This provides more profit opportunities. In addition, the random stop loss/take profit mechanism allows taking profit in time after making profits, avoiding giving back all profits; and cutting losses in case of huge loss, to reduce loss. In summary, the strategy has larger profit margin and better risk control.
Risks
Main risks of this strategy include false signals of Stochastic indicator may lead to unnecessary losses; improper random stop loss/take profit points may be too aggressive, causing premature or late exit, impacting profitability; inability to cut loss in time in hedging trades can lead to amplification of losses.
To reduce risks, parameters of SMA filter can be optimized to filter out more false signals. Also consider combining other indicators to determine market trends to avoid trading against trends. Finally, reasonable stop loss range should be set, and independent stop loss points should be used for hedging units to control risk.
Optimization Directions
The strategies can be optimized in the following aspects:
-
Optimize parameters of Stochastic to find best parameter combination to reduce false signals.
-
Optimize or add other technical indicators to aid Stochastic in determining trends, e.g. MACD, KD etc.
-
Use machine learning models to study metrics like accuracy, win rate etc of Stochastic signals under different parameters, to find optimal parameter space.
-
Optimize the random stop loss/take profit algorithms to make them more intelligent and dynamic, e.g. incorporate concepts like moving stop loss, position sizing etc.
-
Add position sizing module, allowing dynamic position adjustments based on performance, market regimes etc.
Conclusion
The “DayLight Hunter Quant Strategy with Two-way Position, Stochastic Signal and Random Stop loss/take profit” combines Stochastic crossover signals, SMA filter principle, two-way trading and random stop loss/take profit method. It has advantages like relatively accurate signals, abundant two-way trading opportunities, flexible stop loss/profit taking, and risks within acceptable range. Further optimizations on parameter tuning, indicator combinations and risk control modules can help achieve more stable and better performance. It provides a very good reference case for quantitative trading practice.
/*backtest
start: 2023-12-31 00:00:00
end: 2024-01-07 00:00:00
period: 15m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
var int slippage = 0
strategy("X48 - DayLight Hunter | Strategy | V.01.01", overlay=true, calc_on_order_fills = true, initial_capital = 50,default_qty_type = strategy.fixed, default_qty_value = 1, commission_type = strategy.commission.percent, commission_value = 0, currency = currency.USD, slippage = 0)
- 1

