
이것은 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)