적응성 변동성 유한용량 요소 전략

저자:차오장, 날짜: 2023-10-17 14:50:13
태그:

img

전반적인 설명

이 전략은 트렌드 다음 전략에 속하는 긴 신호와 짧은 신호를 결정하기 위해 적응성 변동성 메트릭과 결합한 유한량 요소 방법을 이용합니다. 모든 시간 프레임에 적용되며 다른 변동성 수준에 적응하도록 매개 변수를 자동으로 조정할 수 있습니다.

원칙

이 전략은 먼저 높은 가격과 낮은 가격의 평균, 최근 N 바의 폐쇄 가격의 평균, 그리고 이전 바의 평균 높은 가격, 낮은 가격 및 폐쇄 가격을 계산합니다. 그 다음 현재와 이전 바에 대한 로그아리듬 수익 인트라와 인터을 계산합니다. 한편, 인트라와 인터의 빈트라와 윈터 변동성을 계산합니다.

변동성 수준과 조정 가능한 매개 변수에 따라 적응 절단 계수 CutOff가 결정됩니다. 가격 변화가 CutOff를 초과하면 긴 또는 짧은 신호가 생성됩니다. 구체적으로, 현재 폐쇄 가격과 높은 가격과 낮은 가격의 평균 사이의 차이 MF를 계산합니다. MF가 CutOff보다 크면 긴 신호입니다. MF가 마이너스 CutOff보다 작을 때 짧은 신호입니다.

마지막으로 신호에 따라 자금 흐름이 계산되고, 위치 신호 pos를 출력하고, 유한용량 요소 곡선 FVE를 그래프화합니다.

장점

  1. 수동 조정 없이 다른 시간 프레임과 변동성 수준에 적용 가능한 적응 파라미터

  2. 가격의 트렌드 변화를 정확하게 포착합니다.

  3. FVE 곡선은 긴 힘과 짧은 힘의 비교를 명확히 나타냅니다.

  4. 자금 흐름 분석의 확실한 이론적 기초, 비교적 신뢰할 수 있는 신호

위험성

  1. 시장의 격렬한 변동 중에 더 많은 잘못된 신호를 생성할 수 있습니다. 따라서 N를 조정할 수 있습니다.

  2. 가격 격차를 감당할 수 없어 다른 지표를 결합하는 것을 고려할 수 있습니다.

  3. 자금 흐름 신호는 때로는 기술적 분석과 다를 수 있습니다. 여러 신호를 결합 할 수 있습니다.

최적화

  1. 다른 N 값의 영향을 테스트 할 수 있습니다. 일반적으로 더 큰 N는 소음을 필터링 할 수 있습니다.

  2. Cintra와 Cinter의 다양한 조합을 테스트하여 최적의 매개 변수를 찾을 수 있습니다. 또는 동적으로 적응하는 것을 고려할 수 있습니다.

  3. MACD와 같은 다른 지표와 결합하여 안정성을 향상시킬 수 있습니다.

  4. 단일 거래 손실을 제어하기 위해 스톱 로스 메커니즘을 구축할 수 있습니다.

결론

전체적으로 이 전략은 탄탄한 원칙으로 상당히 신뢰할 수 있다. 트렌드를 따르는 전략의 구성 요소로 작용할 수 있으며, 다른 전략과 적절하게 결합될 때 더욱 잘 작동한다. 핵심은 최적의 매개 변수를 찾고 건전한 리스크 관리를 확립하는 것이다. 더 이상 최적화되면 매우 강력한 트렌드 추적 시스템으로 변할 수 있다.


/*backtest
start: 2022-10-10 00:00:00
end: 2023-10-16 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=2
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 18/08/2017
// This is another version of FVE indicator that we have posted earlier 
// in this forum.
// This version has an important enhancement to the previous one that`s 
// especially useful with intraday minute charts.
// Due to the volatility had not been taken into account to avoid the extra 
// complication in the formula, the previous formula has some drawbacks:
// The main drawback is that the constant cutoff coefficient will overestimate 
// price changes in minute charts and underestimate corresponding changes in 
// weekly or monthly charts.
// And now the indicator uses adaptive cutoff coefficient which will adjust to 
// all time frames automatically.
//
// You can change long to short in the Input Settings
// Please, use it only for learning or paper trading. Do not for real trading.
////////////////////////////////////////////////////////////
strategy(title="Volatility Finite Volume Elements", shorttitle="FVI")
Samples = input(22, minval=1)
Perma = input(40, minval=1)
Cintra = input(0.1, step=0.1)
Cinter = input(0.1, step=0.1)
reverse = input(false, title="Trade reverse")
xhl2 = hl2
xhlc3 = hlc3
xClose = close
xIntra = log(high) - log(low)
xInter = log(xhlc3) - log(xhlc3[1])
xStDevIntra = stdev(sma(xIntra, Samples) , Samples)
xStDevInter = stdev(sma(xInter, Samples) , Samples)
xVolume = volume
TP = xhlc3
TP1 = xhlc3[1]
Intra = xIntra
Vintra = xStDevIntra
Inter = xInter
Vinter = xStDevInter
CutOff = Cintra * Vintra + Cinter * Vinter
MF = xClose - xhl2 + TP - TP1
FveFactor = iff(MF > CutOff * xClose, 1, 
             iff(MF < -1 * CutOff * xClose, -1,  0))
xVolumePlusMinus = xVolume * FveFactor
Fvesum = sum(xVolumePlusMinus, Samples)
VolSum = sum(xVolume, Samples)
xFVE = (Fvesum / VolSum) * 100
xEMAFVE = ema(xFVE, Perma)
pos = iff(xFVE > xEMAFVE, 1,
	   iff(xFVE < xEMAFVE, -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(xFVE, color=green, title="FVI")
plot(xEMAFVE, color=blue, title="FVI EMA")

더 많은