
이 전략은 RSI 지표와 평균 회귀 원리에 기반한 정량 거래 시스템이다. 시장의 과매매 상태를 식별하여 가격 변동 범위와 종결 가격 위치와 결합하여 시장의 역전 기회를 포착한다. 전략의 핵심 아이디어는 시장의 극단적 인 상태가 발생한 후 회귀 기회를 찾는 것이며, 엄격한 입시 조건과 동적 스톱로스를 설정하여 위험을 관리한다.
전략은 거래 신호를 결정하기 위해 여러 가지 필터링 메커니즘을 사용합니다. 첫째는 가격이 10 개의 주기적으로 새로운 최저를 만들어 시장이 과매매 상태에 있음을 나타냅니다. 둘째는 시장의 변동이 심화되는 것을 나타내는 당일 가격 변동 범위가 거의 10 거래일 동안 최대임을 요구합니다. 마지막은 종료 가격이 당일 가격 범위의 상위 4분의 1에 있는지 판단하여 잠재적인 반전을 확인합니다. 신호 입장은 브레이크 방식을 채택하고, 조건이 충족 된 후 2 거래 일 동안 가격이 이전 고치를 돌파하면 포지션을 열습니다.
이것은 구조가 완전하고, 논리가 명확한 평균값 회귀 전략이다. 다중 조건 필터링과 동적 중지 손실 관리를 통해, 전략은 위험을 통제하면서, 시장이 넘어가는 반발 기회를 효과적으로 포착할 수 있다. 비록 몇 가지 제한이 있지만, 합리적인 최적화 및 개선으로 전략의 전반적인 성능은 여전히 향상될 여지가 있다. 투자자가 실장에서 적용할 때, 특정 시장 특성과 자신의 위험 견딜 능력에 따라 매개 변수를 조정할 필요가 있다고 제안한다.
/*backtest
start: 2024-11-04 00:00:00
end: 2024-12-04 00:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Larry Conners SMTP Strategy", overlay=true, margin_long=100, margin_short=100)
// --- Inputs ---
// Corrected the input type declaration by removing 'type='
tickSize = input.float(0.01, title="Tick Size (e.g., 1/8 for stocks)")
// --- Calculate conditions ---
// 1. Today the market must make a 10-period low
low10 = ta.lowest(low, 10)
is10PeriodLow = low == low10
// 2. Today's range must be the largest of the past 10 bars
rangeToday = high - low
maxRange10 = ta.highest(high - low, 10)
isLargestRange = rangeToday == maxRange10
// 3. Today's close must be in the top 25 percent of today's range
rangePercent = (close - low) / rangeToday
isCloseInTop25 = rangePercent >= 0.75
// Combine all buy conditions
buyCondition = is10PeriodLow and isLargestRange and isCloseInTop25
// --- Buy Entry (on the next day) ---
var float buyPrice = na
var bool orderPending = false
var float stopLoss = na // Initialize stopLoss at the top level to avoid 'Undeclared identifier' errors
if (buyCondition and strategy.position_size == 0)
buyPrice := high + tickSize
stopLoss := low
orderPending := true
// Condition to place buy order the next day or the day after
if orderPending and ta.barssince(buyCondition) <= 2
strategy.entry("Buy", strategy.long, stop=buyPrice)
orderPending := false
// --- Stop-Loss and Trailing Stop ---
if (strategy.position_size > 0)
stopLoss := math.max(stopLoss, low) // Move stop to higher lows (manual trailing)
strategy.exit("Exit", from_entry="Buy", stop=stopLoss)
// --- Plotting ---
// Highlight buy conditions
bgcolor(buyCondition ? color.new(color.green, 50) : na)
//plotshape(series=buyCondition, location=location.belowbar, color=color.green, style=shape.labelup, text="Buy Setup")
// Plot Stop-Loss level for visualization
//plot(strategy.position_size > 0 ? stopLoss : na, color=color.red, linewidth=2, title="Stop-Loss Level")