
이중 통로 수량 역전 추적 전략은 간단한 이동 평균 지표와 무작위 지표를 조합하여 시장의 빠른 역전을 포착하면서도 놓친 신호로 인한 기회 비용을 줄이는 효율적이고 안정적인 단선 거래 전략을 구현합니다.
이 전략은 두 부분으로 구성된다: 123 형태 반전 부분과 자율 이동 평균 부분. 123 형태 반전 부분에서는 전날의 종결 가격과 전날의 종결 가격 관계를 계산하여 반전 기회가 발생하는지 판단한다. 전날의 종결 가격이 전날의 전날보다 낮고 현재 거래일 종결 가격이 전날보다 높고, 임의의 느린 선이 50보다 낮다면, 신호는 구매를 낳는다. 전날의 종결 가격이 전날의 전날보다 높고 현재 거래일 종결 가격이 전날보다 낮고, 임의의 빠른 선이 50보다 높으면, 판매 신호를 낳는다. 이것은 빠른 짧은 선 반전 기회를 잡을 수 있다.
쌍관계 수량 역전 추적 전략의 가장 큰 장점은 역전 형태와 트렌드 필터링을 조합하여 빠른 역전 형태를 포착하고 흔들리는 시장에서 갇히지 않도록 하는 것입니다. 수익 원인은 크게 두 가지입니다. 첫째, 123 형태를 식별하면 많은 안정화 전략이 할 수 없는 빠른 가격 조정을 적시에 추적 할 수 있습니다. 둘째, 적응형 이동 평균의 응용은 거래 방향과 주류 트렌드가 일치하도록 보장하고, 소음을 효과적으로 필터링하여 불필요한 손실을 줄입니다.
이 전략의 주요 위험은 변수 설정을 잘못하면 거래 빈도가 너무 높거나 신호 인식 능력이 부족할 수 있다는 것입니다. 123 형태의 변수 설정을 너무 민감하게하면 불안한 상황에서 거래 빈도가 높고 평지 손실이 발생할 수 있습니다. 이동 평균 변수 설정을 너무 느리게 적응하면 역전 기회를 놓칠 수 있습니다. 또한, 추세 상황에서 높은 하락을 따라가는 것은 더 큰 자본 변동을 초래합니다.
이 전략은 다음과 같은 몇 가지 측면에서 최적화 할 수 있습니다: 첫째, 123 형태의 파라미터를 조정하여 명확한 반전을 인식 할 수 있고 오류 신호를 발생시키는 데 너무 민감하지 않습니다. 둘째, 평평하고 민감한 사이에 최적의 균형을 찾기 위해 이동 평균을 적응하는 파라미터를 최적화합니다. 셋째, 단편 손실을 제어하기 위해 손실 전략을 도입 할 수 있습니다. 넷째, 시장 감정 지표와 결합하여 의사 결정 품질을 향상시킬 수 있습니다.
쌍방향 정량 역추적 전략은 역추적 거래와 트렌드 필터링의 필수적인 부분을 성공적으로 통합하고, 조합의 장점이 뚜렷하다. 매개 변수 설정을 지속적으로 최적화하고, 손해 방지 및 위험 제어 장치를 지속적으로 개선함으로써, 이 전략은 수익을 달성하기 쉬운, 위험을 제어할 수 있는 효율적인 정량 거래 전략이 될 전망이다.
/*backtest
start: 2024-01-18 00:00:00
end: 2024-02-17 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.0 08/12/2020
// This is combo strategies for get a cumulative signal.
//
// First strategy
// This System was created from the Book "How I Tripled My Money In The
// Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
// The strategy buys at market, if close price is higher than the previous close
// during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
// The strategy sells at market, if close price is lower than the previous close price
// during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
//
// Second strategy
// Everyone wants a short-term, fast trading trend that works without large
// losses. That combination does not exist. But it is possible to have fast
// trading trends in which one must get in or out of the market quickly, but
// these have the distinct disadvantage of being whipsawed by market noise
// when the market is volatile in a sideways trending market. During these
// periods, the trader is jumping in and out of positions with no profit-making
// trend in sight. In an attempt to overcome the problem of noise and still be
// able to get closer to the actual change of the trend, Kaufman developed an
// indicator that adapts to market movement. This indicator, an adaptive moving
// average (AMA), moves very slowly when markets are moving sideways but moves
// swiftly when the markets also move swiftly, change directions or break out of
// a trading range.
//
// WARNING:
// - For purpose educate only
// - This script to change bars colors.
////////////////////////////////////////////////////////////
Reversal123(Length, KSmoothing, DLength, Level) =>
vFast = sma(stoch(close, high, low, Length), KSmoothing)
vSlow = sma(vFast, DLength)
pos = 0.0
pos := iff(close[2] < close[1] and close > close[1] and vFast < vSlow and vFast > Level, 1,
iff(close[2] > close[1] and close < close[1] and vFast > vSlow and vFast < Level, -1, nz(pos[1], 0)))
pos
KAMA(Length) =>
pos = 0.0
nAMA = 0.0
xPrice = close
xvnoise = abs(xPrice - xPrice[1])
nfastend = 0.666
nslowend = 0.0645
reverse = input(false, title="Trade reverse")
nsignal = abs(xPrice - xPrice[Length])
nnoise = sum(xvnoise, Length)
nefratio = iff(nnoise != 0, nsignal / nnoise, 0)
nsmooth = pow(nefratio * (nfastend - nslowend) + nslowend, 2)
nAMA := nz(nAMA[1]) + nsmooth * (xPrice - nz(nAMA[1]))
pos := iff(close[1] > nAMA, 1,
iff(close[1] < nAMA, -1, nz(pos[1], 0)))
pos
strategy(title="Combo Backtest 123 Reversal & Kaufman Moving Average Adaptive", shorttitle="Combo", overlay = true)
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
LengthKAMA = input(21, minval=2)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posKAMA = KAMA(LengthKAMA)
pos = iff(posReversal123 == 1 and posKAMA == 1 , 1,
iff(posReversal123 == -1 and posKAMA == -1, -1, 0))
possig = iff(reverse and pos == 1, -1,
iff(reverse and pos == -1 , 1, pos))
if (possig == 1)
strategy.entry("Long", strategy.long)
if (possig == -1)
strategy.entry("Short", strategy.short)
if (possig == 0)
strategy.close_all()
barcolor(possig == -1 ? #b50404: possig == 1 ? #079605 : #0536b3 )