
これはATR指標と閉盤価格を使用してトレンドブレイクを捕捉する量化取引戦略である.この戦略は,動的に上下トレンドラインを計算してトレンドの方向を判断し,閉盤価格がトレンドラインを突破すると取引シグナルを生成する.この戦略は,同時にストップとターゲット価格を設定し,変動に応じて移動ストップを行う.
解決策は
多時間周期は騒音をフィルターし,トレンド把握をより安定させるのに役立ちます. 突破前の量指数検証は偽の信号を除します. ポジション管理の最適化は資金利用の効率性を向上させます. 止損と損比のパラメータの最適化は戦略の収益リスク比率を改善します. 移動止損論理の改善は,引き下げを制御しながら,より多くのトレンド利益を得ることができます.
この戦略は,ATRを波動率として測定し,動的にトレンドライン位置を調整し,トレンド突破状況を捕捉する.合理的にストップと利益目標を設定し,移動ストップを活用して利益をロックする.パラメータは調整可能で,適応性が強い.しかし,トレンド突破戦略は,揺れ動いている状況の影響を受けやすいため,さらなる最適化と改善が必要である.多周期,シグナル選択,ポジション管理の最適化,参数優位を求めるなどの方法で戦略のパフォーマンスと安定性を向上させることができる.
/*backtest
start: 2023-03-16 00:00:00
end: 2024-03-21 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy(title = "Claw-Pattern", overlay=true, calc_on_every_tick=true, default_qty_type= strategy.percent_of_equity,default_qty_value=10, currency="USD")
//Developer: Trading Strategy Guides
//Creator: Trading Strategy Guides
//Date: 3/18/2024
//Description: A trend trading system strategy
atr_period = input(title="ATR Period", defval=120, type=input.integer)
atr_mult = input(title="ATR Multiplier", defval=2, type=input.integer)
dir = input(title="Direction (Long=1, Short=-1, Both = 0)", defval=1, type=input.integer)
factor = input(title="Stop Level Deviation (% Chan.)", defval=0.75, type=input.float)
rr = input(title="Reward to Risk Multiplier", defval=2, type=input.integer)
trail_bar_start = input(title="Trail Stop Bar Start", defval=20, type=input.integer)
col_candles = input(title="Enable Colored Candles", defval=false, type=input.bool)
atr_signal = atr(atr_period)
lower_trend = low - atr_mult*atr_signal
upper_trend = high + atr_mult*atr_signal
upper_trend := upper_trend > upper_trend[1] and close < upper_trend[1] ? upper_trend[1] : upper_trend
lower_trend := lower_trend < lower_trend[1] and close > lower_trend[1] ? lower_trend[1] : lower_trend
upper_color = barssince(cross(close, upper_trend[1])) > barssince(cross(close, lower_trend[1])) ? color.red : na
lower_color = barssince(cross(close, upper_trend[1])) > barssince(cross(close, lower_trend[1])) ? na : color.green
trend_line = lower_trend
plot(lower_trend, color=lower_color, title="Lower Trend Color")
plot(upper_trend, color=upper_color, title="Upper Trend Color")
is_buy = strategy.position_size == 0 and crossover(close, upper_trend[1]) and upper_color[1]==color.red and (dir == 1 or dir == 0)
is_sell = strategy.position_size == 0 and crossover(close, lower_trend[1]) and lower_color[1]==color.green and (dir == -1 or dir == 0)
if is_buy
strategy.entry("Enter Long", strategy.long)
else if is_sell
strategy.entry("Enter Short", strategy.short)