과도한 구역 전략

저자:차오장, 날짜: 2023-12-29 17:03:27
태그:

img

전반적인 설명

임시 구역 전략은 가격 변동 구역을 기반으로 한 단기 거래 전략이다. 특정 기간 내에 가격으로 형성된 변동 구역을 사용하여 시장 동향을 판단하고 구역이 침투 할 때 입장을 취한다.

전략 논리

전략은 가격 변동 구역을 구성하기 위해 지난 N 촛불의 가장 높고 가장 낮은 가격을 계산합니다. 최신 촛불이 이 구역을 침투하면 트렌드 역전이 발생했다고 판단하고 거래 신호를 생성합니다.

구체적으로, 전략은 N 개의 마지막 촛불의 가장 높고 가장 낮은 가격을 지속적으로 추적합니다 (조정 가능한 매개 변수 N),

  • 최저 가격 = 지난 N 개의 촛불에서 가장 낮은 점
  • 가장 높은 가격 = 지난 N 개의 촛불에서 가장 높은 점

이것은 가격 변동 영역을 구성합니다.

최신 촛불의 닫기 가격이 지대의 최고 가격보다 높을 때, 지대가 침투되었다는 신호를 보내고, 긴 신호를 생성합니다. 닫기 가격이 지대의 최저 가격보다 낮을 때, 지대가 침투되었다는 신호를 보내고, 짧은 신호를 생성합니다.

또한, 전략은 또한 색상 및 몸 필터를 포함합니다. 색상 필터는 촛불의 색상을 기반으로 신호를 필터합니다. 몸 필터는 촛불 몸의 크기를 기반으로 신호를 필터합니다. 이것은 일부 잘못된 신호를 필터링하는 데 도움이됩니다.

장점

이 전략은 다음과 같은 장점을 가지고 있습니다.

  1. 가격 영역을 캡처하고 정확한 긴/단기 엔트리를위한 트렌드 반전 지점을 결정합니다.
  2. 색상 과 신체 필터 는 거짓 신호 를 필터링 하는 데 도움 이 된다
  3. 간단하고 명확한 전략 논리, 이해하기 쉽고 매개 변수를 조정
  4. 많은 조정 가능한 매개 변수로 전략을 최적화 할 수 있습니다.

위험성

이 전략은 또한 몇 가지 위험을 안고 있습니다.

  1. 부적절한 매개 변수 설정으로 인해 과잉 거래 및 높은 수수료가 발생할 수 있습니다.
  2. 잘못된 구역 범위 설정은 너무 많은 잘못된 브레이크아웃 신호를 생성할 수 있습니다.
  3. 시장의 격렬한 변동 중 가격 영역 예측 능력이 떨어집니다.
  4. 가격 격차를 처리 할 수 없습니다.

이 위험은 구역 매개 변수를 조정하고 신호 필터를 최적화함으로써 줄일 수 있습니다.

최적화 방향

전략은 여러 방향으로 최적화 될 수 있습니다.

  1. 고정된 N 촛불 대신 가격 구역 범위를 동적으로 조정합니다.
  2. 손실을 제한하기 위해 스톱 로스 로직을 포함
  3. 신호 품질을 향상시키기 위해 필터 매개 변수를 최적화
  4. 가격 격차를 처리하기 위해 논리를 추가
  5. 신호를 판단하고 함정을 피하기 위해 여러 시간 프레임을 결합

결론

임시 구역 전략은 일반적으로 사용하기 쉬운 단기 거래 전략입니다. 가격 구역을 통해 트렌드 반전 지점을 결정하고 시장 기회를 빠르게 활용 할 수 있습니다. 또한 주목해야 할 몇 가지 위험이 있습니다. 수익성을 높이기 위해 매개 변수 조정 및 최적화로 추가 개선이 가능합니다.


/*backtest
start: 2023-11-28 00:00:00
end: 2023-12-28 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//Noro
//2018

//@version=2
strategy("Noro's Transient Zones Strategy v1.0", shorttitle = "TZ str 1.0", overlay=true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, pyramiding = 0)

//Settings 
needlong = input(true, defval = true, title = "Long")
needshort = input(true, defval = true, title = "Short")
capital = input(100, defval = 100, minval = 1, maxval = 10000, title = "Capital, %")

usecol = input(true, defval = true, title = "Use Color-Filter")
usebod = input(true, defval = true, title = "Use Body-Filter")

h_left = input(title = "H left", defval = 10)
h_right = -1
sample_period = input(title = "Sample bars for % TZ",  defval = 5000)
show_ptz = input(title = "Show PTZ", type = bool, defval = true)
show_channel = input(title = "Show channel", type = bool, defval = true)

fromyear = input(2018, defval = 2018, minval = 1900, maxval = 2100, title = "From Year")
toyear = input(2100, defval = 2100, minval = 1900, maxval = 2100, title = "To Year")
frommonth = input(01, defval = 01, minval = 01, maxval = 12, title = "From Month")
tomonth = input(12, defval = 12, minval = 01, maxval = 12, title = "To Month")
fromday = input(01, defval = 01, minval = 01, maxval = 31, title = "From day")
today = input(31, defval = 31, minval = 01, maxval = 31, title = "To day")

//By Jurij w/ TZ percent occurrence by SPYderCrusher

//barCount = nz(barCount[1]) + 1
//check history and realtime PTZ
h_left_low = lowest(h_left)
h_left_high = highest(h_left)
newlow = low <= h_left_low
newhigh = high >= h_left_high
plotshape(newlow and show_ptz, style=shape.triangledown, location=location.belowbar, color=red)
plotshape(newhigh and show_ptz, style=shape.triangleup, location=location.abovebar, color=green)
channel_high = plot(show_channel ? h_left_low : 0, color=silver)
channel_low = plot (show_channel ? h_left_high : 0, color=silver)

//check true TZ back in history
central_bar_low = low[h_right + 1]
central_bar_high = high[h_right + 1]
full_zone_low = lowest(h_left + h_right + 1)
full_zone_high = highest(h_left + h_right + 1)
central_bar_is_highest = central_bar_high >= full_zone_high
central_bar_is_lowest = central_bar_low <= full_zone_low
plotarrow(central_bar_is_highest ? -1 : 0, offset=-h_right-1)
plotarrow(central_bar_is_lowest ? 1 : 0, offset=-h_right-1)

//Color Filter
bar = close > open ? 1 : close < open ? -1 : 0

//Body Filter
nbody = abs(close - open)
abody = sma(nbody, 10)
body = nbody > abody / 3 or usebod == false

//Signals
up1 = central_bar_is_lowest and body and (bar == -1 or usecol == false)
dn1 = central_bar_is_highest and body and (bar == 1 or usecol == false)
exit = ((strategy.position_size > 0 and close > open) or (strategy.position_size < 0 and close < open)) and body

//Trading
lot = strategy.position_size == 0 ? strategy.equity / close * capital / 100 : lot[1]

if up1
    if strategy.position_size < 0
        strategy.close_all()
        
    strategy.entry("long", strategy.long, needlong == false ? 0 : lot, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))

if dn1
    if strategy.position_size > 0
        strategy.close_all()
        
    strategy.entry("Short", strategy.short, needshort == false ? 0 : lot, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
    
if time > timestamp(toyear, tomonth, today, 23, 59) or exit
    strategy.close_all()

더 많은