ターンポイントスーパートレンド戦略

作者: リン・ハーンチャオチャン,日付: 2024-02-26 10:57:20
タグ:

img

概要

ピボットポイントスーパートレンド戦略は,人気のある2つの指標ピボットポイントとスーパートレンドを組み合わせ,さらに精度を高めるための追加のトレンドフィルターを導入した革新的なトレンドフォロー戦略です.この戦略は,Lonesome TheBlueピボットポイントスーパートレンドスクリプトからインスピレーションを得て,偽信号を最小限に抑えながらトレンドフォローのための信頼できるツールを提供することを目指しています.

戦略の論理

戦略の基礎は,ピボットポイントとスーパートレンド指標の融合,さらに強力なトレンドフィルターの追加にあります.それは,特定の期間中のピボット高値と低値を計算し,トレンド分析のための重要な基準点として機能します. 重度の平均計算を通じて,これらのピボットポイントは中央線を作り,全体的な指標を精製します.

次に,センターラインとユーザー定義ファクタルの平均真値範囲 (ATR) をベースに,上下帯が生成される.これらの帯は市場の変動に適応し,戦略に柔軟性を追加する.Pivot Point SuperTrend戦略の核心は,価格がスーパートレンド帯と相互作用するにつれて上昇信号と下降信号の間に順調に移行する傾向を正確に特定することにある.

戦略に導入された追加のトレンドフィルターは,その能力をさらに強化する.このフィルターは移動平均値に基づい,トレンドの強さと方向性のダイナミックな評価を提供します.このトレンドフィルターをオリジナルのピボットポイントスーパートレンド信号と組み合わせることで,戦略はより知的で信頼性の高い取引決定を下すことを目指しています.

利点を分析する

  1. トレンドフィルタを組み込むことで,シグナルを生成する前に全体的なトレンド方向を確認することで,戦略の正確性が向上します.

  2. トレンド継続:Pivot PointとSuperTrendの統合は,トレンドフィルターとともに,強力な市場トレンドの間に取引を延長することを目的とし,利益の機会を最大化します.

  3. 減少したウィップソー:戦略の重度の平均計算とトレンドフィルターは,不確実性や横向的な市場状況下で誤った信号を最小限に抑え,ウィップソーを減らすのに役立ちます.

  4. サポートとレジスタンスのインサイト: 戦略はピボットポイントに基づいて追加のサポートとレジスタンスのレベルを提供し,トレーダーに貴重な文脈情報を提供します.

リスク分析

  1. パラメータ依存性:この戦略は,ATR期間や倍数などのパラメータに敏感です.不適切な設定は,過剰取引または機会を逃す可能性があります.

  2. トレンド逆転: トレンド逆転点近くでは,戦略は不必要な損失を伴う誤った信号を生む可能性があります.リスクはストップ損失を使用して管理する必要があります.

  3. 過剰最適化:パラメータは最適な結果を得るために最適化できるが,前向きな可動性がない.パラメータ選択に対する市場と機器の違いの影響を考慮すべきである.

  4. ギャップリスク: 価格が帯の外に移動すると,戦略はフラットポジションに入ります.ギャップの後,トレンドが再開する機会を逃す可能性があります.

オプティマイゼーションの方向性

  1. 追加フィルター: 戦略の信頼性を高めるため,ボリューム,変動性フィルターなどを追加できます.

  2. ダイナミックパラメータ: 変化する市場状況に基づくパラメータの自動最適化または適応調整方法により,戦略はより汎用化できます.

  3. ストップ・ロスは,ダウンサイドを効果的に制御するための戦略論理を維持しながらストップ・ロスのメカニズムを設計する方法を探ります.

  4. クロス・アセット最適化: 異なる市場やインストラムの戦略パラメータを評価する. それぞれの特異性に応じてパラメータを最適化する.

概要

Pivot Point SuperTrend戦略は,シンプルさやトレンドフォローする能力などの側面においてユニークな強みを示している.同時に,パラメータ,ストップ損失,クロス資産最適化などの側面は,より普遍的で信頼性の高いツールに改善する余地を提供します.全体として,トレーダーは市場のトレンドを把握する効率的な手段を提供します.


/*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)

もっと