프랙탈 및 패턴 기반의 양적 거래 전략

저자:차오장, 날짜: 2024-02-19 14:32:45
태그:

img

전반적인 설명

이 문서에서는 프랙탈 분석과 촛불 패턴을 결합한 양적 거래 전략을 소개합니다. 주요 반전 지점과 상승/하락 반전 촛불 패턴을 탐지함으로써이 전략은 저위험 고수익 자동화 거래를 가능하게합니다.

전략 원칙

이 전략은 프랙탈 분석과 촛불 패턴 인식의 조합을 사용하여 트렌드를 포착하기 위해 명확한 엔트리 및 스톱 로스 논리를 정의하는 상세한 가격 행동 분석을 기반으로합니다.

특히, 진입 조건은: 가격이 이전 2 바의 최고치 이상의 폭을 돌파하고, 프랙탈 브레이크 또는 올풍적 삼키기 또는 해머 패턴이 발생합니다. 이 조합은 긴 신호를 확고하게 확인합니다. 이전 2 바의 최저치 이하의 가격 경류에서 출구를 정의하는 스톱 로스 논리는 빠르고 효과적인 스톱을 보장합니다.

패턴 검출을 위해, 이 전략은 일반적으로 사용되는 프랙탈 이론을 사용하여 주요 반전 지점을 식별하고, 3 가지 고전적인 촛불 반전 패턴을 탐지하는 알고리즘을 사용합니다.

코딩은 파이인 문자에서 수행됩니다. 가격이 3 바의 새로운 높은 / 낮은 것을 만들 때 프랙탈 높은 / 낮은 것이 식별되며 포식 패턴에 대해 오픈 / 클로즈 가격에 대한 엄격한 규칙이 사용됩니다.

장점

이 전략의 주요 장점:

  1. 프랙탈과 패턴을 결합한 정확한 신호
  2. 명확한 입력 및 중지 손실 논리
  3. 성숙한 이론은 과도한 적합성을 방지합니다.
  4. 소나무 스크립트는 백테스팅을 허용합니다.

위험성

여전히 위험 요소가 있습니다.

  1. 프랙탈 및 패턴 탐지에서의 주관성
  2. 연속적인 손실을 초래할 수 있는 윙사
  3. 스톱 로스 사이징은 높은 주파수 거래에 대한 조정이 필요합니다.

최적화된 스톱, 트렌드 필터링 및 앞으로 걷는 분석과 같은 방법은 위의 위험을 제어하는 데 도움이 될 수 있습니다.

개선

추가 개선이 필요한 분야:

  1. 탄력성을 위한 촛불 패턴 파라미터
  2. 트렌드 편견 필터를 추가하여 화이트사브를 피합니다.
  3. 자동 매개 변수 최적화를 위한 기계 학습을 도입

이러한 개선은 전략의 안정성과 수익성을 더욱 강화할 것입니다.

결론

이 문서에서는 프랙탈과 촛불 패턴을 결합한 가격 액션 거래 전략을 철저히 다루고 있습니다. 정확한 신호, 쉬운 구현 및 효과적인 트렌드 추적으로,이 전략은 체계적인 거래자와 재량 거래자에게 크게 도움이 될 수 있습니다. 지속적인 개선 및 검증은 실제 거래에 대한 성능을 더욱 향상시킬 것입니다.


/*backtest
start: 2023-02-12 00:00:00
end: 2024-02-18 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
strategy("Fractal & Pattern Entry/Exit Strategy", overlay=true)

// Fractal calculation
fractalHigh = high == highest(3)
fractalLow = low == lowest(3)

// Pattern detection
bullishEngulfing = open < close[1] and close > open[1] and close > open + (open[1] - close[1]) * 2 and low < min(open, close) and high > max(open, close) and open[1] > close[1]
bearishEngulfing = open > close[1] and close < open[1] and open > close + (close[1] - open[1]) * 2 and high > max(open, close) and low < min(open, close) and open[1] < close[1]
hammer = open < close and close > (high + low + open * 2) / 4 and close - open > (high - low) * 0.6 and high - close < (high - low) * 0.1 and open - low < (high - low) * 0.1
hangingMan = open > close and open < (high + low + close * 2) / 4 and open - close > (high - low) * 0.6 and high - open < (high - low) * 0.1 and close - low < (high - low) * 0.1

// Entry condition
longCondition = crossover(close, highest(2)[1]) and (fractalHigh or bullishEngulfing or hammer)
shortCondition = crossunder(close, lowest(2)[1]) and (fractalLow or bearishEngulfing or hangingMan)

// Exit condition
exitLongCondition = crossunder(close, lowest(2)[1])
exitShortCondition = crossover(close, highest(2)[1])

// Entry and exit orders
if (longCondition)
    strategy.entry("Long", strategy.long)
if (shortCondition)
    strategy.entry("Short", strategy.short)
if (exitLongCondition)
    strategy.close("Long")
if (exitShortCondition)
    strategy.close("Short")

// Plot fractals
plotshape(fractalHigh, title="Fractal High", style=shape.triangledown, location=location.abovebar, color=color.green, size=size.small)
plotshape(fractalLow, title="Fractal Low", style=shape.triangleup, location=location.belowbar, color=color.red, size=size.small)

// Plot patterns
plotshape(bullishEngulfing, title="Bullish Engulfing", style=shape.arrowup, location=location.belowbar, color=color.green, size=size.small)
plotshape(bearishEngulfing, title="Bearish Engulfing", style=shape.arrowdown, location=location.abovebar, color=color.red, size=size.small)
plotshape(hammer, title="Hammer", style=shape.arrowup, location=location.belowbar, color=color.green, size=size.small)
plotshape(hangingMan, title="Hanging Man", style=shape.arrowdown, location=location.abovebar, color=color.red, size=size.small)


더 많은