
이 전략은 다방면 상장할 때, 시스템은 즉시 공백을 낸다; 공백이 종료될 때, 즉시 더 많이 돌린다. 이 “얼굴을 뒤집는 것이 책 뒤집는 것보다 더 빠르다”의 설계는 전략이 충격적인 상황에서도 지속적으로 수익을 잡을 수 있도록 한다. 재검토 데이터에 따르면, 이 역전시장 메커니즘은 전통적인 단방식 전략보다 약 30%의 공백 시간을 줄였다.
숫자가 작다는 것을 무시하고, 30주기 평균값을 기반으로 한 비율은 고정 점수보다 더 과학적입니다. 0.45%의 중지 손실은 금의 약 8-10 달러의 변동, 0.60%의 중지 손실은 약 12-15 달러에 해당합니다. 더 똑똑한 것은 재입입 메커니즘입니다.
ATR이 0.2 기한 이하일 때, 전략은 10분 냉각 기간에 들어가 모든 새로운 신호를 거부한다. 이 설계는 매우 중요합니다. 낮은 변동 환경에서는 거래를 강요하는 것은 돈을 보내는 것보다 더 낫다. 동시에, K선 엔티티가 5주기 ATR의 2배를 초과할 때, 전략은 일시 중지되어 비정상적인 변동을 피한다. 데이터는 두 가지 필터가 승률을 효과적으로 향상시킬 수 있음을 증명한다.
왼쪽의 4개의 K선, 오른쪽의 2개의 K선의 중심축 설정은 고전적인 5-5 변수보다 더 급진적이다. 이것은 전략이 전환점을 더 일찍 식별할 수 있다는 것을 의미하지만, 또한 더 많은 가짜 돌파의 위험을 감수한다. 50주기 평균선 트렌드 필터와 협력하여, 가격이 평균선보다 높을 때만 다중 중심축 낮은 지점을 만들고, 평균선보다 낮을 때 빈 중심축 높은 지점을 만든다. 이러한 조합은 추세 상황에서 더 잘 작동한다.
정지 후 50%의 확률로 반전하여 입장을 열고, 50%의 확률로 다시 진입한다. 이 디자인은 재미있지만 위험하다. 이점은 트렌드 반전의 초기 단계에서 빠르게 조정할 수 있다는 점이며, 단점은 가짜 돌파구에서 돌아서서 맞설 수 있다는 점이다. 코드에서 볼 때, 이 무작위성은 bar_index 계산에 기반하여 일정 규칙성을 가지고 있다.
전략은 두 가지 상황을 가장 두려워한다: 초저 변동의 가로판과 초고 변동의 일방적인 상황. 전자는 냉각 장치가 거래를 자주 중단시키는 것을 촉발시키고, 후자는 큰 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)