상향 트렌드 및 과잉 판매 인덱스 스윙 거래 시스템 전략

저자:차오장, 날짜: 2023-09-11 11:35:33
태그:

I11L 하이퍼트렌드와 함께 라이딩 트렌드 및 평균 반전

I11L 하이퍼트렌드 전략은 여러 시간 프레임에 걸쳐 모멘텀 스코어 시스템을 활용하여 과판 수준과 거래 상승 추세를 식별합니다. 단기 반트렌드 반등 및 모멘텀 브레이크에서 이익을 얻는 것을 목표로합니다.

전략 의 효과

주요 구성 요소는 다음과 같습니다.

  • 20개 기간에 걸쳐 EMA/SMA를 비교하는 점수 시스템
  • 높은 점수는 상승 추세를 나타냅니다. 낮은 점수는 과잉 판매 상황을 나타냅니다.
  • 입구/출구 신호로 사용되는 점수의 크로스오버
  • 오픈 이윤을 보호하기 위한 트래일링 스톱 손실
  • 입시 가격에 기초한 고정 수익 목표

롱은 점수가 크로스오버될 때 과잉판매 역행에 입력됩니다. 쇼트는 점수가 상승 추세에 크로스오버될 때 취합니다.

트레일링 스톱은 이윤을 확보하고, 이윤 취득은 정의된 위험/이익 배수에서 종료됩니다.

I11L 시스템의 장점

이 접근법의 주요 장점:

  • 복합적인 의미 반전 및 추세를 따라
  • 점수는 변화하는 시장 조건에 적응합니다
  • 여러 시간 프레임이 전환점을 식별합니다
  • 트레일링 스톱은 무역 관리를 자동화합니다
  • 콤파운딩은 수익률을 높이고 강한 추세를 보이고 있습니다.

동적 점수 시스템은 역전과 브레이크오웃을 거래하는 데 귀중한 통찰력을 제공합니다.

잠재적 인 약점 과 위험성

그러나 몇 가지 제한 사항이 있습니다.

  • 과거 데이터에 대한 과도한 최적화 가능성이 있습니다.
  • 늦은 점수 및 늦은 신호 입력
  • 설정할 수 있는 여러 매개 변수
  • 불황의 시기에는 휘파람에 빠지기 쉽다
  • 높은 확률에 대한 거래 필터링이 없습니다.

과거 성능 측정은 앞으로 테스트되지 않으면 오해 할 수 있습니다. 신중한 최적화 및 위험 관리가 필요합니다.

키 튜닝 매개 변수

최적화 할 수있는 몇 가지 주요 입력:

  • 스코어 시스템에 있는 EMA/SMA의 수
  • 평균 기간의 길이는
  • 초판/상승 트렌드 교차 기준
  • 가격으로부터의 스톱 로스 거리
  • 수익 위험/이익 복수

탄탄한 전략은 황소, 곰 및 범위 제한 시장에서 성과를 균형 잡습니다. 엄격한 앞으로의 테스트는 곡선 적합성을 방지합니다.

요약

I11L 하이퍼트렌드는 과잉 판매 반등과 상승 브레이크에 대한 거래의 체계적인 프로세스를 제공합니다. 적절한 구성과 리스크 관리로, 이 추진력 접근법은 장기적으로 우위를 확보 할 수 있습니다.


/*backtest
start: 2023-01-01 00:00:00
end: 2023-04-15 00:00:00
period: 8h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
// strategy("I11L Hypertrend",overlay=false, initial_capital=1000000,default_qty_value=1000000,default_qty_type=strategy.cash,commission_type=strategy.commission.percent,commission_value=0.00)
strategy.initial_capital=50000
tradingMode = input.string("Oversold or Trend", "Trading Mode", ["Oversold or Trend", "Always Buy"], tooltip="Choose the Trading Mode by trying Both in your Backtesting. I use it if one is far better then the other one.")
 
invertStrategy = tradingMode == "Trend" ? true : false
compoundingMode = input.bool(false,"Work with the total equity")
useTSL = input.bool(true,"Use a trailing SL")
useTP = input.bool(true,"Use a TP")
scoreLookbackDistance = input.int(20, step=1,title="Lookbackdistance for the Score")
scoreLoopCountTo = 20
leverage = input.float(1.0,"Leverage (x)",[20,10,5,2,1])
SL_Factor = 1 - input.float(3.0,"Risk Capital per Trade unleveraged (%)", minval=0.1, maxval=100, step=0.25) / 100 / leverage
TPFactor = input.float(1.2, step=0.1)

chooseDate = input.string(title="Select Date", defval="All available Records", options=["Start-2012","2012-Now","All available Records"],tooltip="Seperation works best for 8hr cfd markets, you might want to finetune your Settings in the past and see if the future results (2010 to now) are better then random")
dateFrom = chooseDate == "Start-2012" ? timestamp("01 Jan 1970 00:00") : chooseDate == "2012-Now" ? timestamp("01 Jan 2012 00:00") : timestamp("01 Jan 1970 00:00")
dateTo = chooseDate == "Start-2012" ? timestamp("31 Dec 2011 23:59") : chooseDate == "2012-Now" ? timestamp("31 Dec 2170 23:59") : timestamp("31 Dec 2170 23:59")
inDateRange = (time >= dateFrom) and (time < dateTo)

var disableAdditionalBuysThisDay = false
var minuteOfLastSell = 0


if(dayofmonth != dayofmonth[1])
    disableAdditionalBuysThisDay := false


longStopPrice = 0.0
longStopPrice := if (strategy.position_size > 0)
    if(useTSL)
        math.max(high * SL_Factor, longStopPrice[1])
    else
        strategy.position_avg_price*SL_Factor
else
    0

if(strategy.position_size != strategy.position_size[1])
    disableAdditionalBuysThisDay := true

//Trade Logic
//isOversold
SCORE = 0
loopCount = 1
for i=0 to scoreLoopCountTo
    trendLengthAdjusted = loopCount
    loopCount := loopCount + 1 
    if(ta.ema(close,trendLengthAdjusted) / ta.sma(close,trendLengthAdjusted) > 1)
        SCORE := SCORE + 1
 
SCORE_ema50 = ta.ema(SCORE,scoreLookbackDistance)
SCORE_sma50 = ta.sma(SCORE,scoreLookbackDistance)
isOversold = ta.crossover(SCORE_sma50 / SCORE_ema50,1.0)
isTrend = ta.crossover(SCORE_ema50 / SCORE_sma50,1.0)


isBuy = isTrend or isOversold or tradingMode == "Always Buy"


if(isBuy and not(disableAdditionalBuysThisDay) and inDateRange)
    if(compoundingMode)
        strategy.entry("Buy", strategy.long, (strategy.equity / close) * leverage)
    else
        strategy.entry("Buy", strategy.long, (strategy.initial_capital / close) * leverage)


if(strategy.position_size > 0)
    strategy.exit("TSL", "Buy", stop=longStopPrice)
    if(useTP) 
        strategy.close("Buy",  when=close > strategy.position_avg_price * (1 + (1 - SL_Factor) * TPFactor), comment="TP")


findTrendOrOversold(i) => ta.ema(close,i) / ta.sma(close,i)

plot(1 + 100 * (findTrendOrOversold(1) - 1),color = findTrendOrOversold(1) > 1 ? #6efa7b44 : #ff222244)
plot(1 + 100 * (findTrendOrOversold(2) - 1),color = findTrendOrOversold(2) > 1 ? #73fa7a44 : #ff302244)
plot(1 + 100 * (findTrendOrOversold(3) - 1),color = findTrendOrOversold(3) > 1 ? #78fb7944 : #ff3a2244)
plot(1 + 100 * (findTrendOrOversold(4) - 1),color = findTrendOrOversold(4) > 1 ? #7cfb7844 : #ff432244)
plot(1 + 100 * (findTrendOrOversold(5) - 1),color = findTrendOrOversold(5) > 1 ? #81fb7744 : #ff4b2244)
plot(1 + 100 * (findTrendOrOversold(6) - 1),color = findTrendOrOversold(6) > 1 ? #85fc7644 : #ff522344)
plot(1 + 100 * (findTrendOrOversold(7) - 1),color = findTrendOrOversold(7) > 1 ? #89fc7644 : #fe592444)
plot(1 + 100 * (findTrendOrOversold(8) - 1),color = findTrendOrOversold(8) > 1 ? #8dfc7544 : #fe602544)
plot(1 + 100 * (findTrendOrOversold(9) - 1),color = findTrendOrOversold(9) > 1 ? #91fc7444 : #fe662744)
plot(1 + 100 * (findTrendOrOversold(10) - 1),color = findTrendOrOversold(10) > 1 ? #95fd7344 : #fe6b2944)
plot(1 + 100 * (findTrendOrOversold(11) - 1),color = findTrendOrOversold(11) > 1 ? #99fd7344 : #fd712b44)
plot(1 + 100 * (findTrendOrOversold(12) - 1),color = findTrendOrOversold(12) > 1 ? #9dfd7244 : #fd762d44)
plot(1 + 100 * (findTrendOrOversold(13) - 1),color = findTrendOrOversold(13) > 1 ? #a1fd7144 : #fd7b3044)
plot(1 + 100 * (findTrendOrOversold(14) - 1),color = findTrendOrOversold(14) > 1 ? #a4fe7144 : #fd803244)
plot(1 + 100 * (findTrendOrOversold(15) - 1),color = findTrendOrOversold(15) > 1 ? #a8fe7044 : #fc853544)
plot(1 + 100 * (findTrendOrOversold(16) - 1),color = findTrendOrOversold(16) > 1 ? #abfe7044 : #fc8a3944)
plot(1 + 100 * (findTrendOrOversold(17) - 1),color = findTrendOrOversold(17) > 1 ? #affe6f44 : #fc8f3c44)
plot(1 + 100 * (findTrendOrOversold(18) - 1),color = findTrendOrOversold(18) > 1 ? #b2ff6f44 : #fc933f44)
plot(1 + 100 * (findTrendOrOversold(19) - 1),color = findTrendOrOversold(19) > 1 ? #b6ff6e44 : #fb984344)
plot(1 + 100 * (findTrendOrOversold(20) - 1),color = findTrendOrOversold(20) > 1 ? #b9ff6e44 : #fb9c4744) 

plot(invertStrategy ? SCORE_ema50 / SCORE_sma50 : SCORE_sma50 / SCORE_ema50, color=(invertStrategy and isTrend) or (not(invertStrategy) and isOversold) ? color.green : color.gray, linewidth=2)
plot(1,color=color.white)

더 많은