トレンドフォローに基づいた短期取引戦略

作者: リン・ハーンチャオチャン, 日時: 2023-09-27 16:56:34
タグ:

概要

この戦略は,損失制御による短期取引の強いトレンドと有利なタイミングを特定する. 傾向信号として単純な移動平均値の価格ブレイクを追跡し,短期価格動きを把握するために,RSIの差異に基づいてストップ・ロスト/テイク・プロフィートを設定する.

戦略の論理

  1. 多期単純な移動平均を計算する

    • 9日,50日,100日SMAの設定

    • 短いSMAが長いSMAを横切ると,トレンド方向を示します.

  2. RSI を用いて過買い/過売りレベルを判断する

    • RSIの長さは14期です

    • RSIが70を超えると買い過ぎ 30を下回ると売り過ぎ

  3. 価格が9日間のSMAを突破したときの取引

    • 価格が9日間のSMAを突破するとロング

    • 価格が9日SMAを下回るとショート

  4. ストップ・ロスト/テイク・プロフィートの設定は,RSIの差値に基づいて行う.

    • ストップ・ロスのRSIディバージェンス

    • RSIが既定レベルに達すると利益を得ます

利点分析

  • 高周波取引に適した短期的な傾向を把握する

  • SMAコンボはトレンド信号をフィルターし,悪い取引を避ける

  • RSI は,タイミングを決定し,リスクを効果的に制御するのに役立ちます

  • フレキシブルストップ・ロスト/テイク・プロフィート・ロック 短期利益

  • 指標を組み合わせることで 安定性が向上します

リスク分析

  • 短期的な傾向判断が不正確で 追いかけられる

  • 誤ったRSI信号は損失を増やす

  • 誤ったストップ・ロース/テイク・プロフィート設定は,利益を減少させ,損失を拡大させる.

  • 高い取引頻度はコストとスライドを増加させる

  • 非効率なパラメータと異常な市場影響戦略

  • パラメータを最適化 ストップ損失を厳格に管理する

オプティマイゼーションの方向性

  • トレンド判断を改善するために異なるSMAコンボをテストする

  • RSI信号を検証するためにSTOCHのような追加の指標を検討します.

  • マシン・ラーニングを使用して有効なブレイクアウトを決定する

  • 異なる製品とセッションのパラメータを調整する

  • ストップ・ロスト/テイク・プロフィートのロジックをダイナミック・トレリングに最適化

  • 自動パラメータ調節メカニズムを探索する

結論

この戦略は,保守的な短期取引アプローチのために,SMAとRSIを組み合わせています.細かなパラメータの調整,信号の検証,リスクの制御により,より堅牢で適応性が高くなります.より多くのSMAコンボを探索し,機械学習モデルを追加することで改善の余地があります.継続的な最適化はさらなる成熟につながります.


/*backtest
start: 2023-08-27 00:00:00
end: 2023-09-26 00:00:00
period: 3h
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/
// © Coinrule

//@version=4
strategy(shorttitle='Maximized Scalping On Trend',title='Maximized Scalping On Trend (by Coinrule)', overlay=true, initial_capital = 1000, process_orders_on_close=true, default_qty_type = strategy.percent_of_equity, default_qty_value = 30, commission_type=strategy.commission.percent, commission_value=0.1)

//Backtest dates
fromMonth = input(defval = 1,    title = "From Month",      type = input.integer, minval = 1, maxval = 12)
fromDay   = input(defval = 10,    title = "From Day",        type = input.integer, minval = 1, maxval = 31)
fromYear  = input(defval = 2019, title = "From Year",       type = input.integer, minval = 1970)
thruMonth = input(defval = 1,    title = "Thru Month",      type = input.integer, minval = 1, maxval = 12)
thruDay   = input(defval = 1,    title = "Thru Day",        type = input.integer, minval = 1, maxval = 31)
thruYear  = input(defval = 2112, title = "Thru Year",       type = input.integer, minval = 1970)

showDate  = input(defval = true, title = "Show Date Range", type = input.bool)

start     = timestamp(fromYear, fromMonth, fromDay, 00, 00)        // backtest start window
finish    = timestamp(thruYear, thruMonth, thruDay, 23, 59)        // backtest finish window
window()  => true      // create function "within window of time"

//MA inputs and calculations
movingaverage_fast = sma(close, input(9))
movingaverage_mid= sma(close, input(50))
movingaverage_slow = sma(close, input (100))


//Trend situation
Bullish= cross(close, movingaverage_fast)

Momentum = movingaverage_mid > movingaverage_slow

// RSI inputs and calculations
lengthRSI = 14
RSI = rsi(close, lengthRSI)

//Entry
strategy.entry(id="long", long = true, when = Bullish and Momentum and RSI > 50)

//Exit

TP = input(70)
SL =input(30)
longTakeProfit  = RSI > TP
longStopPrice = RSI < SL

strategy.close("long", when = longStopPrice or longTakeProfit and window())

plot(movingaverage_fast, color=color.black, linewidth=2 )
plot(movingaverage_mid, color=color.orange, linewidth=2)
plot(movingaverage_slow, color=color.purple, linewidth=2)


もっと