
골드분기형 평균값 회귀 트렌드 거래 전략은 통로 지표와 이동 평균을 사용하여 강력한 트렌드 방향을 식별하여 가격의 일정 비율의 회귀가 발생한 후 트렌드 방향에서 포지션을 열 수 있습니다. 이 전략은 강한 트렌드 특성을 가진 시장에 적합하며 트렌드 상황에서 더 나은 성능을 얻을 수 있습니다.
이 전략의 핵심 지표는 통로 지표, 이동 평균 및 회귀 트리거 라인이다. 구체적으로:
가격이 통로의 바닥을 만질 때, 전략은 최저 지점을 참조점으로 기록하고,空白를 허용하는 표시를 설정한다. 가격이 상승할 때, 상승幅度가 회귀 비율을 달성 한 후, 부진 지점 근처에空置을 열 것이다.
반대로, 가격이 통로의 꼭대기를 만지면, 전략은 최고점을 기준점으로 기록하고, 더 많은 표시를 허용하도록 설정한다. 가격이 떨어지면, 하락의 폭이 회귀 비율 요구 사항을 충족하면, 그 지점 근처에 더 많은 포지션을 열 수 있다.
따라서, 이 전략의 거래 논리는 가격 채널을 추적하고, 반전 신호가 발생했을 때 적절한 지점을 선택하여 현존하는 추세에 개입하는 것이다. 이것은 추세 회귀 유형의 거래 전략의 일반적인 방식이다.
이 전략은 다음과 같은 장점을 가지고 있습니다.
구체적으로, 전략은 주로 트렌드 반전 시점에 포지션을 열기 때문에 가격 변동이 크고 트렌드가 뚜렷한 시장에서 더 효과적이다. 또한, 회귀 비율 파라미터를 조정하면 전략이 트렌드를 추적하는 정도를 조절할 수 있다. 마지막으로, 손실을 막는 방법으로 단위 손실을 제어할 수 있다.
이 전략에는 다음과 같은 주요 위험도 있습니다.
구체적으로, 전략이 적용되는 거래 품종이 경향성이 약하고 변동성이 작다면, 효과는 할인될 수 있다. 또한, 회귀 비율이 너무 크거나 너무 작으면 전략의 성과에 영향을 미칠 수 있다. 마지막으로, 전략의 포지션 기간이 길어질 수 있기 때문에, 또한 야간 위험을 통제하는 것에 주의해야 한다.
위와 같은 위험을 피하기 위해, 다음의 몇 가지 측면을 최적화하는 것을 고려할 수 있습니다.
금분식형 평균값 회귀 트렌드 거래 전략은 간단한 지표를 통해 가격 트렌드와 회귀 신호를 판단하고, 강세를 보이는 상황에서 포지션 추적 트렌드를 열며, 비교적 전형적인 트렌드 시스템에 속한다. 이 전략의 파라미터 조정 최적화 공간은 넓고, 더 많은 시장 환경에 적응할 수 있도록 최적화 할 수 있으며, 위험 제어도 합리적이다. 따라서, 실제 테스트 및 개선할 가치가 있는 최적화 전략이다.
/*backtest
start: 2022-11-30 00:00:00
end: 2023-12-06 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=3
//
// A port of the TradeStation EasyLanguage code for a mean-revision strategy described at
// http://traders.com/Documentation/FEEDbk_docs/2017/01/TradersTips.html
//
// "In “Mean-Reversion Swing Trading,” which appeared in the December 2016 issue of STOCKS & COMMODITIES, author Ken Calhoun
// describes a trading methodology where the trader attempts to enter an existing trend after there has been a pullback.
// He suggests looking for 50% pullbacks in strong trends and waiting for price to move back in the direction of the trend
// before entering the trade."
//
// See Also:
// - 9 Mistakes Quants Make that Cause Backtests to Lie (https://blog.quantopian.com/9-mistakes-quants-make-that-cause-backtests-to-lie-by-tucker-balch-ph-d/)
// - When Backtests Meet Reality (http://financial-hacker.com/Backtest.pdf)
// - Why MT4 backtesting does not work (http://www.stevehopwoodforex.com/phpBB3/viewtopic.php?f=28&t=4020)
//
//
// -----------------------------------------------------------------------------
// Copyright 2018 sherwind
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// The GNU General Public License can be found here
// <http://www.gnu.org/licenses/>.
//
// -----------------------------------------------------------------------------
//
strategy("Mean-Reversion Swing Trading Strategy v1", shorttitle="MRST Strategy v1", overlay=true)
channel_len = input(defval=20, title="Channel Period", minval=1)
pullback_pct = input(defval=0.5, title="Percent Pull Back Trigger", minval=0.01, maxval=1, step=0.01)
trend_filter_len = input(defval=50, title="Trend MA Period", minval=1)
upper_band = highest(high, channel_len)
lower_band = lowest(low, channel_len)
trend = sma(close, trend_filter_len)
low_ref = 0.0
low_ref := nz(low_ref[1])
high_ref = 0.0
high_ref := nz(high_ref[1])
long_ok = false
long_ok := nz(long_ok[1])
short_ok = false
short_ok := nz(short_ok[1])
long_ok2 = false
long_ok2 := nz(long_ok2[1])
if (low == lower_band)
low_ref := low
long_ok := false
short_ok := true
long_ok2 := false
if (high == upper_band)
high_ref := high
long_ok := true
short_ok := false
long_ok2 := true
// Pull Back Level
trigger = long_ok2 ? high_ref - pullback_pct * (high_ref - low_ref) : low_ref + pullback_pct * (high_ref - low_ref)
plot(upper_band, title="Upper Band", color=long_ok2?green:red)
plot(lower_band, title="Lower Band", color=long_ok2?green:red)
plot(trigger, title="Trigger", color=purple)
plot(trend, title="Trend", color=orange)
enter_long = long_ok[1] and long_ok and crossover(close, trigger) and close > trend and strategy.position_size <= 0
enter_short = short_ok[1] and short_ok and crossunder(close, trigger) and close < trend and strategy.position_size >= 0
if (enter_long)
long_ok := false
strategy.entry("pullback-long", strategy.long, stop=close, comment="pullback-long")
else
strategy.cancel("pullback-long")
if (enter_short)
short_ok := false
strategy.entry("pullback-short", strategy.short, stop=close, comment="pullback-short")
else
strategy.cancel("pullback-short")
strategy.exit("exit-long", "pullback-long", limit=upper_band, stop=lower_band)
strategy.exit("exit-short", "pullback-short", limit=lower_band, stop=upper_band)