
이 전략은 변동 동력 지표 ((Vortex Indicator, VI) 를 기반으로 한 트렌드 추적 거래 시스템입니다. 이 전략은 가격 변동의 긍정 동력 ((VI+) 과 부정 동력 ((VI-) 을 계산하여 시장 추세의 전환점을 식별하고 중요한 지표 교차 위치에 거래 신호를 발생시킵니다. 이 전략은 부드러운 이동 평균 ((SMA) 을 사용하여 소음을 줄이고 신호의 신뢰성을 향상시킵니다.
전략의 핵심은 VI+와 VI-의 상대적인 강도를 비교하여 트렌드 방향을 판단하는 것입니다. 구체적인 계산 과정은 다음과 같습니다:
이 전략은 변동력 지표의 혁신적인 응용을 통해 트렌드 추적 거래에 대한 신뢰할 수있는 분석 프레임 워크를 제공합니다. 약간의 지연이 있음에도 불구하고, 합리적인 매개 변수 최적화 및 위험 관리 조치를 통해 안정적인 거래 시스템을 구축 할 수 있습니다.
/*backtest
start: 2022-02-11 00:00:00
end: 2025-02-08 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Vortex Strategy with Signals", shorttitle="VI_Strat", overlay=true)
// Užívateľský vstup
length = input.int(14, title="Period", minval=1)
//------------------------------------
// 1) Výpočet Vortexu
//------------------------------------
vmPlus = math.abs(high - low[1])
vmMinus = math.abs(low - high[1])
trueRange = math.max(math.max(high - low, math.abs(high - close[1])), math.abs(low - close[1]))
// SMA vyhladzovanie
smoothedVMPlus = ta.sma(vmPlus, length)
smoothedVMMinus = ta.sma(vmMinus, length)
smoothedTrueRange = ta.sma(trueRange, length)
// Vortex Indikátory
viPlus = smoothedVMPlus / smoothedTrueRange
viMinus = smoothedVMMinus / smoothedTrueRange
//------------------------------------
// 2) Plot indikátora
//------------------------------------
plot(viPlus, color=color.green, title="VI+")
plot(viMinus, color=color.red, title="VI-")
//------------------------------------
// 3) Definícia signálov
//------------------------------------
bullSignal = ta.crossover(viPlus, viMinus) // VI+ pretína VI- smerom nahor
bearSignal = ta.crossunder(viPlus, viMinus) // VI+ pretína VI- smerom nadol
//------------------------------------
// 4) Vizualizácia signálov na grafe
//------------------------------------
plotshape(bullSignal,
title="Bull Signal",
style=shape.labelup,
location=location.belowbar,
color=color.green,
text="BUY",
textcolor=color.white,
size=size.small)
plotshape(bearSignal,
title="Bear Signal",
style=shape.labeldown,
location=location.abovebar,
color=color.red,
text="SELL",
textcolor=color.white,
size=size.small)
//------------------------------------
// 5) STRATEGY LOGIC
//------------------------------------
if bullSignal
strategy.entry("Long", strategy.long)
if bearSignal
strategy.entry("Short", strategy.short)