
逆唐肖通路負荷トレード戦略は,唐肖通路指標に基づく量化トレード戦略である.この戦略は,ストップ・ローズとトラッキング・ストップ・ローズを組み合わせてリスク管理を行う.
価格が唐肖通路上下境界に触れたときに,ポジションを開設し多空をすること.同時に,ストップとストップを設定すること.ストップが発生した場合,一定時間後に新しいポジションを開設することを一時停止すること.ポジション保持期間中,ストップを追跡することによって利益をロックすること.
この戦略は,上線,下線,中線を含む20日間の唐ショ通路指標を使用しています.
価格が下線に触れたときに多ポジションを開く.価格が上線に触れたときに空ポジションを開く.
前向きの取引が止まった場合,一定の周期を一時停止し (例えば3根のK線),追龍を避ける.
ポジション開設時に固定比率のストップ・ロスと動的に調整されるテイク・プロフィット.
take profitは,リスク収益比率 (例えば2) とストップ損失パーセント (例えば22%) によって計算する.
ストップトラッキングを有効にする
多頭ポジションでは,価格が中線を越えれば,入場価格と中線価格のミッドポイントにストップロスを調整する.
空頭で中線を横切る時に同理調整.
唐ショ通路の指標を使って,突破的な行動に把握する能力がある.
逆操作の取引理念に合致する.
ストップ・ロスは,トラッキング・ストップ・ロスは,利潤をロックする,リスク管理が良い.
戦略は明確で分かりやすく,実行しやすい.
唐ショ通路は,トレンド型指標として,市場状況の整合で偽の突破が起こりやすく,損失につながる可能性があります.
固定ストープは,容易に套装され,適切なストープ範囲を調整する.
トラッキング・ストップ・ダメージの調整幅は,打たれやすいので,調整頻度をバランスさせなければならない.
パラメータの設定を間違えた場合も, 策略のパフォーマンスに影響する.
唐ショ通路の長さは最適のパラメータ組み合わせを探して最適化できます.
ポジション管理モジュールを追加します.
他の指標と組み合わせてトレンドを判断し,トレンドの偽突破を避ける.
ダイナミックストップを起動し,ストップ位置をリアルタイムで調整する.
逆唐肖通路の負圧取引戦略は,トレンド判断,リスク管理などの複数の機能を統合し,基本的には完全である.パラメータの継続的な最適化および他の指標またはモデルとの組み合わせによって,戦略の強性をさらに高め,収益率を向上させることができます.この戦略は,一定の取引経験を持つ投資家の実施に適しています.
/*backtest
start: 2023-01-17 00:00:00
end: 2024-01-23 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy("Contrarian Donchian Channel Strategy - Touch Entry with Post-SL Pause and Trailing Stop", overlay=true, default_qty_value=0.01, default_qty_type=strategy.percent_of_equity)
// Inputs
length = input(20, minval=1, title="Donchian Channel Length")
riskRewardRatio = input(2, title="Risk/Reward Ratio")
stopLossPercent = input(0.22, title="Stop Loss (%)") / 100
pauseCandles = input(3, minval=1, title="Pause After SL (Candles)")
// Donchian Channel Calculation
upper = highest(high, length)
lower = lowest(low, length)
centerline = (upper + lower) / 2 // Calculating the Centerline
// Plotting Donchian Channel and Centerline
plot(upper, color=color.red, title="Upper Band")
plot(lower, color=color.green, title="Lower Band")
plot(centerline, color=color.blue, title="Centerline")
// Tracking Stop Loss Hits and Pause
var longSLHitBar = 0
var shortSLHitBar = 0
var int lastTradeDirection = 0 // 1 for long, -1 for short, 0 for none
// Update SL Hit Bars
if (strategy.position_size[1] > 0 and strategy.position_size == 0)
if (close[1] < strategy.position_avg_price[1])
longSLHitBar := bar_index
lastTradeDirection := 1
if (strategy.position_size[1] < 0 and strategy.position_size == 0)
if (close[1] > strategy.position_avg_price[1])
shortSLHitBar := bar_index
lastTradeDirection := -1
// Entry Conditions - Trigger on touch
longCondition = (low <= lower) and (bar_index - longSLHitBar > pauseCandles or lastTradeDirection != 1)
shortCondition = (high >= upper) and (bar_index - shortSLHitBar > pauseCandles or lastTradeDirection != -1)
// Trade Execution
if (longCondition)
strategy.entry("Long", strategy.long)
if (shortCondition)
strategy.entry("Short", strategy.short)
// Initial Stop Loss and Take Profit Calculation
stopLoss = strategy.position_avg_price * (1 - stopLossPercent)
takeProfit = strategy.position_avg_price * (1 + stopLossPercent * riskRewardRatio)
// Trailing Stop Loss Logic
var float trailingStopLong = na
var float trailingStopShort = na
// Update Trailing Stop for Long Position
if (strategy.position_size > 0)
if (close > centerline)
trailingStopLong := (strategy.position_avg_price + centerline) / 2
stopLoss := na(trailingStopLong) ? stopLoss : max(trailingStopLong, stopLoss)
// Update Trailing Stop for Short Position
if (strategy.position_size < 0)
if (close < centerline)
trailingStopShort := (strategy.position_avg_price + centerline) / 2
stopLoss := na(trailingStopShort) ? stopLoss : min(trailingStopShort, stopLoss)
// Setting Stop Loss and Take Profit for each trade
strategy.exit("SL_TP_Long", "Long", stop=stopLoss, limit=takeProfit)
strategy.exit("SL_TP_Short", "Short", stop=stopLoss, limit=takeProfit)