
이 전략은 123 역전 전략과 미래로 이동하는 평행선 전략을 결합하여, 두 전략이 동시에 신호를 발산할 때 입구 또는 출구하는 정량화 거래 전략을 구현한다. 이 전략은 주로 주식 지수 선물 시장에 적용되며, 단기 역전 신호와 중기 장기 경향 신호의 조합을 포착하여 중기 단기 포지션 거래를 구현한다.
123 역전 전략은 내가 어떻게 선물 시장에서 자금을 3배로 늘리는지에 관한 책에서 유래했다. 이 전략은 2일 연속으로 종전 가격이 역전되어 9일 연속으로 느린 K선이 50보다 낮을 때 더 많이 하고, 2일 연속으로 종전 가격이 역전되어 9일 연속으로 빠른 K선이 50보다 높을 때 더 많이 한다.
미래 지평선 전략 (Future Lines of Demarcation, FLD) 은 가격 변동의 주기적 법칙에 기반한 트렌드 추적 전략이다. FLD 라인은 가격의 중간값, 고값 또는 저값을 바탕으로 미래 평면으로 약 반 사이클 이동하여 가격 라인이 FLD 라인을 통과하면 거래 신호가 발생한다.
이 전략은 반전 전략과 트렌드 추적 전략을 결합하여 단기 시장 반전 기회를 중장기 트렌드 방향과 동시에 포착하여 다중 시간 척도의 정량 거래를 구현합니다. 반전 전략은 단기 수익 기회를 제공하며, 트렌드 추적 부분은 전체 거래 방향과 동향이 일치하고 거래 위험을 효과적으로 제어합니다. 또한 미래 이동 평균선의 자기 적응 특성은 전략의 안정성을 강화합니다.
이 전략은 주로 역전 신호의 가짜 돌파의 위험과 FLD 선 판단의 오류의 위험에 직면한다. 전자의 경우, 파라미터를 조정하여 역전 신호를 확인하거나, 또는 다른 보조 판단 지표를 추가하여 판단 정확도를 높일 수 있다. 후자의 경우, 파라미터를 최적화하여 시장의 파장 법칙을 더 정확하게 묘사할 수 있도록 해야 한다. 또한, 대주기 경향 역전 시 FLD 선 출력 오류의 가능성을 경계해야 한다.
이 전략은 반전과 트렌드의 거래 철학을 결합하여 중·단기 시간 프레임에 안정적인 수익을 달성한다. 향후 신호 정확성 확인, 트렌드 정확성 묘사, 위험 제어 등의 측면에서 최적화 할 수 있으므로 전략 매개 변수의 범위가 넓고 안정성이 강하다.
/*backtest
start: 2022-12-01 00:00:00
end: 2023-12-07 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.0 28/08/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
// An FLD is a line that is plotted on the same scale as the price and is in fact the
// price itself displaced to the right (into the future) by (approximately) half the
// wavelength of the cycle for which the FLD is plotted. There are three FLD's that can be
// plotted for each cycle:
// An FLD based on the median price.
// An FLD based on the high price.
// An FLD based on the low price.
//
// 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
FLD(Period,src) =>
pos = 0
pos := iff(src[Period] < close , 1,
iff(src[Period] > close, -1, nz(pos[1], 0)))
pos
strategy(title="Combo Backtest 123 Reversal & FLD's - Future Lines of Demarcation", shorttitle="Combo", overlay = true)
Length = input(15, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
Period = input(title="Period", defval=40)
src = input(title="Source", type=input.source, defval=close)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posFLD = FLD(Period,src)
pos = iff(posReversal123 == 1 and posFLD == 1 , 1,
iff(posReversal123 == -1 and posFLD == -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 )