삼각형 돌파 추세 추종 전략


생성 날짜: 2023-09-20 14:24:16 마지막으로 수정됨: 2023-09-20 14:24:16
복사: 0 클릭수: 623
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

개요

이 전략은 트렌드 추적 전략에 속한다. 가격이 상향 삼각형 모양을 뚫을 때 더 많이 하고, 빠른 EMA 아래에서 중간 EMA를 뚫을 때 청산한다. 동시에 위험을 제어하기 위해 중지 손실과 중지 지점을 설정한다.

전략 원칙

  1. 빠른 EMA와 중간 EMA를 사용하여 트렌드 방향을 판단한다. 빠른 EMA 위에 중간 EMA를 가로질러 시선 신호를 준다.

  2. 가장 가까운 N근 K선에서 가장 높은 가격과 가장 낮은 가격을 사용하여 위 삼각형이 형성되는지 판단하십시오. 삼각형이 형성되는 것은 다중 신호입니다.

  3. 시장에 진입한 후, 빠른 EMA가 중간 EMA를 넘어서면서 트렌드가 반전되었다고 생각하여 평점 신호를 낸다.

  4. 스톱로스는 입금 가격의 일정한 비율 아래로 설정하고, 스톱로스는 퇴출한다.

  5. 정지점은 입점 가격의 일정한 비율 위에 설정하고, 일부 정지점은 퇴출한다.

  6. 200일 EMA를 사용하여 전체 트렌드 방향을 판단하고, 트렌드가 상승했을 때만 동작한다.

우위 분석

  1. 삼각형 모양 필터를 사용하여 가짜 돌파를 사용하여 진입 정확도를 높인다.

  2. 빠른 EMA와 중간 EMA는 트렌드와 쇼크를 합리적으로 분할하여 을 피한다.

  3. 단독 손실을 제어할 수 있는 합리적인 스톱 및 스톱 설정

  4. 추세가 상승할 때만 조작하여 재조정 단계를 피할 수 있다.

위험 분석

  1. 삼각형 범위가 너무 작으면 트렌드를 놓칠 수 있고, 너무 크면 무의미한 거래를 증가시킬 수 있다. 최적화해야 하는 변수 N.

  2. 스톱피치에 너무 가까워지면 쉽게 타격할 수 있고, 너무 멀리 가면 손실을 조절하기 어렵다. 파라미터의 역할을 평가하고 최적화해야 한다.

  3. 일부 막을 잘못 설정하면 수익이 넘쳐날 수 있다. 합리적인 비율을 평가해야 한다.

  4. 트렌드 판단 지표 매개 변수가 적절하지 않으면 포지션 방향이 잘못될 수 있다. 여러 품종의 재검토 최적화가 필요하다.

최적화 방향

  1. 삼각형에서 정해진 N개의 변수를 최적화하여 최적값을 찾는다.

  2. 트렌드 판단의 정확성을 높이기 위해 다양한 EMA 주기 조합을 테스트합니다.

  3. 다양한 품종 특성에 따라 손해 차단 파라미터를 최적화한다.

  4. 다른 지표 판단을 추가하여 MACD 형태, 브린 띠 돌파구 등으로 신호 품질을 향상시킨다.

  5. 이 트렌드가 지속될 때 수익을 올리는 시간을 연장하기 위해 reopen 메커니즘을 추가합니다.

요약하다

이 전략은 전체적으로 안정적이며, 삼각형 판단을 통해 가짜 돌파구를 효과적으로 필터링할 수 있다. 변수 최적화 공간이 넓고, 더 나은 효과를 얻을 수 있다. 또한, 더 많은 보조 판단 지표를 추가하거나, 손실을 막는 전략을 개선하여 전략의 효과를 더욱 향상시킬 수 있다. 전체적으로, 이 전략은 우수한 트렌드 추적 전략이 될 잠재력을 가지고 있다.

전략 소스 코드
/*backtest
start: 2023-08-20 00:00:00
end: 2023-09-19 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © mohanee

//@version=4

strategy(title="TrianglePoint strategy", overlay=true,pyramiding=2, default_qty_value=3, default_qty_type=strategy.fixed,    initial_capital=10000, currency=currency.USD)
// variables  BEGIN

numPeriods=input(9,title="Number of Bars")
fastEMA = input(13, title="fast EMA", minval=1)
slowEMA = input(65, title="slow EMA", minval=1)

stopLoss = input(title="Stop Loss%", defval=5, minval=1)


HH = highest(close[1],numPeriods)
LL = lowest(close[1],numPeriods)
tringlePoint =  low > LL and high < HH

fastEMAval= ema(close, fastEMA)
slowEMAval= ema(close, slowEMA)
two100EMAval= ema(close, 200)

//plot emas
plot(fastEMAval, color = color.green, linewidth = 1, transp=0)
plot(slowEMAval, color = color.orange, linewidth = 1, transp=0)
plot(two100EMAval, color = color.purple, linewidth = 2, transp=0)

longCondition=fastEMAval>two100EMAval and tringlePoint

//plotshape(triP,style=shape.triangleup,text="Buy",color=color.green,location=location.belowbar)
//plotshape(longCondition,style=shape.triangleup,text="Buy",color=color.green,location=location.belowbar)

//Entry
strategy.entry(id="TBT LE", comment="TBT LE" , long=true,  when= longCondition and strategy.position_size<1)   

//Add
strategy.entry(id="TBT LE", comment="Add" , long=true,  when= longCondition and strategy.position_size>=1 and close<strategy.position_avg_price)   


//barcolor(strategy.position_size>=1 ? color.blue : na)

//Take profit
takeProfitVal=   strategy.position_size>=1 ?  (strategy.position_avg_price * (1+(stopLoss*0.01) )) : 0.00
//strategy.close(id="TBT LE", comment="Profit Exit",  qty=strategy.position_size/2,  when=close>=takeProfitVal and close<open and close<fastEMAval)   //crossunder(close,fastEMAval)
barcolor(strategy.position_size>=1  ? (close>takeProfitVal? color.purple : color.blue): na)

//Exit
strategy.close(id="TBT LE", comment="TBT Exit",   when=crossunder(fastEMAval,slowEMAval))


//stoploss
stopLossVal=   strategy.position_size>=1 ?  (strategy.position_avg_price * (1-(stopLoss*0.01) )) : 0.00

//stopLossVal= close> (strategy.position_avg_price * (1+(stopLoss*0.01) )) ? lowest(close,numPeriods) : (strategy.position_avg_price * (1-(stopLoss*0.01) ))


strategy.close(id="TBT LE", comment="SL Exit",   when= close < stopLossVal)