
성십자 전략 (Holy Grail Strategy) 은 쌍평선 시스템과 ADX 지표를 결합한 양적 거래 전략이다. 그것은 트렌드의 방향과 강도를 식별하고, 트렌드가 변할 때 거래하는 것을 목적으로 한다.
이 전략은 20일 지수 이동 평균 ((EMA) 과 ADX 지표를 동시에 사용하여 입시 시기를 식별합니다. 구체적으로, 다음 두 가지 경우에 거래 신호를 발송합니다:
ADX 값이 30보다 낮을 때 (진행이 약하다는 것을 나타냅니다) 그리고 가격이 아래에서 20 일 EMA를 돌파 할 때 더 많이하십시오.
ADX 값이 30보다 높을 때 (→ 강한 추세를 나타냅니다) 그리고 가격이 위로부터 20 일 EMA를 돌파할 때, 공백을 니다.
이 전략은 ADX에서 트렌드의 강도와 방향을 판단하고, 이동 평균의 지원 저항과 결합하여 역전 기회를 찾습니다. 이것은 트렌드 추적과 역전 거래의 개념을 결합합니다.
성십자 전략의 가장 큰 장점은 트렌드의 방향과 강도를 동시에 고려하여 가짜 브레이크를 효과적으로 피할 수 있다는 것입니다. 특히,이 전략은 다음과 같은 장점이 있습니다.
또한 십자군 전략에는 다음과 같은 몇 가지 측면에 대한 위험도 있습니다.
위와 같은 위험을 줄이기 위해, 최적의 효과를 얻기 위해 변수 조합을 조정할 수 있으며, 단독 손실을 제어하기 위해 손실을 중지 할 수 있습니다. 또한, 다양한 품종과 주기적으로 전략을 재검토하는 것이 필요합니다.
이 전략은 여러 가지 최적화 방향이 있습니다.
매개 변수를 조정하거나 새로운 지표를 추가하면 전략의 수익률이나 승률을 높일 수 있습니다. 그러나 모든 최적화는 안정성을 보장하기 위해 충분한 피드백을 필요로합니다.
전반적으로, 성십자 전략은 양평선과 ADX 지표의 장점을 결합하여 트렌드 전환을 포착하기 위해 명확한 거래 규칙을 사용합니다. 좋은 효과를 기대할 수 있습니다. 그러나 거래자는 여전히 다양한 시장 환경에 적응하기 위해 변수 조합과 중지 규칙을 최적화해야합니다.
/*backtest
start: 2022-11-24 00:00:00
end: 2023-11-30 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=3
strategy("LAT Holy Grail v3", overlay=true)
/////////////TEST TIME ////////////////////////
testStartYear = input(2018, "Backtest Start Year")
testStartMonth = input(4, "Backtest Start Month")
testStartDay = input(15, "Backtest Start Day")
testPeriodStart = timestamp(testStartYear,testStartMonth,testStartDay,0,0)
testStopYear = input(2018, "Backtest Stop Year")
testStopMonth = input(5, "Backtest Stop Month")
testStopDay = input(30, "Backtest Stop Day")
testPeriodStop = timestamp(testStopYear,testStopMonth,testStopDay,0,0)
// A switch to control background coloring of the test period
testPeriodBackground = input(title="Color Background?", type=bool, defval=true)
testPeriodBackgroundColor = testPeriodBackground and (time >= testPeriodStart) and (time <= testPeriodStop) ? #00FF00 : na
bgcolor(testPeriodBackgroundColor, transp=97)
testPeriod() =>
time >= testPeriodStart and time <= testPeriodStop ? true : false
//////////////////////////////////////////////////////////////////////
myema= ema(close, 20)
plot(myema, color=green, title="eMA", linewidth=3)
//longCondition = (crossover(close, myema)) //and adx3 < target
//if (longCondition)
//strategy.entry("My Long Entry Id", strategy.long)
//shortCondition = (crossunder(close, myema)) //and adx3 > target
//if (shortCondition)
//strategy.entry("My Short Entry Id", strategy.short)
//////////////////////////////////////////////////////////
/////////////////////////////////////// DMI ///////////////////////////////////////////////
len3 = input(14, minval=1, title="DI Length") /////////////////////
lensig3 = input(14, title="ADX Smoothing", minval=1, maxval=50) ////////////////////
up3 = change(high) ///////////////////
down3 = -change(low) //////////////////
plusDM3 = na(up3) ? na : (up3 > down3 and up3 > 0 ? up3 : 0) /////////////////
minusDM3 = na(down3) ? na : (down3 > up3 and down3 > 0 ? down3 : 0) ////////////////
trur3 = rma(tr, len3) ///////////////
plus3 = fixnan(100 * rma(plusDM3, len3) / trur3) //////////////
minus3 = fixnan(100 * rma(minusDM3, len3) / trur3) /////////////
sum3 = plus3 + minus3 ////////////
adx3 = 100 * rma(abs(plus3 - minus3) / (sum3 == 0 ? 1 : sum3), lensig3) ///////////
//plot(plus3, color=green, style=circles, linewidth=2, title="+DI") //////////
//plot(minus3, color=red, style=circles, linewidth=2, title="-DI") /////////
plot(adx3, color=aqua, style=line, linewidth=3, title="ADX") ////////
target = input(30, title=" ADX Target Line") ///////
plot(target, color=yellow, title="ADX Target Line") //////
/////////////////////////////////////////////////////////////////////////////////////////////////
plot(hl2)
/////////////////////////////////////////////// eMA SIGNAL LINE ///////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////// HOLY GRAIL STRATEGY ///////////////////////////////////////////////////////////////////
if (adx3 <= target) and crossover(close, myema)
strategy.entry("HolyGrail", strategy.long, comment="Long")
if (adx3 >= target) and crossunder(close, myema)
strategy.entry("HolyGrail", strategy.short, comment="Short")