헤이킨 아시 ROC 퍼센틸 거래 전략

저자:차오장, 날짜: 2023-10-23 15:41:40
태그:

img

전반적인 설명

이 전략은 Heikin Ashi ROC 퍼센틸 트레이딩 전략이라고 불립니다. 이 전략은 Heikin Ashi ROC와 그 퍼센틸을 기반으로 사용하기 쉬운 거래 프레임워크를 제공하는 것을 목표로합니다.

전략 논리

이 전략은 지난 rocLength 기간에 걸쳐 Heikin Ashi의 ROC 폐쇄 가격을 계산합니다. 그 다음 지난 50 기간 동안 ROC의 가장 높은 rocHigh 및 가장 낮은 rocLow 값을 계산합니다. 상부 레일 상위 킬라인 및 하부 레일 하부 킬 라인은 rocHigh 및 rocLow의 특정 퍼센틸을 기반으로 생성됩니다. ROC가 하부 킬 라인을 넘을 때 긴 포지션이 열립니다. ROC가 상위 킬 라인을 넘을 때 긴 포지션은 닫습니다. 반대로 ROC가 상위 킬 라인을 넘을 때 짧은 포지션이 열립니다. ROC가 하부 킬 라인을 넘을 때 짧은 포지션은 닫습니다.

이점 분석

이 전략의 가장 큰 장점은 ROC 지표의 강력한 트렌드 추적 기능을 활용하고, 하이킨 아시의 가격 정보를 매끄럽게하는 기능과 결합하는 것입니다. 이것은 전략이 트렌드 변화를 효과적으로 식별하고 적시에 거래를 수행 할 수 있도록합니다. 간단한 이동 평균에 비해 ROC는 가격 변화에 더 민감하게 반응합니다. 또한, 퍼센틸로 생성된 상위 및 하부 레일은 통합을 효과적으로 필터링하고 가짜 브레이크에서 불필요한 거래를 피할 수 있습니다. 전반적으로이 전략은 트렌드 추적과 오스실레이션 필터링을 결합하여 주요 트렌드에서 좋은 위험 보상 비율을 달성합니다.

위험 분석

이 전략의 주요 위험은 부적절한 매개 변수 설정이 과거래 또는 불충분한 감수성으로 이어질 수 있다는 것입니다. rocLength 및 퍼센틸 룩백 기간은 신중하게 설정해야합니다. 그렇지 않으면 레일은 너무 둔하거나 딱딱해져서 놓친 거래 또는 불필요한 손실을 유발할 수 있습니다. 또한, 퍼센틸 설정은 최적의 조합을 찾기 위해 여러 차례 역 테스트 및 다양한 시장에 맞게 조정되어야합니다. 트렌드가 역전되는 경우 트렌드를 따르는 지표에 의존하기 때문에 전략은 또한 특정 손실에 노출됩니다. 포지션은 적시에 폐쇄되거나 위험을 제어하기 위해 설정된 손실을 중지해야합니다.

최적화 방향

전략은 다음과 같은 방법으로 최적화 될 수 있습니다. 1) RSI와 같은 다른 지표와 필터를 추가하십시오. 2) 기계 학습으로 매개 변수를 동적으로 최적화하십시오. 3) 자동 리스크 관리를 위해 스톱 로스를 설정하고 이익을 취하십시오. 4) 위험을 균형 잡기 위해 트렌드 아닌 전략과 결합하십시오.

요약

요약하자면, 이 전략은 트렌드 식별 및 추적을 위해 ROC 지표의 강력한 트렌드 추적 기능을 하이킨 아시와 결합하여 활용합니다. ROC 퍼센틸로 생성된 상부 및 하부 레일은 효과적인 손실 필터링을 가능하게합니다. 이것은 좋은 트렌드 추적 성능을 달성합니다. 이점은 트렌드 변화와 주요 트렌드를 적시에 식별하고 레일로 통합을 필터링하는 데 있습니다. 그러나 부적절한 매개 변수 설정은 성능에 영향을 미칠 수 있으며 트렌드 역전 위험이 남아 있습니다. 매개 변수 선택 및 정지 추가 최적화는 더 일관된 결과를 얻는 데 도움이 될 수 있습니다.


/*backtest
start: 2023-09-22 00:00:00
end: 2023-10-22 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © jensenvilhelm

//@version=5
strategy("Heikin Ashi ROC Percentile Strategy", shorttitle="ROC ON" , overlay=false)

// User Inputs
zerohLine = input(0, title="Midline")  // Zero line, baseline for ROC (customer can modify this to adjust midline)
rocLength = input(100, title="roc Length")  // Lookback period for SMA and ROC (customer can modify this to adjust lookback period)

stopLossLevel = input(2, title="Stop Loss (%)")  // Level at which the strategy stops the loss (customer can modify this to adjust stop loss level)
startDate = timestamp("2015 03 03")  // Start date for the strategy (customer can modify this to adjust start date)

// Heikin Ashi values
var float haClose = na  // Define Heikin Ashi close price
var float haOpen = na  // Define Heikin Ashi open price
haClose := ohlc4  // Calculate Heikin Ashi close price as average of OHLC4 (no customer modification needed here)
haOpen := na(haOpen[1]) ? (open + close) / 2 : (haOpen[1] + haClose[1]) / 2  // Calculate Heikin Ashi open price (no customer modification needed here)

// ROC Calculation
roc = ta.roc(ta.sma(haClose, rocLength), rocLength)  // Calculate Rate of Change (ROC) (customer can modify rocLength in the inputs)
rocHigh = ta.highest(roc, 50)  // Get the highest ROC of the last 50 periods (customer can modify this to adjust lookback period)
rocLow = ta.lowest(roc, 50)  // Get the lowest ROC of the last 50 periods (customer can modify this to adjust lookback period)
upperKillLine = ta.percentile_linear_interpolation(rocHigh, 10, 75)  // Calculate upper kill line (customer can modify parameters to adjust this line)
lowerKillLine = ta.percentile_linear_interpolation(rocLow, 10, 25)  // Calculate lower kill line (customer can modify parameters to adjust this line)

// Trade conditions
enterLong = ta.crossover(roc, lowerKillLine)  // Define when to enter long positions (customer can modify conditions to adjust entry points)
exitLong = ta.crossunder(roc, upperKillLine)  // Define when to exit long positions (customer can modify conditions to adjust exit points)
enterShort = ta.crossunder(roc, upperKillLine)  // Define when to enter short positions (customer can modify conditions to adjust entry points)
exitShort = ta.crossover(roc, lowerKillLine )  // Define when to exit short positions (customer can modify conditions to adjust exit points)

// Strategy execution
if(time >= startDate)  // Start strategy from specified start date
    if (enterLong)
        strategy.entry("Long", strategy.long)  // Execute long trades
    if (exitLong)
        strategy.close("Long")  // Close long trades
    if (enterShort)
        strategy.entry("Short", strategy.short)  // Execute short trades
    if (exitShort)
        strategy.close("Short")  // Close short trades

// Plotting
plot(zerohLine,title="Zeroline")  // Plot zero line
plot(roc, "RSI", color=color.rgb(248, 248, 248))  // Plot ROC
plot(rocHigh, "Roc High", color = color.rgb(175, 78, 76))  // Plot highest ROC
plot(rocLow, "Roc Low", color = color.rgb(175, 78, 76))  // Plot lowest ROC
plot(upperKillLine, "Upper Kill Line", color = color.aqua)  // Plot upper kill line
plot(lowerKillLine, "Lower Kill Line", color = color.aqua)  // Plot lower kill line


더 많은