
이 전략은 단지 더 많은 것을 하는 전략이며, ATR 통로의 하위 경계를 깨는 가격을 이용해서 진입 시기를 결정하고, ATR 통로의 평균선이나 ATR 통로의 상위 경계를 차단으로 퇴출한다. 동시에, ATR을 이용해서 스톱로스 가격을 계산한다. 이 전략은 빠른 단선 거래에 적합하다.
가격이 ATR 통로의 하위 한계를 넘으면, 가격이 비정상적으로 떨어지는 것을 나타냅니다. 이 때 전략은 다음 K 라인 개시 시에 더 많은 입구를합니다. 중단 가격은 입구 가격으로 ATR의 중지 인수를 ATR으로 곱합니다.
특히, 이 전략은 다음과 같은 논리를 포함하고 있습니다.
이 전략은 다음과 같은 장점을 가지고 있습니다.
이 전략에는 몇 가지 위험도 있습니다.
ATR 주기를 조정하고, 스톱 로드 인자를 줄이는 방법과 같은 방법으로 위의 위험을 줄일 수 있습니다. 또한 거래 수수료가 낮은 브로커를 선택하는 것도 중요합니다.
이 전략은 다음과 같은 측면에서 최적화될 수 있습니다.
이 전략은 전체적으로 간단하고 실용적인 단선 돌파 평균선 역전 전략이다. 명확한 입점 규칙, 엄격한 스톱드 메커니즘, 그리고 완벽한 스톱드 방식이 있다. 또한 몇 가지 파라미터를 조정할 수 있는 최적화 공간을 제공한다. 거래자가 적절한 지표를 선택하고 스톱드를 사용하여 위험을 제어할 수 있다면, 이 전략은 좋은 효과를 얻을 수 있어야 한다.
/*backtest
start: 2022-12-04 00:00:00
end: 2023-12-10 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Bcullen175
//@version=5
strategy("ATR Mean Reversion", overlay=true, initial_capital=100000,default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=6E-5) // Brokers rate (ICmarkets = 6E-5)
SLx = input(1.5, "SL Multiplier", tooltip = "Multiplies ATR to widen stop on volatile assests, Higher values reduce risk:reward but increase winrate, Values below 1.2 are not reccomended")
src = input(close, title="Source")
period = input.int(10, "ATR & MA PERIOD")
plot(open+ta.atr(period))
plot(open-ta.atr(period))
plot((ta.ema(src, period)), title = "Mean", color=color.white)
i_startTime = input(title="Start Filter", defval=timestamp("01 Jan 1995 13:30 +0000"), group="Time Filter", tooltip="Start date & time to begin searching for setups")
i_endTime = input(title="End Filter", defval=timestamp("1 Jan 2099 19:30 +0000"), group="Time Filter", tooltip="End date & time to stop searching for setups")
// Check filter(s)
f_dateFilter = true
atr = ta.atr(period)
// Check buy/sell conditions
var float buyPrice = 0
buyCondition = low < (open-ta.atr(period)) and strategy.position_size == 0 and f_dateFilter
sellCondition = (high > (ta.ema(close, period)) and strategy.position_size > 0 and close < low[1]) or high > (open+ta.atr(period))
stopDistance = strategy.position_size > 0 ? ((buyPrice - atr)/buyPrice) : na
stopPrice = strategy.position_size > 0 ? (buyPrice - SLx*atr): na
stopCondition = strategy.position_size > 0 and low < stopPrice
// Enter positions
if buyCondition
strategy.entry(id="Long", direction=strategy.long)
if buyCondition[1]
buyPrice := open
// Exit positions
if sellCondition or stopCondition
strategy.close(id="Long", comment="Exit" + (stopCondition ? "SL=true" : ""))
buyPrice := na
// Draw pretty colors
plot(buyPrice, color=color.lime, style=plot.style_linebr)
plot(stopPrice, color=color.red, style=plot.style_linebr, offset=-1)