
이 전략은 가격 변동의 정점을 인식하는 기반의 지능형 거래 시스템이다. 전략은 1시간 K선 그래프의 가격 변동을 모니터링하여 눈에 띄는 상승 또는 하락의 정점을 볼 때 거래 신호를 유발합니다. 시스템은 30,000 USDT의 고정 투자 금액을 채택하고 현재 시장 가격에 따라 거래 수를 자동으로 계산하여 자금을 최적화합니다.
전략의 핵심은 detect_spike 함수를 통해 가격 변동의 정점을 식별하는 것입니다. 가격이 0.62% 이상의 변동이 발생할 때 시스템은 유효한 거래 신호로 판단합니다. 구체적으로 다음을 포함한다:
이 전략은 엄격한 수학적 모델을 통해 시장 기회를 식별하고, 완벽한 위험 제어 시스템과 결합하여 안정적인 거래 수익을 달성합니다. 이 전략은 좋은 확장성과 최적화 공간을 가지고 있으며, 지속적인 개선으로 다양한 시장 환경에 적응할 수 있으며, 실용적인 가치가있는 정량 거래 전략입니다.
/*backtest
start: 2024-11-08 00:00:00
end: 2025-02-18 08:00:00
period: 3h
basePeriod: 3h
exchanges: [{"eid":"Binance","currency":"BTC_USDT"}]
*/
//@version=6
strategy("Spike Strategy 1h Optimized", overlay=true, margin_long=100, margin_short=100, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
// Fixed investment amount per trade (30,000 USDT)
fixed_investment = 30000
// Optimized parameters
spike_threshold = 0.62 // Spike threshold (0.80%)
profit_target = 0.42 // Take profit (0.48%)
stop_loss = 1 // Stop loss (10%)
// Function to detect spikes
detect_spike(threshold, close_price, high_price, low_price) =>
spike_up = (high_price - close_price) / close_price >= threshold / 100 // Bullish spike (high - close)
spike_down = (close_price - low_price) / close_price >= threshold / 100 // Bearish spike (close - low)
[spike_up, spike_down]
// Detecting spikes
[spike_up, spike_down] = request.security(syminfo.tickerid, "60", detect_spike(spike_threshold, close, high, low))
// Entry conditions
long_condition = spike_up and not spike_down // Only bullish spikes
short_condition = spike_down and not spike_up // Only bearish spikes
// Calculate the quantity to invest based on the current price
qty_long = fixed_investment / close
qty_short = fixed_investment / close
// Executing the orders
if (long_condition)
strategy.entry("Long", strategy.long, qty=qty_long)
if (short_condition)
strategy.entry("Short", strategy.short, qty=qty_short)
// Exiting orders with take profit and stop loss
if (strategy.position_size > 0)
strategy.exit("Take Profit Long", "Long", limit=strategy.position_avg_price * (1 + profit_target / 100), stop=strategy.position_avg_price * (1 - stop_loss / 100))
if (strategy.position_size < 0)
strategy.exit("Take Profit Short", "Short", limit=strategy.position_avg_price * (1 - profit_target / 100), stop=strategy.position_avg_price * (1 + stop_loss / 100))
// Plot spikes (optional)
plotshape(series=long_condition, title="Long Spike", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(series=short_condition, title="Short Spike", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")