固定時間ブレイクアウトバックテスト戦略


作成日: 2024-01-29 10:22:07 最終変更日: 2024-01-29 10:22:07
コピー: 0 クリック数: 523
1
フォロー
1617
フォロワー

固定時間ブレイクアウトバックテスト戦略

概要

この戦略の主な考えは,固定された時間点 ((ここは,毎日のUTC+5時帯の08:35) で,開場後5分間のK線の閉店価格が開場価格より上昇するか下落するかを判断し,上昇した場合に多めに,下落した場合に空白し,長短ポジションのストップ目標を設定する.

戦略原則

この戦略の具体的原理は以下の通りです.

  1. 期望する取引時間を設定します.ここはUTC+5時帯の毎日の08:35です.

  2. この時点で,現在の5分K線の閉盘価格が開盘価格より高いかどうかを判断する.閉盘価格が開盘価格より高い場合は,この5分K線の閉盤価格を表示し,多めにする.

  3. 閉盤価格が開盤価格より低ければ,この5分K線が閉盤線,空白であることを示す.

  4. オーバーの場合は,1000ドルまで,オフの場合は500ドルまで,オフの場合は空席となります.

優位分析

この戦略の主な利点は以下の通りです.

  1. 戦略は明確でシンプルで,理解し,実行しやすい.

  2. 固定取引時間は,夜間のリスクを回避します.

  3. 5分単位でトレンドを正確に判断する

  4. ストップ・ゴールを設定して,収益をロックします.

リスク分析

この戦略にはいくつかのリスクがあります.

  1. 固定取引時間は,市場の他の時間帯の取引機会を逃す可能性があります.複数の取引時間点を設定できます.

  2. 5分間の判断は不十分で,複数の時間周期を組み合わせて判断できます.

  3. 閉盤価格と開盤価格の変動が大きいため,ストップ・ロスを設定することでリスクが軽減されます.

  4. 止まる設定は余りにも恣意的であり,過去のデータテストに基づいてより最適化された止まる設定を行うことができます.

最適化の方向

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

  1. 複数の取引時間を設定し,より多くの取引機会をカバーします.

  2. ストップ・ロジックを増やし,損失のリスクを低減する.

  3. 判断の正確さを高めるため,より周期的な指標の判断傾向と組み合わせる.

  4. 過去のデータでテストする際の 最適な止境点.

  5. ポジションの大きさを動的に調整し,状況に応じてリスクを管理する.

要約する

全体として,固定時間突破反測戦略の構想はシンプルで明快で,固定時間点でトレンド方向を判断して入場し,ストップ・ストップを設定して利益をロックし,リスクを制御する,基本的で実用的量化取引戦略である.複数の組み合わせのパラメータの最適化と風力制御手段によって強化され,信頼できる量化取引システムとなる.

ストラテジーソースコード
/*backtest
start: 2023-12-29 00:00:00
end: 2024-01-28 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Wajahat2

//@version=5
strategy("Buy Sell at 08:35 GMT+5 with Profit Targets", overlay=true)

// Set the desired trading time (08:35 GMT+5)
desiredHour = input.int(8, title="Desired Hour")
desiredMinute = input.int(35, title="Desired Minute")

// Convert trading time to Unix timestamp
desiredTime = timestamp(year, month, dayofmonth, desiredHour, desiredMinute)

// Check if the current bar's timestamp matches the desired time
isDesiredTime = time == desiredTime

// Plot vertical lines for visual confirmation
bgcolor(isDesiredTime ? color.new(color.green, 90) : na)

// Check if the current 5-minute candle closed bullish
isBullish = close[1] < open[1]

// Check if the current 5-minute candle closed bearish
isBearish = close[1] > open[1]

// Define profit targets in USD
longProfitTargetUSD = input(1000, title="Long Profit Target (USD)")
shortProfitTargetUSD = input(500, title="Short Profit Target (USD)")

// Execute strategy at the desired time with profit targets
strategy.entry("Buy", strategy.long, when= isBullish)
strategy.entry("Sell", strategy.short, when= isBearish)

// Set profit targets for the long and short positions
strategy.exit("Profit Target", from_entry="Buy", profit=longProfitTargetUSD)
strategy.exit("Profit Target", from_entry="Sell", profit=shortProfitTargetUSD)