추세 반전 전략


생성 날짜: 2026-02-28 11:10:30 마지막으로 수정됨: 2026-03-06 14:15:32
복사: 8 클릭수: 135
avatar of ianzeng123 ianzeng123
2
집중하다
413
수행원

추세 반전 전략 추세 반전 전략

트렌드 리버팅 전략

ATR, L1, ADAPTIVE, BREAKEVEN, PARTIAL_TP

이것은 일반적인 트렌드 추적 전략이 아니라, “얼굴을 뒤집는” 지능형 시스템입니다.

대부분의 트렌드 전략은 흔들리는 시장에서 반복적으로 부딪히지만, 이 전략은 핵심 문제를 직접적으로 해결합니다.트렌드가 바뀌면 즉시 역전합니다.단순한 손해배상 피드백이 아닌, 다중체에서 공체로 직접 전환하고 공체에서 공체로 직접 전환한다. 이러한 설계는 회고에서 더 높은 자금 활용 효율을 나타낸다.

L1 적응 필터: 전통적인 이동 평균보다 0.6주기 빠르다

이 전략의 핵심은 L1 근접 필터입니다.자기 적응률이 0.6이고, ATR 배수는 1.5배입니다.이 필터는 200주기 ATR의 1.5배 이상의 가격변동이 있을 때만 반응한다는 것을 의미한다. 이 디자인은 전통적인 EMA보다 0.6주기 더 빨리 트렌드 변화를 인식하면서 60%의 시장소음을 필터링한다.

전통적인 이동 평균은 수동적으로 가격을 따릅니다. L1 필터는 적극적으로 추세를 예측합니다. 시장이 진정한 추세 전환이있을 때, 그것은 SMA보다 2-3 K 선보다 빨리 반응합니다.

세 가지 입시 모드: A 모드 승률이 가장 높고, B 모드 빈도가 가장 높고, C 모드 위험이 가장 낮다.

패턴 A (변화 추세): L1 필터로 트렌드 반전이 확인되기를 기다립니다. 약 65%의 성공률이지만 신호가 적습니다. 모델 B (가격이 통과): 가격이 필터 라인을 뚫을 때 진입, 신호 주파수는 A 모델보다 40% 높지만 가짜 뚫림 위험이 증가 모드 C (지속 확인)트렌드 변화 후 1회 진출, 가장 안정적인 승률, 하지만 최고의 진출점을 놓칠 수 있다.

실험적 자료에 따르면, 흔들림 시장은 A 패턴을 사용하는 것이 권장되며, 일방적인 트렌드 시장은 B1 서브모드에서 가장 잘 작동한다.

리플로직은 핵심 경쟁력: 투자 활용률이 80% 상승했다

하지만, 이 전략은 단순히 지분을 상쇄하는 것이 아니라,이제 다중을 제거하고 공백을 습니다.이 디자인은 트렌드 시장에서 두드러지게 나타납니다.

  • 전통적인 전략: 다중 헤드 중지→ 관측→ 재입장 공허 헤드 ((손실 2-3 사이클)
  • 뒤집기 전략: 다중 헤드→ 직접 빈 헤드 ((제로 지연 스위치)

회귀 메커니즘은 트렌드가 뚜렷한 시장에서 전통적인 방법보다 80% 더 높은 투자 활용도를 나타냅니다.

리스크 관리: 0.5%는 보장을 촉발하고, 2%는 부분적으로 멈추고, 수익은 손실로 변하지 않습니다.

보증제도부진이 0.5%에 도달했을 때, 스톱로스트가 자동으로 개시 가격 근처로 조정되어 수익에서 손실로 전환되지 않도록합니다. 부분적인 이자율이 2% 상승하면 자동으로 20%의 지분을 매각하고, 수익을 안심할 수 있다. ATR 동적 하락200: 주기적 ATR은 전략이 다른 시장의 변동성에 적응하도록 보장합니다.

리스크 관리 시스템의 핵심 아이디어는:작은 손실, 큰 이익, 결코 얻은 이윤을 버리지 않는다.

적용 시나리오는 명확하다: 트렌드 시장은 우수한 성적을 내고, 흔들리는 시장은 신중해야 한다.

최적의 환경

  • 일방적인 트렌드 시장 (부어/베어 시장)
  • 변동률이 중간된 품종 ((일일 변동 1~3%)
  • 유동성이 풍부한 주류 품종

사용 시나리오를 피하세요

  • 높은 주파수 진동의 작은 주기 ((5분 이하)
  • 매우 낮은 변동률의 가로 시장
  • 유동성이 낮은 소수 품종

매개 변수 설정 추천: 다양한 시장 환경에서의 최적의 구성

주식 시장: ATR 배수 1.5 자율 적응률 0.6 A 모드를 사용 암호화폐: ATR 배수 2.0, 자기 적응률 0.8, B1 모드를 사용
외환 시장:ATR 배수 1.2, 자기 적응률 0.5, A 모드를 사용

보본은 변동성이 높은 품종에는 1%를, 낮은 변동성이 있는 품종에는 0.3%를 사용한다.

위험 팁: 과거 회수와 미래 수익은 다르며, 엄격한 풍력 조절은 생존의 기본입니다.

명확한 위험

  • 시장의 흔들림으로 인해 소규모 손실이 발생할 수 있습니다.
  • 극단적인 상황에서는 가장 불리한 시점에 을 수 있습니다.
  • 슬라이드 포인트와 수수료가 실제 수익에 큰 영향을 미칠 수 있습니다.
  • 다른 시간대에서 매우 다른 성과를 보였습니다.

바람 제어 요구 사항

  • 한 번의 리스크 포트는 계좌의 2%를 초과하지 않습니다.
  • 3번의 연속 손실로 거래 중단
  • 매개 변수의 적합성을 주기적으로 확인한다
  • 단절을 엄격히 이행하고 주관적인 개입은 허용되지 않습니다.

이 전략의 본질은 인간의 약점을 알고리즘으로 대체하는 것이지만, 규칙에 따라 엄격하게 실행해야 한다는 것입니다.

전략 소스 코드
/*backtest
start: 2025-02-28 00:00:00
end: 2026-02-26 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BNB_USDT","balance":500000,"fee":[0,0]}]
*/

// © LuxAlgo — CC BY-NC-SA 4.0
//@version=6
strategy("Trend Strategy Flip",overlay=true)

// Colors
color BULL_COLOR = #089981
color BEAR_COLOR = #f23645

// Marker colors
color COL_LONG_ENTRY   = color.new(#00ff00, 0)
color COL_SHORT_ENTRY  = color.new(#ff0000, 0)
color COL_FLIP_LONG    = color.new(#00ff00, 0)
color COL_FLIP_SHORT   = color.new(#ff0000, 0)
color COL_TP_LONG      = color.new(#ffd700, 0)
color COL_TP_SHORT     = color.new(#ff8c00, 0)
color COL_BE           = color.new(#0066ff, 0)

// Inputs
srcInput      = input.source(close, "Source")
atrMultInput  = input.float(1.5, "ATR Multiplier")
muInput       = input.float(0.6, "Adaptation Rate (μ)")

entryMode    = input.string("A",  "Entry Mode",       options=["A","B","C"])
entrySubMode = input.string("B1", "Early Entry Type", options=["B1","B2"])

exitMode  = input.string("By Trend Change", "Exit Mode",
                         options=["By Trend Change","By Price Cross","Both"])
useLongs  = input.bool(true,  "Enable Longs")
useShorts = input.bool(true,  "Enable Shorts")

useBreakeven  = input.bool(true,  "Use Breakeven")
beTriggerPerc = input.float(0.5,  "BE Trigger %")
beOffsetPerc  = input.float(0.0,  "BE Offset %")

usePartialTP   = input.bool(true, "Use Partial TP")
tpPerc         = input.float(2.0, "TP % for Partial Close")
tpQtyPerc      = input.float(20.0, "Close % at TP")


// ---------------------------------------------------------
// L1 Filter
// ---------------------------------------------------------
float atr200    = ta.atr(200)
float threshold = atr200 * atrMultInput
var float z = na
var float v = 0.0

if bar_index == 0
    z := srcInput
else
    float zPrev = z[1]
    float vPrev = v[1]
    float zPred = zPrev + vPrev
    float zTemp = zPred + muInput * (srcInput - zPred)
    float diff  = zTemp - zPrev
    v := math.abs(diff) > threshold ? math.sign(diff)*(math.abs(diff)-threshold) : 0
    z := zPrev + v

// Trend
var int trend = 0
if z > z[1]
    trend := 1
else if z < z[1]
    trend := -1

bool upChange   = trend == 1 and trend[1] == -1
bool downChange = trend == -1 and trend[1] == 1

// ---------------------------------------------------------
// Entry logic
// ---------------------------------------------------------
bool longA  = upChange
bool shortA = downChange

bool longB1  = srcInput > z and srcInput[1] <= z[1]
bool shortB1 = srcInput < z and srcInput[1] >= z[1]

bool longB2  = v > 0 and v[1] <= 0
bool shortB2 = v < 0 and v[1] >= 0

bool longC  = upChange[1]
bool shortC = downChange[1]

bool longEntryRaw  = entryMode == "A" ? longA  : entryMode == "B" ? (entrySubMode == "B1" ? longB1  : longB2) : longC
bool shortEntryRaw = entryMode == "A" ? shortA : entryMode == "B" ? (entrySubMode == "B1" ? shortB1 : shortB2) : shortC

bool longEntry  = longEntryRaw  and useLongs
bool shortEntry = shortEntryRaw and useShorts

bool inLong  = strategy.position_size > 0
bool inShort = strategy.position_size < 0

// ---------------------------------------------------------
// Exit logic
// ---------------------------------------------------------
bool priceAbove = srcInput > z
bool priceBelow = srcInput < z

bool exitLong =
     exitMode == "By Trend Change" ? downChange :
     exitMode == "By Price Cross"  ? priceBelow :
                                     (downChange or priceBelow)

bool exitShort =
     exitMode == "By Trend Change" ? upChange :
     exitMode == "By Price Cross"  ? priceAbove :
                                     (upChange or priceAbove)

// ---------------------------------------------------------
// Breakeven levels
// ---------------------------------------------------------
float beLong  = na
float beShort = na

if useBreakeven and strategy.position_size != 0
    float entry = strategy.position_avg_price
    float profit = (close - entry) / entry * 100 * (inLong ? 1 : -1)

    if inLong and profit >= beTriggerPerc
        beLong := entry * (1 + beOffsetPerc / 100)

    if inShort and profit >= beTriggerPerc
        beShort := entry * (1 - beOffsetPerc / 100)

// ---------------------------------------------------------
// Flip logic (fixed HUD update)
// ---------------------------------------------------------
bool flipLongToShort = inLong and downChange
bool flipShortToLong = inShort and upChange

if flipLongToShort
    strategy.close("Long")
    strategy.entry("Short", strategy.short)


if flipShortToLong
    strategy.close("Short")
    strategy.entry("Long", strategy.long)


// ---------------------------------------------------------
// Entry tracking
// ---------------------------------------------------------
bool newLongEntry  = longEntry  and not inLong  and not inShort
bool newShortEntry = shortEntry and not inShort and not inLong

if newLongEntry
    strategy.entry("Long", strategy.long)


if newShortEntry
    strategy.entry("Short", strategy.short)


// ---------------------------------------------------------
// Breakeven exits
// ---------------------------------------------------------
if inLong and not na(beLong)
    strategy.exit("Long BE", from_entry="Long", stop=beLong)

if inShort and not na(beShort)
    strategy.exit("Short BE", from_entry="Short", stop=beShort)

// ---------------------------------------------------------
// Partial TP logic
// ---------------------------------------------------------
float tpLong  = na
float tpShort = na

if usePartialTP and strategy.position_size != 0
    float entry = strategy.position_avg_price
    if inLong
        tpLong := entry * (1 + tpPerc / 100)
    if inShort
        tpShort := entry * (1 - tpPerc / 100)

if usePartialTP
    if inLong and not na(tpLong)
        strategy.exit("Long TP Partial", from_entry="Long", limit=tpLong, qty_percent=tpQtyPerc)
    if inShort and not na(tpShort)
        strategy.exit("Short TP Partial", from_entry="Short", limit=tpShort, qty_percent=tpQtyPerc)

// ---------------------------------------------------------
// Previous position state
// ---------------------------------------------------------
bool wasLong  = strategy.position_size[1] > 0
bool wasShort = strategy.position_size[1] < 0

// ---------------------------------------------------------
// LuxAlgo Trend Visuals
// ---------------------------------------------------------
color zColor = trend == 1 ? BULL_COLOR : BEAR_COLOR

zPlot   = plot(z, "L1 Proximal Filter", color=zColor, linewidth=3)
srcPlot = plot(srcInput, "Source Plot", color=na)

bool showFill = (trend == 1 and srcInput > z) or (trend == -1 and srcInput < z)

color fillTopColor    = showFill ? color.new(zColor, 50)  : na
color fillBottomColor = showFill ? color.new(zColor, 100) : na

fill(srcPlot, zPlot, srcInput, z, fillTopColor, fillBottomColor, "Trend Fill")

float switchVal   = (upChange or downChange) ? z[1] : na
color switchColor = upChange ? BULL_COLOR : BEAR_COLOR

plot(switchVal, "Trend Switch Dot", color=switchColor, style=plot.style_circles, linewidth=4, offset=-1)

// ---------------------------------------------------------
// TP & BE lines (transparent, disappear when inactive)
// ---------------------------------------------------------
float tpLine = inLong ? tpLong : inShort ? tpShort : na
plot(tpLine, "TP Line", color=color.new(color.yellow, 60), style=plot.style_linebr, linewidth=2)

float beLine = inLong ? beLong : inShort ? beShort : na
plot(beLine, "BE Line", color=color.new(COL_BE, 60), style=plot.style_linebr, linewidth=2)

// ---------------------------------------------------------
// BE marker (simple & perfect)
// ---------------------------------------------------------
float beLinePrev = beLine[1]

bool beLongHit  = not na(beLinePrev) and na(beLine) and wasLong
bool beShortHit = not na(beLinePrev) and na(beLine) and wasShort

plotshape(beLongHit,  "Long BE Hit",  shape.square, location.belowbar, COL_BE, size=size.small)
plotshape(beShortHit, "Short BE Hit", shape.square, location.abovebar, COL_BE, size=size.small)

// ---------------------------------------------------------
// TP markers (only real partial exits)
// ---------------------------------------------------------
bool sizeReducedLong  = wasLong  and strategy.position_size < strategy.position_size[1] and strategy.position_size > 0
bool sizeReducedShort = wasShort and strategy.position_size > strategy.position_size[1] and strategy.position_size < 0

bool tpLongHit  = sizeReducedLong  and not na(tpLong)
bool tpShortHit = sizeReducedShort and not na(tpShort)

plotshape(tpLongHit,  "Long TP Partial Hit",  shape.circle, location.abovebar, COL_TP_LONG, size=size.small)
plotshape(tpShortHit, "Short TP Partial Hit", shape.circle, location.belowbar, COL_TP_SHORT, size=size.small)

// ---------------------------------------------------------
// Entry markers
// ---------------------------------------------------------
plotshape(longEntry,  "Long Entry",  shape.triangleup,   location.belowbar, COL_LONG_ENTRY,  size=size.small)
plotshape(shortEntry, "Short Entry", shape.triangledown, location.abovebar, COL_SHORT_ENTRY, size=size.small)

// ---------------------------------------------------------
// Flip markers
// ---------------------------------------------------------
plotshape(flipLongToShort, "Flip L→S", shape.diamond, location.abovebar, COL_FLIP_SHORT, size=size.small)
plotshape(flipShortToLong, "Flip S→L", shape.diamond, location.belowbar, COL_FLIP_LONG, size=size.small)

// ---------------------------------------------------------
// Alerts
// ---------------------------------------------------------
alertcondition(longEntry,        "Long Entry",        "TSF LONG ENTRY")
alertcondition(shortEntry,       "Short Entry",       "TSF SHORT ENTRY")
alertcondition(flipLongToShort,  "Flip Long→Short",   "TSF FLIP SHORT")
alertcondition(flipShortToLong,  "Flip Short→Long",   "TSF FLIP LONG")
alertcondition(tpLongHit,        "Long TP Partial",   "TSF LONG TP PARTIAL")
alertcondition(tpShortHit,       "Short TP Partial",  "TSF SHORT TP PARTIAL")
alertcondition(beLongHit,        "Long BE",           "TSF LONG BE")
alertcondition(beShortHit,       "Short BE",          "TSF SHORT BE")