
이 전략은 시장이 극도로 하락할 때 통계적 특성을 기반으로 거래한다. 철회에 대한 통계적 분석을 통해 표준 차이를 사용하여 시장의 변동의 극도를 측정하고, 시장이 정상적인 범위를 초과하는 하락이 발생할 때 구매한다. 전략의 핵심 아이디어는 시장의 공포 감정으로 인한 초하락 기회를 포착하고, 수학적인 통계적 방법을 통해 시장의 비합리적인 행동으로 인한 투자 기회를 식별하는 것이다.
이 전략은 가격의 최대 회수와 회수 수치를 계산하는 점수를 Rolling Time Window로 사용합니다. 우선 지난 50주기의 최고 가격을 계산하고, 그 다음에는 현재 폐장 가격에 대한 최고 가격의 회수 비율을 계산합니다. 그 다음에는 회수의 평균값과 표준 차이를 계산하고, 트리거 마이너스로 표준 차이의 1배를 설정합니다. 시장의 회수가 평균값을 초과하면 표준 차이는 설정된 배수를 제거하여 시장이 초과할 수 있음을 나타냅니다.
이 전략은 통계학적인 방법을 통해 시장의 오버박스 기회를 포착하고, 좋은 이론적 기초와 실용적 가치를 갖는다. 전략 논리는 간단하고 명확하며, 매개 변수는 조정성이 강하며, 기본 전략으로 확장 및 최적화를 위해 적합하다. 다른 기술 지표와 위험 제어 조치를 추가함으로써 전략의 안정성과 수익성을 더욱 향상시킬 수 있다. 실장 거래에서는 시장 환경과 거래 품종의 특성을 결합하여 신중하게 매개 변수를 설정하고, 위험을 잘 제어하는 것이 좋습니다.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-11-28 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Buy When There's Blood in the Streets Strategy", overlay=false, shorttitle="BloodInTheStreets")
//This strategy identifies opportunities to buy during extreme market drawdowns based on standard deviation thresholds.
//It calculates the maximum drawdown over a user-defined lookback period, identifies extreme deviations from the mean,
//and triggers long entries when specific conditions are met. The position is exited after a defined number of bars.
// User Inputs
lookbackPeriod = input.int(50, title="Lookback Period", minval=1, tooltip="Period to calculate the highest high for drawdown")
stdDevLength = input.int(50, title="Standard Deviation Length", minval=1, tooltip="Length of the period to calculate standard deviation")
stdDevThreshold = input.float(-1.0, title="Standard Deviation Threshold", tooltip="Trigger level for long entry based on deviations")
exitBars = input.int(35, title="Exit After (Bars)", minval=1, tooltip="Number of bars after which to exit the trade")
// Drawdown Calculation
peakHigh = ta.highest(high, lookbackPeriod)
drawdown = ((close - peakHigh) / peakHigh) * 100
// Standard Deviation Calculation
drawdownStdDev = ta.stdev(drawdown, stdDevLength)
meanDrawdown = ta.sma(drawdown, stdDevLength)
// Define Standard Deviation Levels
stdDev1 = meanDrawdown - drawdownStdDev
stdDev2 = meanDrawdown - 2 * drawdownStdDev
stdDev3 = meanDrawdown - 3 * drawdownStdDev
// Plot Drawdown and Levels
plot(drawdown, color=color.red, linewidth=2, title="Drawdown (%)")
plot(meanDrawdown, color=color.blue, linewidth=2, title="Mean Drawdown")
plot(stdDev1, color=color.green, linewidth=1, title="1st Std Dev")
plot(stdDev2, color=color.orange, linewidth=1, title="2nd Std Dev")
plot(stdDev3, color=color.purple, linewidth=1, title="3rd Std Dev")
// Entry Condition
var float entryBar = na
goLong = drawdown <= meanDrawdown + stdDevThreshold * drawdownStdDev
if (goLong and strategy.position_size == 0)
strategy.entry("Long", strategy.long)
entryBar := bar_index
// Exit Condition
if (strategy.position_size > 0 and not na(entryBar) and bar_index - entryBar >= exitBars)
strategy.close("Long")