셔프트 출구 전략 v2.0

저자:차오장, 날짜: 2023-09-21 15:21:40
태그:

전반적인 설명

이 전략은 트렌드를 따르기 위해 변화된 가격으로 거래에 들어가고 종료합니다.

어떻게 작동 합니까?

  1. 이전 클로즈의 비율을 기준으로 변화된 가격을 계산합니다.

  2. 아래로 이동한 가격은 구매 라인이고, 위로 이동한 가격은 판매 라인입니다.

  3. 가격이 구매 라인을 때 장면을 입력합니다.

  4. 가격이 매출선에 도달하면 출구

장점

  • 수동 개입 없이 자동 추적 중지 손실/이익 취득
  • 매개 변수 최적화를 위한 사용자 정의 가능한 변동 비율
  • 길게는 거래 빈도를 줄일 뿐이야
  • 거래 시간 범위를 제한할 수 있습니다.

위험성

  • 트렌드 끝을 효과적으로 결정할 수 없습니다.
  • 시간 지연, 빠른 반전을 놓칠 수 있습니다.

최적화 방향

  • 다른 변동 비율 매개 변수를 테스트
  • 매개 변수 추가 설정 최적화
  • 추세에 기반한 동적 변화를 포함합니다.
  • 피라미드 건설을 고려해 보세요.

결론

이 전략은 자동 트레일 수익을 가져옵니다. 변경 된 입출 / 출출 레벨을 통해. 매개 변수 최적화 및 논리 향상으로 인한 추가 개선은 성능을 향상시킬 수 있습니다. 그러나 윙사 리스크는 관리해야합니다. 전반적으로 트렌드를 따르는 거래에 대한 간단하고 실용적인 접근법.


/*backtest
start: 2022-09-14 00:00:00
end: 2023-09-20 00:00:00
period: 4d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//Noro
//2019

//@version=3
strategy(title = "Noro's ShiftEx Strategy v2.0", shorttitle = "ShiftEx 2.0", overlay = true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, pyramiding = 0)

//Settings
buy = input(-10.0, title = "Buy, src-%")
sell = input(0.0, title = "Sell, src+%")
buysrc = input(low, title = "Source for buy")
sellsrc = input(ohlc4, title = "Source for sell")
offset = input(true)
fromyear = input(1900, defval = 1900, 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")

//Levels
bar = close > open ? 1 : close < open ? -1 : 0
mult = 1 / syminfo.mintick
lb = bar == -1 ? buysrc + ((buysrc / 100) * (buy * 1)) : buysrc + ((buysrc / 100) * (buy * 2))
levelbuy = round(lb * mult) / mult
ls = sellsrc + ((sellsrc / 100) * sell)
levelsell = round(ls * mult) / mult

//Lines
os = offset ? 1 : 0
plot(levelbuy, offset = os, linewidth = 2, color = lime, title = "Buy")
plot(levelsell, offset = os, linewidth = 2, color = blue, title = "Sell")

//Trading
if low[1] > 0
    strategy.entry("long", strategy.long, limit = levelbuy, when = (time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
    strategy.entry("close", strategy.short, 0, limit = levelsell, when = (time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))

더 많은