The resource loading... loading...

Multi-Indicator Bitcoin Daily Trading Strategy

Author: ChaoZhang, Date: 2023-10-30 10:37:58
Tags:

img

Overview

This strategy combines multiple indicators to identify trading opportunities within the daily time frame for Bitcoin. It mainly uses indicators like MACD, RSI, Stoch RSI, together with the direction of moving average to determine the current trend direction for generating buy and sell signals.

Strategy Logic

The strategy utilizes the following key indicators:

  1. MACD (Fast MA - Slow MA) and its signal line. MACD crossing above signal line gives buy signal, and crossing below 0 gives sell signal.

  2. RSI (Relative Strength Index). RSI crossing above a threshold gives buy signal.

  3. Stoch RSI. Stoch RSI shows overbought/oversold levels of RSI. Stoch RSI below threshold gives buy signal, while above threshold gives sell signal.

  4. Moving average direction. Close price crossing below MA gives sell signal.

According to these indicators, the trading signals are:

Buy Signal: When (Stoch RSI < Threshold) AND (MACD crossing above threshold OR RSI crossing above threshold)

Sell Signal: When (MACD crossing below 0) AND (Close below MA OR Stoch RSI > Threshold)

Using multiple indicators together can better determine the current trend direction and identify trend reversal points for entering trades.

Advantages

  1. Combining multiple indicators improves accuracy and avoids false signals from a single indicator.

  2. MACD shows trend direction and strength. RSI reflects overbought/oversold levels. Stoch RSI determines overbought/oversold of RSI. MA shows trend direction. These indicators verify each other.

  3. The buy/sell signals require a combination of multiple indicators, filtering out some false signals and avoiding unnecessary trades.

  4. Backtest starts from 2017/1/1, covering the huge bull run of Bitcoin at 2017 year end. Tests strategy performance in a real bull market.

  5. Stop loss is set to control loss in single trades.

Risks

  1. Although using multiple indicators improves accuracy, discrepancy between them can still lead to some wrong signals.

  2. The optimized stop loss level may need adjustments for different market situations. Stop loss too wide increases loss in single trades, while too tight may get stopped out prematurely.

  3. Daily timeframe prevents detailed operations in shorter time ranges. Unable to respond to sudden short-term big moves.

  4. Strategy is only backtested on limited historical data. Overfit risk exists. Requires further testing across longer timeframe and more markets.

Enhancement Opportunities

  1. Test more indicator combinations to find optimal multi-indicator strategies.

  2. Optimize parameters of the indicators for better values.

  3. Test different stop loss levels to find optimal risk/reward ratio.

  4. Conduct backtests across longer historical data to avoid overfitting.

  5. Explore applying strategy logic in higher frequency timeframes for more frequent trading.

Conclusion

This strategy combines MACD, RSI, Stoch RSI and other indicators to determine the bitcoin daily trend direction and identify trend reversals for trade entry. Stop loss is set to control trade risk. Backtest shows positive results but still requires further verification across longer timeframe and more markets to avoid overfit risks. Further optimizations on indicator parameters and stop loss/take profit levels can improve results. The strategy provides an initial idea of multi-indicator combination approach which is worth deeper exploration and enhancement.


/*backtest
start: 2022-10-23 00:00:00
end: 2023-10-29 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
// Original code is from CredibleHulk and modified by bennef
strategy("BTC Daily Strategy BF", overlay=false, initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=0.075)

/////////////// Time Frame ///////////////
testStartYear = input(2017, "Backtest Start Year") 
testStartMonth = input(1, "Backtest Start Month")
testStartDay = input(1, "Backtest Start Day")
testPeriodStart = timestamp(testStartYear,testStartMonth,testStartDay, 0, 0)

testStopYear = input(2019, "Backtest Stop Year")
testStopMonth = input(12, "Backtest Stop Month")
testStopDay = input(31, "Backtest Stop Day")
testPeriodStop = timestamp(testStopYear,testStopMonth,testStopDay, 0, 0)

testPeriod() => true

/////////////// Input Params /////////////// 
rsi_threshold = input(30)
rsi_length = input(4)
srsi_length = input(8)
srsi_smooth = input(4)
srsi_sell_threshold = input(57)
length = input(14)
dma_signal_threshold = input(-1)
fastLength = input(11)
slowlength = input(18)
MACDLength = input(6)
MACD_signal_threshold = input(-2)
short_loss_tol = input(5)
long_loss_tol = input(5)

stop_level_long = strategy.position_avg_price * (1 - long_loss_tol / 100.0)
stop_level_short = strategy.position_avg_price * (1 + short_loss_tol / 100.0)
    
///////////////  Signal generation ///////////////
// MACD 
MACD = ema(close, fastLength) - ema(close, slowlength)
aMACD = ema(MACD, MACDLength)
delta = MACD - aMACD

// RSI and Stochastic RSI 
rs = rsi(close, rsi_length)
k = sma(stoch(rs, rs, rs, srsi_length), srsi_smooth)

// SMA 
norm = sma(ohlc4, length)
threshold = close - norm   

/////////////// Strategy ///////////////
long = ((crossover(delta, MACD_signal_threshold) or crossover(rs, rsi_threshold)) and k < srsi_sell_threshold)
short = (crossunder(delta, 0) or (crossunder(threshold, dma_signal_threshold) and k > srsi_sell_threshold))

if testPeriod()
    strategy.entry("L", strategy.long, when = long)
    strategy.entry("S", strategy.short, when = short)
    strategy.exit("stop loss L", from_entry = "L", stop = stop_level_long)
    strategy.exit("stop loss S", from_entry = "S", stop = stop_level_short)

/////////////// Plotting ///////////////
// MACD
plot(delta, color = delta > MACD_signal_threshold ? color.lime : delta < 0 ? color.red : color.yellow)
MACD_signal_threshold_line = hline(MACD_signal_threshold, color = color.yellow, title = "MACD Signal Threshold")

// RSI
plot(rs, color = rs > rsi_threshold ? color.lime : color.fuchsia)
rsi_threshold_line = hline(rsi_threshold, color = color.fuchsia, title = "RSI Threshold")

// Stochastic RSI 
plot(k, color = k > srsi_sell_threshold ? color.lime : color.red)
srsi_sell_threshold_line = hline(srsi_sell_threshold, color = color.white, title = "Stoch RSI Threshold")

// SMA
plot(threshold / 100, color = threshold < dma_signal_threshold ? color.red : color.blue)
dma_signal_threshold_line = hline (dma_signal_threshold, color = color.blue, title = "DMA Signal Threshold")

bgcolor(long ? color.lime : short ? color.red : na, transp=50)

More