중추점 슈퍼 트렌드 전략

저자:차오장, 날짜: 2024-02-26 10:57:20
태그:

img

전반적인 설명

피보트 포인트 슈퍼 트렌드 전략은 두 가지 인기있는 지표 피보트 포인트와 슈퍼 트렌드를 결합한 혁신적인 트렌드 추적 전략으로, 향상된 정확성을 위해 추가 트렌드 필터를 도입합니다. 이 전략은 가짜 신호를 최소화하면서 트렌드 추적을위한 신뢰할 수있는 도구를 거래자에게 제공하는 것을 목표로 Lonesome TheBlue의 피보트 포인트 슈퍼 트렌드?? 스크립트에서 영감을 얻습니다.

전략 논리

전략의 기초는 피보트 포인트와 슈퍼 트렌드 지표의 융합에 있으며, 강력한 트렌드 필터를 추가합니다. 특정 기간 동안 피보트 고도와 하도를 계산하여 트렌드 분석에 중요한 참조 지점으로 사용됩니다. 가중 평균 계산을 통해 이러한 피보트 포인트는 전체 지표를 정화하여 중심선을 만듭니다.

다음으로, 사용자 정의 인자와 중앙선 및 평균 진정한 범위 (ATR) 를 기반으로 상부 및 하부 대역이 생성됩니다. 이 대역은 시장 변동성에 적응하여 전략에 유연성을 추가합니다. Pivot Point SuperTrend 전략의 핵심은 유행 트렌드를 정확하게 식별하는 데 있으며, 지표가 가격과 상호 작용하면서 상승 및 하락 신호 사이에서 원활하게 전환됩니다.

전략에 도입된 추가 트렌드 필터는 그 기능을 더욱 향상시킵니다. 이 필터는 유동 평균에 기반하여 트렌드 강도와 방향에 대한 동적 평가를 제공합니다. 이 트렌드 필터를 원래 피보트 포인트 슈퍼 트렌드 신호와 결합함으로써 전략은 더 정보화되고 신뢰할 수있는 거래 결정을 내리는 것을 목표로합니다.

이점 분석

  1. 향상된 정확성: 트렌드 필터의 통합은 신호를 생성하기 전에 전체 트렌드 방향을 확인함으로써 전략의 정확성을 향상시킵니다.

  2. 트렌드 계속: 트렌드 필터와 함께 피보트 포인트와 슈퍼 트렌드의 통합은 강력한 시장 트렌드 중에 거래를 연장하여 수익 기회를 극대화 할 수 있습니다.

  3. 줄여진 위프사: 트렌드 필터와 결합된 전략의 중량 평균 계산은 불확정하거나 측면적인 시장 조건에서 잘못된 신호를 최소화하고 위프사를 줄이는 데 도움이됩니다.

  4. 지원 및 저항 인사이트: 전략은 피보트 포인트에 기반한 추가 지원 및 저항 수준을 계속 제공하여 거래자에게 귀중한 컨텍스트 정보를 제공합니다.

위험 분석

  1. 매개 변수 의존성: 전략은 ATR 기간 및 곱셈자와 같은 매개 변수에 민감합니다. 부적절한 설정은 과잉 거래 또는 놓친 기회로 이어질 수 있습니다.

  2. 트렌드 역전: 트렌드 역전 지점 근처에서 전략은 불필요한 손실로 이어지는 잘못된 신호를 생성 할 수 있습니다. 위험은 중지 손실을 사용하여 관리해야합니다.

  3. 과도한 최적화: 매개 변수는 최상의 결과를 위해 최적화 될 수 있지만 미래 생존성이 부족합니다. 매개 변수 선택에 대한 시장과 기기 차이의 영향을 고려해야합니다.

  4. 격차 위험: 가격이 범위를 벗어날 때, 전략은 평평한 지위에 진입합니다. 이것은 격차 이후 트렌드가 재개될 때 기회를 놓칠 수 있습니다.

최적화 방향

  1. 추가 필터: 전략의 견고성을 높이기 위해 볼륨, 변동성 필터 등을 추가할 수 있습니다.

  2. 동적 매개 변수: 변화하는 시장 조건에 따라 자동 최적화 또는 적응적 매개 변수 조정 방법은 전략을 더 다재다능하게 만들 수 있습니다.

  3. 스톱 로스 (Stop Loss): 슬럼프를 효과적으로 통제하기 위해 전략 논리를 유지하면서 스톱 로스 메커니즘을 설계하는 방법을 연구합니다.

  4. 크로스 자산 최적화: 다른 시장과 도구에 대한 전략 매개 변수를 평가합니다. 각각의 특성에 따라 매개 변수를 최적화하십시오.

요약

피보트 포인트 슈퍼 트렌드 전략은 단순성과 트렌드 추적 능력과 같은 차원에서 독특한 강점을 보여줍니다. 동시에 매개 변수, 스톱 손실, 크로스 자산 최적화와 같은 측면은 더욱 보편적이고 신뢰할 수있는 도구로 개선 할 수있는 공간을 제공합니다. 전반적으로 거래자에게 시장 추세를 파악하는 효율적인 방법을 제공합니다.


/*backtest
start: 2023-02-19 00:00:00
end: 2024-02-25 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// © Julien_Eche
// Strategy based on "Pivot Point Supertrend" Indicator by LonesomeTheBlue

//@version=4

strategy("PPS", overlay=true, initial_capital=500000, currency=currency.USD, default_qty_type=strategy.cash, default_qty_value=50000)

prd = input(defval = 2, title="Pivot Point Period", minval = 1, maxval = 50)
Factor=input(defval = 3, title = "ATR Factor", minval = 1, step = 0.1)
Pd=input(defval = 10, title = "ATR Period", minval=1)
showpivot = input(defval = false, title="Show Pivot Points")
showlabel = input(defval = true, title="Show Buy/Sell Labels")
showcl = input(defval = false, title="Show PP Center Line")
showsr = input(defval = false, title="Show Support/Resistance")

// get Pivot High/Low
float ph = pivothigh(prd, prd)
float pl = pivotlow(prd, prd)

// drawl Pivot Points if "showpivot" is enabled
plotshape(ph and showpivot, text="H",  style=shape.labeldown, color=na, textcolor=color.red, location=location.abovebar, transp=0, offset = -prd)
plotshape(pl and showpivot, text="L",  style=shape.labeldown, color=na, textcolor=color.lime, location=location.belowbar, transp=0, offset = -prd)

// calculate the Center line using pivot points
var float center = na
float lastpp = ph ? ph : pl ? pl : na
if lastpp
    if na(center)
        center := lastpp
    else
        //weighted calculation
        center := (center * 2 + lastpp) / 3

// upper/lower bands calculation
Up = center - (Factor * atr(Pd))
Dn = center + (Factor * atr(Pd))

// get the trend
float TUp = na
float TDown = na
Trend = 0
TUp := close[1] > TUp[1] ? max(Up, TUp[1]) : Up
TDown := close[1] < TDown[1] ? min(Dn, TDown[1]) : Dn
Trend := close > TDown[1] ? 1: close < TUp[1]? -1: nz(Trend[1], 1)
Trailingsl = Trend == 1 ? TUp : TDown

// plot the trend
linecolor = Trend == 1 and nz(Trend[1]) == 1 ? color.lime : Trend == -1 and nz(Trend[1]) == -1 ? color.red : na
plot(Trailingsl, color = linecolor ,  linewidth = 2, title = "PP SuperTrend")
 
plot(showcl ? center : na, color = showcl ? center < hl2 ? color.blue : color.red : na)

// check and plot the signals
bsignal = Trend == 1 and Trend[1] == -1
ssignal = Trend == -1 and Trend[1] == 1
plotshape(bsignal and showlabel ? Trailingsl : na, title="Buy", text="Buy", location = location.absolute, style = shape.labelup, size = size.tiny, color = color.lime, textcolor = color.black, transp = 0)
plotshape(ssignal and showlabel ? Trailingsl : na, title="Sell", text="Sell", location = location.absolute, style = shape.labeldown, size = size.tiny, color = color.red, textcolor = color.white, transp = 0)

//get S/R levels using Pivot Points
float resistance = na
float support = na
support := pl ? pl : support[1]
resistance := ph ? ph : resistance[1]

// if enabled then show S/R levels
plot(showsr and support ? support : na, color = showsr and support ? color.lime : na, style = plot.style_circles, offset = -prd)
plot(showsr and resistance ? resistance : na, color = showsr and resistance ? color.red : na, style = plot.style_circles, offset = -prd)

// Trend Filter from SuperTrend Long Strategy
Periods = input(title="ATR Period", type=input.integer, defval=10)
src = input(hl2, title="Source")
Multiplier = input(title="ATR Multiplier", type=input.float, step=0.1, defval=3.0)
changeATR = input(title="Change ATR Calculation Method ?", type=input.bool, defval=true)

// Combine the SuperTrend calculations
atr2 = sma(tr, Periods)
atr = changeATR ? atr(Periods) : atr2

up = src - (Multiplier * atr)
up1 = nz(up[1], up)
up := close[1] > up1 ? max(up, up1) : up

dn = src + (Multiplier * atr)
dn1 = nz(dn[1], dn)
dn := close[1] < dn1 ? min(dn, dn1) : dn

trend = 1
trend := nz(trend[1], trend)
trend := trend == -1 and close > dn1 ? 1 : trend == 1 and close < up1 ? -1 : trend

// Moving Average as Trend Filter
periodes_ma = input(title="Moving Average Period", type=input.integer, defval=20)
src_ma = input(title="Moving Average Source", type=input.source, defval=close)
ma = sma(src_ma, periodes_ma)

// Strategy Entry Conditions
FromMonth = input(defval = 9, title = "From Month", minval = 1, maxval = 12)
FromDay   = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
FromYear  = input(defval = 2018, title = "From Year", minval = 999)
ToMonth   = input(defval = 1, title = "To Month", minval = 1, maxval = 12)
ToDay     = input(defval = 1, title = "To Day", minval = 1, maxval = 31)
ToYear    = input(defval = 9999, title = "To Year", minval = 999)

start     = timestamp(FromYear, FromMonth, FromDay, 00, 00)  
finish    = timestamp(ToYear, ToMonth, ToDay, 23, 59)       

window()  => time >= start and time <= finish ? true : false

// Combined entry conditions
longCondition = (trend == 1 and trend[1] == -1 and close > ma) or (bsignal and window())
shortCondition = (trend == -1 and trend[1] == 1 and close < ma) or (ssignal and window())

if (longCondition)
    strategy.entry("BUY", strategy.long)

if (shortCondition)
    strategy.close("BUY")
    strategy.entry("SELL", strategy.short)

buy1 = barssince((trend == 1 and trend[1] == -1 and close > ma) or (bsignal and window()))
sell1 = barssince((trend == -1 and trend[1] == 1 and close < ma) or (ssignal and window()))
color1 = buy1[1] < sell1[1] ? color.green : buy1[1] > sell1[1] ? color.red : na
barcolor(color1)

더 많은