Heikin Ashi ROC 백분위수에 기반한 거래 전략


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

Heikin Ashi ROC 백분위수에 기반한 거래 전략

개요

이 전략은 Heikin Ashi ROC 백분율을 기반으로 한 거래 전략이라고 불리며, Heikin Ashi ROC 및 백분율을 기반으로 한 사용하기 쉬운 거래 프레임워크를 제공하는 것을 목표로합니다.

전략 원칙

이 전략은 Heikin Ashi의 종결 가격 ROC와 각기 다른 시간대의 최고값과 최저값을 계산하여 거래의 상하 궤도를 생성한다. 구체적으로, 이것은 지난 50주기 ROC의 최고값 rocHigh과 최저값 rocLow을 계산한다. 그 다음 rocHigh에 따라 상하 궤도의 upperKillLine을 계산하고, rorocLow에 따라 하하 궤도의 lowerKillLine을 계산한다. 이 두 개의 궤도선은 특정 백분율을 나타낸다.

우위 분석

이 전략의 가장 큰 장점은 ROC 지표의 강력한 트렌드 추적 능력을 활용하여 Heikin Ashi 평평한 가격 정보의 특성과 함께 트렌드의 변화를 효과적으로 식별할 수 있다는 것입니다. 단순한 이동 평균과 같은 지표와 비교하여 ROC는 가격 변화에 더 민감하게 반응하여 전략에 신속하게 개입 할 수 있습니다. 또한, 퍼센티지를 사용하여 생성 된 오르락 내리락을 사용하여 불필요한 거래를 방지하는 가짜 돌파구를 효과적으로 필터링 할 수 있습니다. 전체적으로 이 전략은 트렌드 추적과 흔들림 필터링의 두 가지 기능을 결합하여 트렌드 아래에서 더 나은 리스크 수익률을 얻을 수 있습니다.

위험 분석

이 전략의 주요 위험은 매개 변수 설정을 잘못하면 거래가 빈번하거나 충분히 민감하지 않을 수 있다는 것입니다. rocLength와 백분율 계산의 주기는 신중하게 설정되어야합니다. 그렇지 않으면 거래 기회를 놓치거나 불필요한 손실을 초래할 수 있습니다. 또한, 백분율 설정을 여러 시장의 반복 테스트에 따라 최적의 매개 변수 조합을 찾기 위해 조정해야합니다.

최적화 방향

이 전략은 다음과 같은 몇 가지 측면에서 최적화 될 수 있습니다: 1) RSI와 같은 다른 지표 필터링 진입 신호와 결합; 2) 기계 학습 방법을 이용한 동적 최적화 파라미터; 3) 스톱 스톱 자동 원본 거친 퇴출 메커니즘을 설정; 4) 다른 비 트렌드 전략과 결합하여 전략 위험을 균형을 맞추기 위해 조합.

요약하다

요약하자면, 이 전략은 ROC 지표의 강력한 트렌드 추적 능력을 활용하여 Heikin Ashi 특성과 함께 추세를 판단하고 추세를 추적하며 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