週末の取引戦略

作者: リン・ハーンチャオチャン,日付: 2023-11-14 11:29:12
タグ:

img

概要

これは,Bitcoinの週末取引量が増加した10倍レバレッジを利用した短期取引戦略である.主なアイデアは金曜日の閉店価格を記録し,土曜日と日曜日の閉店価格を金曜日の閉店価格と比較し,上限値を超えるとロングまたはショートにする.ポジションは月曜日に閉鎖される.

戦略の論理

ストラテジーはまず金曜日の閉店価格を記録し,その後金曜日以降の日数を計算する.土曜日と日曜日に,日々の閉店価格が金曜日の閉店価格より4.5%以上であれば,ショートに行く.日々の閉店価格が金曜日の閉店価格より4.5%以上であれば,ロングに行く.各取引は10倍レバレッジを使用する.利益が初期資本の10%に達した場合,すべてのポジションを閉じる.月曜日に,すべてのポジションを無関係に閉じる.

具体的には,この戦略は金曜日の閉店価格を取得し,現在の閉店価格を土曜日と日曜日の金曜日と比較します.現在の閉店価格が金曜日よりも4.5%以上高ければ,strategy.short■現在の閉店価格が金曜日より4.5%以上下回っている場合,strategy.long利息は10倍に設定されています.leverage初期資本の10%に達すると,すべてのポジションをstrategy.close_all()月曜日に,すべてのポジションを閉じるstrategy.close_all().

利点分析

  • ビットコインの週末取引量を短期間取引に利用し,週末のトレンドを把握します
  • 10倍レバレッジはリターンを増強します
  • 利益を得る条件は,利益を固定し,損失を拡大するのを防ぐのに役立ちます
  • 月曜にポジションを閉じると,月曜の volatile オープンのリスクが回避されます.

リスク分析

  • ビットコインの価格は週末に変動し,損失のリスクがあります
  • 10倍レバレッジは損失を増大させる
  • 誤ったストップ・ロスは大きな損失につながる可能性があります
  • 月曜営業の変動は,完全な利益を得ることを妨げる可能性があります.

リスクを軽減するための潜在的な改善:

  1. ストップ・ロスをトレードごとにコントロール・ロストに設定する.
  2. リスクを減らすためにレバレッジを調整する
  3. 利得ポイントを最適化して 特定の利得レベルに達した後に バッチで利得を取ります
  4. 波動を避けるために月曜日の開業前に利益を取るときを設定します.

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

戦略は以下の点で改善できる:

  1. より良いエントリータイミングのために他の指標を追加します.エントリーをフィルタリングし,正確性を向上させるために移動平均値,RSIなどを組み込む.

  2. ストップ・ロスを最適化し,利益戦略を活用する. 利益を固定し,リスクを制御するために,トレーリング・ストップ,段階的な利益採取などを使用する.

  3. リスクを減らすためにレバレッジの大きさを調整する 動的レバレッジ調整を実施し,引き下げ時にレバレッジを下げる

  4. 他の暗号通貨を追加します. 多資産仲介のための週末パターンで追加の暗号通貨を取引します.

  5. パラメータを最適化するために機械学習を使用します.大規模な歴史的なデータセットを収集し,動的パラメータ調整を自動的に最適化するためにMLを使用します.

概要

これは,ビットコインの週末の増量を利用した典型的な短期取引戦略である.土日,日曜日のトレンドを判断して週末のボリュームをキャピタライズし,ロングまたはショートになる.この戦略には利益増幅やリスク管理などの利点がありますが,いくつかのリスクもあります.次のステップは,戦略をより堅牢かつ知性的にするためにエントリー,ストップ損失,レバレッジ管理,資産拡大などの分野を最適化することです.


/*backtest
start: 2023-10-14 00:00:00
end: 2023-11-13 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=3
//Copyright Boris Kozak 
strategy("XBT Weekend Trade Strategy", overlay=false)
leverage = input(10,"Leverage")
profitTakingPercentThreshold = input(0.10,"Profit Taking Percent Threshold")

//****Code used for setting up backtesting.****///
testStartYear = input(2017, "Backtest Start Year")
testStartMonth = input(12, "Backtest Start Month")
testStartDay = input(10, "Backtest Start Day")
testPeriodStart = timestamp(testStartYear,testStartMonth,testStartDay,0,0)

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

// A switch to control background coloring of the test period
testPeriodBackground = input(title="Color Background?", type=bool, defval=true)
testPeriodBackgroundColor = testPeriodBackground and (time >= testPeriodStart) and (time <= testPeriodStop) ? #00FFFF : na
bgcolor(testPeriodBackgroundColor, transp=50)

testPeriod() => true
    
//****END Code used for setting up backtesting.****///


//*** Main entry point is here***//
// Figure out how many days since the Friday close 
days_since_friday = if dayofweek == 6
    0
else 
    if dayofweek == 7
        1
    else
        if dayofweek == 1
            2
        else
            if dayofweek == 2
                3
            else
                if dayofweek == 3
                    4
                else
                    if dayofweek == 4
                        5
                    else
                        6
    
// Grab the Friday close price
fridaycloseprice = request.security(syminfo.tickerid,'D',close[days_since_friday])
plot(fridaycloseprice)
strategy.initial_capital = 50000
// Only perform backtesting during the window specified 
if testPeriod()
    // If we've reached out profit threshold, exit all positions 
    if ((strategy.openprofit/strategy.initial_capital) > profitTakingPercentThreshold)
        strategy.close_all()
    // Only execute this trade on saturday and sunday (UTC)
    if (dayofweek == 7.0 or dayofweek == 1.0)
        // Begin - Empty position (no active trades)
        if (strategy.position_size == 0)
            // If current close price > threshold, go short 
            if ((close>fridaycloseprice*1.045))
                strategy.entry("Short Entry", strategy.short, leverage)
            else
                // If current close price < threshold, go long
                if (close<(fridaycloseprice*0.955))
                    strategy.entry("Long Entry",strategy.long, leverage)
        // Begin - we already have a position
        if (abs(strategy.position_size) > 0)
            // We are short 
            if (strategy.position_size < 0)
                if ((close>strategy.position_avg_price*1.045))
                    // Add to the position
                    strategy.entry("Adding to Short Entry", strategy.short, leverage)
            else
                strategy.entry("Long Entry",strategy.long,leverage)
    // On Monday, if we have any open positions, close them 
    if (dayofweek==2.0)
        strategy.close_all()
 






もっと