
이 전략은 지수 이동 평균 ((EMA), 최고 가격, 최저 가격 및 평균 실제 파장 ((ATR) 과 같은 기술 지표를 사용하여 가격과 EMA, 최고 가격 및 최저 가격의 관계를 판단하여 현재 트렌드 방향을 식별하고, 상향으로 최저 가격을 돌파 할 때 구매하고, 하향으로 최고 가격을 돌파 할 때 또는 동적 저항 지점에 도달하면 판매하여 트렌드 상황을 캡처하여 초과 수익을 얻습니다.
이 전략은 EMA, 최고 가격, 최저 가격 등의 기술 지표를 활용하여 ATR과 결합하여 동적 통로를 구축하여 최고 가격과 최저 가격을 돌파하여 거래 신호를 생성하여 트렌드 움직임을 포착하는 간단한 실용적인 트렌드 추적 전략입니다. 전략의 매개 변수는 조정 가능하며 적응성과 유연성이 좋습니다. 그러나 불안한 시장에서 성능이 좋지 않을 수 있습니다. 더 많은 지표, 최적화 매개 변수, 풍속 제어 등을 도입하여 추가 최적화 및 개선이 필요합니다.
/*backtest
start: 2023-05-05 00:00:00
end: 2024-05-10 00:00:00
period: 1d
basePeriod: 1h
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/
// © Maboi_q
//@version=5
strategy("buy sell Trend", overlay=true)
atr_length = input.int(defval=14, title='atr length')
highest_length = input.int(defval=60, title='highest length')
highest_s_length = input.int(defval=60, title='sell highest length')
lowest_length = input.int(defval=30, title='lowest length')
sell_l_length = input.int(defval=55, title='sell line length')
f = 2.382
f2 = 5.618
atr = ta.atr(atr_length)
highest = ta.highest(highest_length)
lowest = ta.lowest(lowest_length)
f_atr = atr * f
ema_hl = ta.ema((highest[1] + lowest[1]) / 2, 14)
ema_highest = ema_hl + f_atr
ema_lowest = ema_hl - f_atr
ema_mid = (ema_highest + ema_lowest) / 2
bs_hi = ta.highest(highest_s_length)
f_atr2 = atr * f2
sell_line = ta.ema(bs_hi[1] + f_atr2, sell_l_length)
buy_cond = ta.crossover(ema_lowest, lowest) and close < ema_mid
sell_cond = (ta.crossunder(ema_highest, highest) and close > ema_mid) or high >= sell_line
if buy_cond
strategy.entry('BUY', strategy.long)
if sell_cond
strategy.entry('SELL', strategy.short)
plot(sell_line, color=color.new(color.maroon, 50))
plot(highest, color=color.new(color.red, 50))
plot(lowest, color=color.new(color.green, 50))
plot(ema_highest, color=color.new(color.blue, 50))
// plot(ema_mid, color=color.new(color.gray, 50))
plot(ema_lowest, color=color.new(color.blue, 50))
plotshape(buy_cond, title='buy', style=shape.triangleup, location=location.belowbar,
color=color.green, textcolor=color.green, size=size.tiny)
plotshape(sell_cond, title='sell', style=shape.triangledown, location=location.abovebar,
color=color.red, textcolor=color.red, size=size.tiny)