多指標のビットコイン・デイリー・トレーディング・戦略

作者: リン・ハーンチャオチャン開催日:2023年10月30日 10:37:58
タグ:

img

概要

この戦略は,ビットコインの日々のタイムフレーム内で取引機会を特定するために複数の指標を組み合わせます.主にMACD,RSI,ストックRSIなどの指標を使用し,移動平均の方向とともに,購入・販売信号を生成するための現在のトレンド方向を決定します.

戦略の論理

この戦略は,以下の主要指標を利用しています.

  1. MACD (Fast MA - Slow MA) とその信号線.信号線の上のMACDを横切ると買い信号,0以下の横切りは売り信号になります.

  2. RSI (Relative Strength Index) RSIが値を超えると買い信号が伝わります

  3. ストックRSI. ストックRSIは,RSIの買い過ぎ/売過ぎレベルを示します. ストックRSIは,値以下で購入信号を表示し,値以上では販売信号を表示します.

  4. 移動平均方向 マーの下を横切る 閉じる価格が売る信号を出す

これらの指標によると,取引シグナルは以下のとおりです.

購入信号いつ(Stoch RSI < Threshold) AND (MACD crossing above threshold OR RSI crossing above threshold)

シグナルを売りいつ(MACD crossing below 0) AND (Close below MA OR Stoch RSI > Threshold)

複数の指標を組み合わせることで,現在のトレンドの方向性をよりよく判断し,トレンドの逆転点を特定することができます.

利点

  1. 複数の指標を組み合わせることで,正確性が向上し,単一の指標からの誤った信号は避けられます.

  2. MACDはトレンド方向と強度を示します.RSIは過買い/過売れレベルを反映します.ストックRSIはRSIの過買い/過売れを決定します.MAはトレンド方向を示します.これらの指標は互いに検証します.

  3. 買い/売るシグナルには複数の指標の組み合わせが必要で,いくつかの誤ったシグナルをフィルタリングし,不必要な取引を避けます.

  4. バックテストは2017年1月1日から開始され,2017年末のビットコインの巨大ブールランをカバーしています.実際のブール市場で戦略パフォーマンスをテストします.

  5. ストップ・ロスは,単一の取引で損失を制御するように設定されています.

リスク

  1. 複数の指標を使用すると正確性が向上しますが,それらの間の不一致は,誤った信号につながる可能性があります.

  2. ストップ・ロスの最適化レベルは,異なる市場状況に合わせて調整する必要がある場合があります.ストップ・ロスは幅が大きすぎると,単一の取引での損失が増加しますが,幅が狭すぎると,早めに停止することがあります.

  3. 日々のタイムフレームは 細かい作業を 短時間で阻止し 突然の短期的な大きな動きに対応できない

  4. 戦略は,限られた歴史的データのみでバックテストされています.過剰なフィットリスクがあります.より長い時間枠とより多くの市場でさらなるテストが必要です.

増進 の 機会

  1. 複数の指標の組み合わせをテストし,最適な多指標戦略を見つけます.

  2. 指標のパラメータを最適化して より良い値を得る.

  3. 最適なリスク/リターン比を見つけるために 異なるストップ・ロスのレベルをテストします

  4. 長い歴史データでバックテストを 実行して過剰なフィットメントを避ける

  5. より頻繁な取引のために,より高い周波数のタイムフレームで戦略の論理を適用することを探求します.

結論

この戦略は,MACD,RSI,ストックRSIおよび他の指標を組み合わせて,ビットコインの日々のトレンド方向を決定し,トレードエントリーのためのトレンド逆転を特定します.ストップロスは取引リスクを制御するために設定されています.バックテストはポジティブな結果を示していますが,過剰なリスクを避けるためにより長い時間枠とより多くの市場でさらなる検証が必要です.指標パラメータとストップロスト/テイク・プロフィートレベルのさらなる最適化は結果を改善することができます.この戦略は,より深い探索と強化に値するマルチインジケーター組み合わせアプローチの初期概念を提供します.


/*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)

もっと