ピアスピンバー逆転戦略

作者: リン・ハーンチャオチャン,日付: 2024-01-25 12:29:29
タグ:

img

概要

ピルシング・ピンバー逆転戦略は,短期的な価格パターンに基づくトレンド・トレード・戦略である.ピンバーをシグナルとして利用し,移動平均値と組み合わせてトレンド方向を決定し,高精度のエントリーを達成する.また,非常に高い収益性を実現するためにユニークなトレーリングストップメカニズムを使用する.

原則

入力信号

この戦略の入口信号はピンバーを貫くものです.特に,信号は次のときトリガーされます.

  1. ピンバーは移動平均を貫く:上昇するバーはダウントレンドMASを貫く,または下落するバーは上昇トレンドMASを貫く

この組み合わせは,ほとんどのノイズをフィルタリングし,入力精度を高めます.

傾向の定義

長いエントリでは,高速MA > 中間MA > 遅いMAが必要です.短いエントリでは,高速MA < 中間MA < 遅いMAが必要です.

損失を停止するメカニズム

利点分析

高効率の入力

ピアスシグナルは,高確率のチャンスポイントでのみエントリーを許可し,過度に騒々しい取引を避けます.トレンドフィルターと組み合わせることで,ほとんどの反トレンドオペレーションがさらに避けられます.これは戦略の高精度を保証します.

極めて 強い 利益 を 得る

独自のトレーリングストップは,この戦略の最大のハイライトです. 取引ごとに小さな範囲内でストップロスを正確に制御し,最大得られた利益を確保します.

このメカニズムを適用すると 収益性は前例のない高さへと押し上げられる. 複数のペアの総利益は 1000%を超え,最初のリスクの 100 倍以上の最大取引利益.

リスク分析

過身長リスク

およそ"聖杯"のような結果があるため,これは過剰な市場のシミュレーションである可能性が高い.ライブ取引では,ストップがテストされたほど正確にトリガーされず,引き下げが起こる可能性があります.

また,短い2年間の試験期間では,実際の結果に影響を与えるような 構造的市場体制の変化が反映されない場合もあります.

遅延 停止 リスク

過剰に敏感なトレーリングストップ値は,過剰な望ましくないストップアウトを引き起こす可能性があります.突然の市場イベントは,トレーリングストップ損失オーダーも無効にすることができます.これらはトレーリングストップを使用することに関連した固有のリスクです.

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

トレイリングストップパラメータを調整する

遅延停止は 狂った収益性の鍵です 柔軟で信頼性の高いようにするには 遅延停止を緩めて過度に敏感にならないようにしてください

試験期間を延長することで,パラメータの安定性を調べることもできます.

MA 期間を最適化する

現在の MA 期間は,おそらく最適なパラメータセットではない.さらなる最適化は,さらに優れたパフォーマンスのためにより良い値を発見する可能性があります.

結論

ピアスピンバーの逆転戦略は 高効率の導入と極度の利益を得ることで 驚くべきバックテスト結果を達成しました しかし,我々は過剰なリスクも認識し,それに応じてリスク管理に備えなければなりません

適切なパラメータ調整または最適化によって,この戦略はライブ取引でかなりの利益をもたらし,強力なトレンドフォローシステムになり得ます.そのユニークなトレーリングストップコンセプトは,より革新的な戦略を引き起こす可能性のある貴重なインスピレーションを提供します.


/*backtest
start: 2023-12-01 00:00:00
end: 2023-12-31 23:59:59
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
//Time Frame: H1
strategy("Pin Bar Magic v1", overlay=true)

// User Input
usr_risk = input(title="Equity Risk (%)",type=input.integer,minval=1,maxval=100,step=1,defval=3,confirm=false)
atr_mult = input(title="Stop Loss (x*ATR, Float)",type=input.float,minval=0.1,maxval=100,step=0.1,defval=0.5,confirm=false)
slPoints = input(title="Stop Loss Trail Points (Pips)",type=input.integer,minval=1,maxval=1000,step=1,defval=1,confirm=false)
slOffset = input(title="Stop Loss Trail Offset (Pips)",type=input.integer,minval=1,maxval=1000,step=1,defval=1,confirm=false)
sma_slow = input(title="Slow SMA (Period)",type=input.integer,minval=1,maxval=500,step=1,defval=50,confirm=false)
ema_medm = input(title="Medm EMA (Period)",type=input.integer,minval=1,maxval=500,step=1,defval=18,confirm=false)
ema_fast = input(title="Fast EMA (Period)",type=input.integer,minval=1,maxval=500,step=1,defval=6,confirm=false)
atr_valu = input(title="ATR (Period)",type=input.integer,minval=1,maxval=500,step=1,defval=14,confirm=false)
ent_canc = input(title="Cancel Entry After X Bars (Period)",type=input.integer,minval=1,maxval=500,step=1,defval=3,confirm=false)

// Create Indicators
slowSMA = sma(close, sma_slow)
medmEMA = ema(close, ema_medm)
fastEMA = ema(close, ema_fast)
bullishPinBar = ((close > open) and ((open - low) > 0.66 * (high - low))) or ((close < open) and ((close - low) > 0.66 * (high - low)))
bearishPinBar = ((close > open) and ((high - close) > 0.66 * (high - low))) or ((close < open) and ((high - open) > 0.66 * (high - low)))
atr = atr(atr_valu)

// Specify Trend Conditions
fanUpTrend = (fastEMA > medmEMA) and (medmEMA > slowSMA)
fanDnTrend = (fastEMA < medmEMA) and (medmEMA < slowSMA)

// Specify Piercing Conditions
bullPierce = ((low < fastEMA) and (open > fastEMA) and (close > fastEMA)) or ((low < medmEMA) and (open > medmEMA) and (close > medmEMA)) or ((low < slowSMA) and (open > slowSMA) and (close > slowSMA))
bearPierce = ((high > fastEMA) and (open < fastEMA) and (close < fastEMA)) or ((high > medmEMA) and (open < medmEMA) and (close < medmEMA)) or ((high > slowSMA) and (open < slowSMA) and (close < slowSMA))
    
// Specify Entry Conditions
longEntry = fanUpTrend and bullishPinBar and bullPierce
shortEntry = fanDnTrend and bearishPinBar and bearPierce

// Long Entry Function
enterlong() =>
    risk = usr_risk * 0.01 * strategy.equity
    stopLoss = low[1] - atr[1] * atr_mult
    entryPrice = high[1]
    units = risk / (entryPrice - stopLoss)
    strategy.entry("long", strategy.long, units, stop=entryPrice)
    strategy.exit("exit long", from_entry="long", trail_points=slPoints, trail_offset=slOffset)
    
// Short Entry Function
entershort() =>
    risk = usr_risk * 0.01 * strategy.equity
    stopLoss = high[1] + atr[1] * atr_mult
    entryPrice = low[1]
    units = risk / (stopLoss - entryPrice)
    strategy.entry("short", strategy.short, units, stop=entryPrice)
    strategy.exit("exit short", from_entry="short", trail_points=slPoints, trail_offset=slOffset)
    
// Execute Long Entry
if (longEntry)
    enterlong()

// Execute Short Entry
if (shortEntry)
    entershort() 
    
// Cancel the Entry if Bar Time is Exceeded
strategy.cancel("long", barssince(longEntry) > ent_canc)
strategy.cancel("short", barssince(shortEntry) > ent_canc)

// Force Close During Certain Conditions
strategy.close_all(when = hour==16 and dayofweek==dayofweek.friday, comment = "exit all, market-closed")
strategy.close_all(when = crossunder(fastEMA, medmEMA), comment = "exit long, re-cross")
strategy.close_all(when = crossover(fastEMA, medmEMA), comment = "exit short, re-cross")

// Plot Moving Averages to Chart
plot(fastEMA, color=color.red)
plot(medmEMA, color=color.blue)
plot(slowSMA, color=color.green)

// Plot Pin Bars to Chart
plotshape(bullishPinBar, text='Bull PB', style=shape.labeldown, location=location.abovebar, color=color.green, textcolor=color.white, transp=0)
plotshape(bearishPinBar, text='Bear PB', style=shape.labelup, location=location.belowbar, color=color.red, textcolor=color.white, transp=0)

// Plot Days of Week
plotshape(hour==0 and dayofweek==dayofweek.monday, text='Monday', style=shape.labeldown, location=location.abovebar, color=color.black, textcolor=color.white, transp=0)
plotshape(hour==0 and dayofweek==dayofweek.tuesday, text='Tuesday', style=shape.labeldown, location=location.abovebar, color=color.black, textcolor=color.white, transp=0)
plotshape(hour==0 and dayofweek==dayofweek.wednesday, text='Wednesday', style=shape.labeldown, location=location.abovebar, color=color.black, textcolor=color.white, transp=0)
plotshape(hour==0 and dayofweek==dayofweek.thursday, text='Thursday', style=shape.labeldown, location=location.abovebar, color=color.black, textcolor=color.white, transp=0)
plotshape(hour==0 and dayofweek==dayofweek.friday, text='Friday', style=shape.labeldown, location=location.abovebar, color=color.black, textcolor=color.white, transp=0)
plotshape(hour==16 and dayofweek==dayofweek.friday, text='Market Closed', style=shape.labeldown, location=location.abovebar, color=color.black, textcolor=color.white, transp=0)









もっと