週末の取引戦略


作成日: 2023-11-14 11:29:12 最終変更日: 2023-11-14 11:29:12
コピー: 0 クリック数: 666
1
フォロー
1617
フォロワー

週末の取引戦略

概要

この戦略は,ビットコインを週末に短線で取引し,10倍レバレッジで取引する戦略である.戦略の主な構想は,金曜日の閉盘時に価格を記録し,その後,土曜日と日曜日で当日の閉盘価格と金曜日の閉盘価格の上昇と低下を比較し,値下げを超えた場合は多額の取引を行うか,または空白を行い,月曜日にポジションを平らにする.

戦略原則

この戦略は,まず金曜日の閉盘価格を記録し,その後,現在の日付から金曜日までの日数を計算する.土曜日と日曜日には,その日の閉盘価格が金曜日の閉盘価格より4.5%以上上昇した場合,空白する.その日の閉盘価格が金曜日の閉盘価格より4.5%以上低下した場合,空白する.毎取引に10倍のレバレッジを使用し,利益が初期資本の10%に達した場合,すべてのポジションを平衡する.月曜日には,ポジションがあるかどうかに関係なく,全ポジションを平衡する.

具体的には,戦略は金曜日の閉店価格を取得し,その後の土曜日に現在の閉店価格と金曜日の閉店価格の上昇を比較します. 現在の閉店価格が金曜日の閉店価格より4.5%以上上昇した場合,strategy.short市場が空白し,当日の閉盘価格が金曜日の閉盘価格より4.5%以上下落した場合,strategy.long通過するleverageこのパラメータでは,利差を10倍に設定します.strategy.close_all()月曜日には,通過strategy.close_all()ポジションを平らにする.

優位分析

  • ビットコインの週末の取引量増加の特性を利用し,週末の短期トレンドを捕捉するために,週末にショートライン取引を行う
  • 10倍のレバレッジで取引することで,収益を拡大できます.
  • 停止条件を設定し,損失の拡大を防ぐため,タイムストップに役立ちます.
  • 月曜の平仓は,月曜の開店の大きな波動からなるリスクを回避します.

リスク分析

  • ビットコインの週末の価格変動で,損失の危険性
  • 10倍のレバレッジは損失を大きくする
  • ストップ・ロスの設定を間違えた場合,大きな損失を招く可能性があります.
  • 月曜の取引開始は激しく波動し,全盛期には止まらないかもしれない.

リスクに合わせて,以下の最適化策を考える:

  1. ストップ・ロスを設定し,単一損失をコントロールする.
  2. リスクの軽減のためにレバレッジの倍数を調整します.
  3. ストップポイントの設定を最適化し,収益の一定比率に達したときにストップを分批する.
  4. 月曜の営業開始前には渋滞やタイムストップを設定して,月曜の営業の激しい波動を避ける.

最適化の方向

この戦略は以下の点で最適化できます.

  1. 他の指標の判断を追加し,入場ポイントの選択を最適化します.移動平均線,RSIなどの指標が入場時刻をフィルターし,入場精度を向上させることができます.

  2. ストップ・ストップ戦略の最適化,移動ストップ,分批ストップなどの方法で利潤をロックし,リスクを制御する.

  3. リベールのサイズを調整し,リスクを軽減します. リベールの割合を動的に調整し,撤回時にレバレッジを低下させることができます.

  4. 多品種取引を追加する.他の一般的な暗号通貨を追加して,その週末取引特性を利用して,多品種アベレート取引を行うことができる.

  5. 機械学習アルゴリズムによる最適化パラメータ.大量の歴史的データを収集し,機械学習アルゴリズムによる自動最適化パラメータ,パラメータの動的調整を実現する.

要約する

この戦略は,ビットコインの週末取引量の拡大を利用した典型的なショートライン取引戦略である.戦略は,ビットコインの週末取引量の拡大を利用した特性を利用し,土曜日のトレンド判断,多額の取引または空白を行う.戦略は,収益の拡大,リスク管理などの利点があるが,一定のリスクも存在する.次のステップは,入場,損失の停止,レバレッジ管理,品種拡大などの面で最適化され,戦略をより安定し,スマートにすることができる.

ストラテジーソースコード
/*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()