퀀트 트레이딩 이중 클릭 역전 전략

저자:차오장, 날짜: 2023-11-22 10:03:04
태그:

img

전반적인 설명

이 전략은 먼저 123 패턴을 사용하여 반전 신호를 결정하고, 클링거 볼륨 오시레이터를 필터로 결합하여 환전 기회를 효율적으로 포착하기 위해 이중 클릭 양적 이익 전략을 구현합니다.

원칙

이 전략은 두 부분으로 구성됩니다.

  1. 123 회전 신호를 결정하는 패턴: 닫기 가격이 2 일 연속으로 지속적으로 떨어지고 3 일 연속으로 긍정적으로 닫히고 주식 지표가 낮은 수준에서 오래있을 때; 닫기 가격이 2 일 연속으로 계속 상승하고 3 일 연속으로 마감하면 마이너스이며 주식 지표가 높은 수준에서 짧습니다.

  2. 클링거 볼륨 오시일레이터 섹션: 클링거 볼륨 오시일레이터는 자본 유입과 출동을 결정하기 위해 가격 변동 범위와 거래량 변화를 결합합니다. 볼륨 오시일레이터가 평균값을 넘으면 긴 신호이며 평균값을 넘으면 짧은 신호입니다.

마지막으로, 전략은 위의 두 부분에서 신호와 더블 클릭을 결합하여 최종 항목을 결정합니다.

이점 분석

이 전략의 가장 큰 장점은 역전 패턴과 볼륨 지표를 결합하여 역전 기회를 효율적으로 포착한다는 것입니다. 또한, 주식 지표의 도움으로 가짜 브레이크오웃을 피하고 실제 돈 흐름 방향을 결정하는 클링거 볼륨 오시레이터 (Klinger Volume Oscillator) 를 사용하여 정확한 입시 시기를 보장 할 수 있습니다.

위험 분석

이 전략의 주요 위험은 반전 패턴 판단과 매개 변수 설정의 문제에 있다. 반전 신호의 지연으로 인해 가장 좋은 반전 타이밍을 놓치지 않도록 매개 변수가 합리적으로 설정되도록 보장해야합니다. 또한 반전 패턴 자체가 실패 할 수 있습니다.

리스크를 줄이기 위해, 반전 신호를 더 반응적이고 신속하게 만들기 위해 매개 변수를 최적화 할 수 있습니다. 또한 다른 필터를 추가하여 폭이 넓어지지 않도록 충분한 수의 반전과 진폭을 보장 할 수 있습니다.

최적화 방향

이 전략의 주요 최적화 공간은 매개 변수 조정 및 다른 보조 판단의 추가입니다. 구체적으로, 123 패턴 차별의 감수성을 최적화하기 위해 주식 지표 매개 변수를 적절히 단축 할 수 있습니다. 또한 MACD 황금 십자가와 치명적 십자가, 또는 이중 상위 / 하위 복수 바닥 및 기타 판단을 추가하는 것과 같은 현재 주류 지표 및 패턴과 결합하는 것이 가능합니다.

또한, 시장 변화에 더 적응 할 수 있도록 동적으로 스톱 로스 조정을 고려하고 수익 조건을 취하십시오. 또한 실시간으로 매개 변수를 최적화하기 위해 머신 러닝을 결합 할 수 있습니다.

요약

이 전략은 역전 이론과 부피 기술 지표의 적용을 통합하여 역전 기회를 효율적으로 포착합니다. 최적화의 공간이 넓고 효과를 더 향상시킬 가능성이 있습니다. 이는 실제 거래에서 검증하고 지속적으로 최적화하는 가치가 있습니다.


/*backtest
start: 2023-10-22 00:00:00
end: 2023-11-21 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 23/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
// The Klinger Oscillator (KO) was developed by Stephen J. Klinger. Learning 
// from prior research on volume by such well-known technicians as Joseph Granville, 
// Larry Williams, and Marc Chaikin, Mr. Klinger set out to develop a volume-based 
// indicator to help in both short- and long-term analysis.
// The KO was developed with two seemingly opposite goals in mind: to be sensitive 
// enough to signal short-term tops and bottoms, yet accurate enough to reflect the 
// long-term flow of money into and out of a security.
// The KO is based on the following tenets:
// Price range (i.e. High - Low) is a measure of movement and volume is the force behind 
// the movement. The sum of High + Low + Close defines a trend. Accumulation occurs when 
// today's sum is greater than the previous day's. Conversely, distribution occurs when 
// today's sum is less than the previous day's. When the sums are equal, the existing trend 
// is maintained.
// Volume produces continuous intra-day changes in price reflecting buying and selling pressure. 
// The KO quantifies the difference between the number of shares being accumulated and distributed 
// each day as "volume force". A strong, rising volume force should accompany an uptrend and then 
// gradually contract over time during the latter stages of the uptrend and the early stages of 
// the following downtrend. This should be followed by a rising volume force reflecting some 
// accumulation before a bottom develops.
//
// 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

KVO(TrigLen,FastX,SlowX) =>
    pos = 0.0
    xTrend = iff(hlc3 > hlc3[1], volume * 100, -volume * 100)
    xFast = ema(xTrend, FastX)
    xSlow = ema(xTrend, SlowX)
    xKVO = xFast - xSlow
    xTrigger = ema(xKVO, TrigLen)
    pos := iff(xKVO > xTrigger, 1,
    	     iff(xKVO < xTrigger, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & Klinger Volume Oscillator", shorttitle="Combo", overlay = true)
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
TrigLen = input(13, minval=1)
FastX = input(34, minval=1)
SlowX = input(55, minval=1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posKVO = KVO(TrigLen,FastX,SlowX)
pos = iff(posReversal123 == 1 and posKVO == 1 , 1,
	   iff(posReversal123 == -1 and posKVO == -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 )

더 많은