
伝統的な枢軸戦略の止損は終了? この戦略は異なる。多頭止損時,システムはすぐに空を転がす;空頭止損時,すぐに回転する。この”顔を転がすより本を転がすより速く”の設計は,戦略が震動の状況でも継続的に利益を捕獲できるようにする。反転開店メカニズムは,伝統的な一方向戦略より約30%の空のポジション時間を減らすことを示している。
数字は小さいので,30周期平均価格に基づくパーセントデザインは固定ポイント数よりも科学的です。0.45%のストップは約8-10ドルの波動に対応し,0.60%のストップは約12-15ドルの波動に対応しています。より賢明なのが再入場メカニズムです:最初のストップ後に再入場を選択した場合,ストップ目標は0.30に低下し,ストップは0.20%に緊縮されます。この動態調整により,戦略は利益後により保守的です。
ATRが0.2の値を下回ると,戦略は10分間の冷却期に入り,すべての新しい信号を拒絶する.この設計は極めて重要である.低波動環境で強制的な取引は送金するより待つほうがよい.また,K線実体が5周期ATRの2倍を超えると,戦略は一時停止し,異常波動を回避する.データによれば,この2つのフィルターは,勝率を効果的に向上させる.
左側の4つのK線,右側の2つのK線の枢軸設定は,クラシック5-5のパラメータよりも激進である.これは,戦略が転換点をより早く認識することを意味するが,偽の突破のリスクもより多くを負うことを意味する.50周期平均線のトレンドフィルターと連携し,価格が平均線より高い場合にのみ多枢軸の低点を行い,平均線より低い場合に空枢軸の高点を行う.この組み合わせは,トレンドの状況でより良いパフォーマンスを発揮する.
ストップ後50%の確率で転倒して開場,50%の確率で再入場する.この設計は面白いが,危険でもある.好みは,トレンドの逆転初期に素早く調節できること,悪点は,偽突破で逆転することが可能である.コードから見ると,このランダム性は,bar_index計算に基づいている.一定の規則性がある.異なる市場環境でこのメカニズムの有効性をテストすることをお勧めする.
戦略は2つの状況を最も恐れます:超低波動の横盤と超高波動の単面行情.前者は冷却機構を誘発して取引を頻繁に停止し,後者は大K線フィルターによって簡単に遮断されます.最も適しているのは,日中の15-30ドルの通常の取引環境です.パラメータ設定からすると,これは金の現金または期貨量に合わせた戦略です.
逆転のメカニズムがあるにもかかわらず,継続的な偽の突破シグナルに遭遇すると,戦略は継続的な損失に直面する可能性があります.特に,重要な経済データが出版される前に,市場の感情の波動が枢軸シグナルを無効にすることがあります.単一のポジションを厳密に制御し,重要なイベントの前に手動で戦略を一時停止することをお勧めします.
/*backtest
start: 2024-09-24 00:00:00
end: 2025-09-22 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"ETH_USDT","balance":500000}]
*/
//@version=6
strategy("Gold By Ann v.2", overlay=true)
// --- Inputs ---
leftBars = input.int(4, "Pivot Lookback Left")
rightBars = input.int(2, "Pivot Lookback Right")
atrLength = input.int(14, "ATR Length")
atrMult = input.float(2.0, "ATR Multiplier")
atrThreshold = input.float(0.2, "ATR Threshold")
cooldownMinutes = input.int(10, "Cooldown Minutes")
// --- Pivot Calculation ---
ph = ta.pivothigh(leftBars, rightBars)
pl = ta.pivotlow(leftBars, rightBars)
ma = ta.sma(close, 50)
bullishTrend = close > ma
bearishTrend = close < ma
// --- Volatility (ATR) and Cooldown ---
atrValue = ta.atr(atrLength)
var float cooldownEnd = na
if atrValue < atrThreshold and na(cooldownEnd)
cooldownEnd := timenow + cooldownMinutes * 60 * 1000 // ms
if not na(cooldownEnd) and timenow > cooldownEnd
cooldownEnd := na
inCooldown = not na(cooldownEnd)
// --- Tall candle filter ---
rangeBar = high - low
isTall = rangeBar > ta.atr(5) * atrMult
// --- SL & TP based on % of 30-bar close ---
baseClose = ta.sma(close, 30) // 30-bar average close
slPercent = 0.0045 // 0.45%
tpPercent = 0.0060 // 0.60%
tpReEntryPercent = 0.006 // 0.30% (smaller TP after re-entry)
stopReEntryPercent = 0.005 // -0.20%
stopReEntryValue = baseClose * stopReEntryPercent
slValue = baseClose * slPercent
tpValue = baseClose * tpPercent
tpReValue = baseClose * tpReEntryPercent
// --- Re-entry state flag ---
var bool isReEntry = false
// --- Trade Logic (Only if NOT in cooldown) ---
if not inCooldown and not isTall
if strategy.position_size == 0
if not na(pl)
strategy.entry("PivExtLE", strategy.long, comment="Long")
isReEntry := false
if not na(ph)
strategy.entry("PivExtSE", strategy.short, comment="Short")
isReEntry := false
// =====================================================
// --- Take Profit / Stop Loss with auto-flip ---
// =====================================================
// LONG
if strategy.position_size > 0 and not isTall
entryPrice = strategy.position_avg_price
tpLevel = entryPrice + (isReEntry ? tpReValue : tpValue)
// Re-entry extra stop condition
if isReEntry and close <= entryPrice - stopReEntryValue
strategy.close("PivExtLE", comment="Stop Re-Entry Long (-0.20%)")
isReEntry := false
else if close >= tpLevel
strategy.close("PivExtLE", comment=isReEntry ? "TP Long (Re-Entry)" : "TP Long")
randChoice = (bar_index * 9301 + 49297) % 2
if randChoice == 0
strategy.entry("PivExtSE", strategy.short, comment="Flip to Short (TP)")
isReEntry := false
else
strategy.entry("PivExtLE", strategy.long, comment="Re-Enter Long (TP)")
isReEntry := true
else if close <= entryPrice - slValue
strategy.close("PivExtLE", comment="SL Long")
strategy.entry("PivExtSE", strategy.short, comment="Flip to Short (SL)")
isReEntry := false
// SHORT
if strategy.position_size < 0 and not isTall
entryPrice = strategy.position_avg_price
tpLevel = entryPrice - (isReEntry ? tpReValue : tpValue)
// Re-entry extra stop condition
if isReEntry and close >= entryPrice + stopReEntryValue
strategy.close("PivExtSE", comment="Stop Re-Entry Short (-0.20%)")
isReEntry := false
else if close <= tpLevel
strategy.close("PivExtSE", comment=isReEntry ? "TP Short (Re-Entry)" : "TP Short")
strategy.entry("PivExtLE", strategy.long, comment="Flip to Long (TP)")
isReEntry := true
else if close >= entryPrice + slValue
strategy.close("PivExtSE", comment="SL Short")
strategy.entry("PivExtLE", strategy.long, comment="Flip to Long (SL)")
isReEntry := false
// --- Plot reference ---
plot(slValue, title="SL Value (0.45% of 30-bar Close)", color=color.red)
plot(tpValue, title="TP Value (0.60% of 30-bar Close)", color=color.green)
plot(tpReValue, title="TP Value (Re-Entry 0.30%)", color=color.orange)