프랙탈 카오스 오실레이터 트레이딩 전략


생성 날짜: 2023-09-18 15:10:09 마지막으로 수정됨: 2023-09-18 15:10:09
복사: 1 클릭수: 1280
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

개요

이 전략은 Fractal Chaos Oscillator (FCO) 지표를 계산하여 시장의 경향 방향을 판단하여 트렌드 추적을 구현한다. FCO는 지역 극대값과 극소값의 변화를 비교하여 가격 움직임을 판단한다. 수치는 -1에서 1 사이이며 수치가 높을수록 추세는 더 분명하다. FCO가 더 높은 값을 달성하면 더 많이 하고, 낮은 값을 달성하면 공백한다.

전략 원칙

특정 K선 형태를 찾아서 국소 극대값과 극소값을 판단한다. 인접한 두 개의 극대값의 변화를 비교해, FCO 지수를 산출한다. 예를 들어, 최신 세트의 극대 최소값이 이전 세트와 동시되지 않을 때, FCO가 1인 것은 가격 상승 추세가 강해진다는 것을 의미한다. FCO 값에 따라 추세 방향을 판단한다. 값이 높을수록 더 많이 하고, 값이 낮을수록 공백하게 한다.

우위 분석

  • FCO 지표는 트렌드 방향에 대해 간단하고 효과적입니다.
  • 복잡한 파라미터를 설정하지 않고, 사용하기 편리합니다.
  • 단선에서 수익을 낼 수 있고, 일일 거래에 적합하다.
  • 필요에 따라 추가 또는 비공개로 선택할 수 있습니다

위험 분석

  • 분류가 정확하지 않아 전환점을 놓칠 수 있습니다.
  • “이런 일이 벌어질 수 있는 이유는, 우리가 지금 이 상황을 제대로 파악하지 못하고 있기 때문입니다.
  • 일일 거래가 많고 수수료 부담이 높습니다.

적절한 최적화 파라미터, 또는 다른 지표와 결합하여 트렌드 반전을 판단할 수 있다.

최적화 방향

  • 다른 분형 주기 변수를 테스트합니다.
  • FCO를 최적화하기 위한 추가/공백 절댓값
  • 이동평균과 같은 지표와 결합하여 트렌드 반전을 결정합니다.
  • 다양한 품종에서 테스트 파라미터 강도

요약하다

FCO 전략은 간단한 지표를 통해 트렌드 방향을 판단하고, 짧은 라인 거래에 적합하다. 파라미터 최적화와 같은 방법으로 효과를 높일 수 있다. 쉽게 구현할 수 있는 트렌드 추적 전략이다.

전략 소스 코드
/*backtest
start: 2023-09-10 00:00:00
end: 2023-09-17 00:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=2
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 22/02/2018
//   The value of Fractal Chaos Oscillator is calculated as the difference between 
// the most subtle movements of the market. In general, its value moves between 
// -1.000 and 1.000. The higher the value of the Fractal Chaos Oscillator, the 
// more one can say that it follows a certain trend – an increase in prices trend, 
// or a decrease in prices trend.
//
//   Being an indicator expressed in a numeric value, traders say that this is an 
// indicator that puts a value on the trendiness of the markets. When the FCO reaches 
// a high value, they initiate the “buy” operation, contrarily when the FCO reaches a 
// low value, they signal the “sell” action. This is an excellent indicator to use in 
// intra-day trading.
//
// You can change long to short in the Input Settings
// WARNING:
//  - For purpose educate only
//  - This script to change bars colors.
////////////////////////////////////////////////////////////
fractalUp(pattern) =>
    p = high[pattern+1]
    okl = 1
    okr = 1
	for i = pattern to 1
		okl := iff(high[i] < high[i+1] and okl == 1 , 1, 0)
	for i = pattern+2 to pattern*2+1
		okr := iff(high[i] < high[i-1] and okr == 1, 1, 0)
	res = iff(okl == 1 and okr == 1, p, res[1])
    res

fractalDn(pattern) =>
    p = low[pattern+1]
    okl = 1
    okr = 1
	for i = pattern to 1
		okl := iff(low[i] > low[i+1] and okl == 1 , 1, 0)
	for i = pattern+2 to pattern*2+1
		okr := iff(low[i] > low[i-1] and okr == 1, 1, 0)
	res = iff(okl == 1 and okr == 1, p, res[1])
    res

strategy(title="Fractal Chaos Oscillator", overlay = false)
Pattern = input(1, minval=1)
reverse = input(false, title="Trade reverse")
xUpper = fractalUp(Pattern)
xLower = fractalDn(Pattern)
xRes = iff(xUpper != xUpper[1], 1, 
         iff(xLower != xLower[1], -1, 0))
pos = iff(xRes == 1, 1,
       iff(xRes == -1, -1, nz(pos[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)	   	    
barcolor(possig == -1 ? red: possig == 1 ? green : blue )           
plot(xRes, color=blue, title="FCO")