MyQuant 트렌드 식별자 전략

저자:차오장, 날짜: 2024-02-22 16:04:04
태그:

img

전반적인 설명

마이 퀀트 트렌드 식별 전략 (MyQuant Trend Identifier Strategy) 은 매일 비트코인 거래를 위한 전략이다. 이동 평균과 가격의 1차 및 2차 계열 파생값을 계산하여 시장 트렌드를 식별하고 이에 따라 구매 및 판매 결정을 내린다.

전략 원칙

이 전략은 먼저 가격의 적응 이동 평균 (ALMA) 과 그 첫 번째 순위 및 두 번째 순위 파생 상품을 계산합니다. 첫 번째 순위 파생 상품은 가격의 변화율을 반영하고 두 번째 순위 파생 상품은 가격의 곡선을 반영합니다. 다음으로 현재 추세를 상향, 하향 또는 변동적이라고 판단합니다. 첫 번째 및 두 번째 순위 파생 상품의 가치에 따라. 주식 지표와 결합하여 구매 또는 판매 조건이 충족되었는지 여부를 결정합니다.

특히 전략은 다음의 지표를 계산합니다.

  • ALMA: 가격의 적응적인 이동 평균, 길이 140, 빠른 인수 1.1, 시그마 6
  • dema: ALMA의 첫 번째 계열 파생물
  • d2ema: 가격의 두 번째 순위의 파생자를 반영하는 dema의 첫 번째 순위 파생자
  • 지수: 데마 지표의 오스실레이션 지수
  • ind: 가격의 이동평균의 오차 지수

구매 조건이 충족되면 CAUSED 축적/분배 대역 및 CAUSED 노출 상위 및 하위 탐색기의 신호에 따라 구매할 주식의 수를 계산합니다. 판매 조건이 충족되면 현재 모든 지위를 판매합니다.

전략 의 장점

트렌드 및 지표 판단을 결합함으로써이 전략은 시장 트렌드의 전환점을 효과적으로 식별 할 수 있습니다. 트렌드를 결정하기 위해 가격의 1 차 및 2 차 계열 파생물을 사용하면 가격 변동의 영향을 피하고 신호를 더 명확하게 만듭니다. 일반적인 이동 평균 전략과 비교하면 더 높은 정확성과 같은 장점이 있습니다.

위험 분석

이 전략은 거래 시간 기간 및 매개 변수 조정의 선택에 매우 민감합니다. 시간 기간이 잘못 선택되고 중요한 가격 전환점이 커버되지 않으면 전략은 매우 효과적이지 않습니다. 지표 매개 변수가 잘못 설정되면 구매 및 판매 신호는 소음에 더 영향을 받으며 전략 수익에 영향을 미칩니다. 또한 전략에 미리 설정된 스톱 로스 조건은 최종 수익에도 영향을 미칩니다.

최적화 위한 지침

이 전략은 다음 측면에서 더 이상 최적화 될 수 있습니다.

  1. 역 테스트와 실시간 거래 기간을 더 똑똑하게 선택함으로써 시간 기간을 선택하는 논리를 최적화하십시오.
  2. ALMA와 dema의 길이를 조정하는 것과 같은 지표 매개 변수를 최적화합니다.
  3. 최대 손실을 제어하기 위해 스톱 손실 조건 판단을 추가합니다.
  4. 다양한 암호화폐에 대한 효과를 평가하고 가장 좋은 성능을 보이는 것을 선택하세요.

결론

가격의 적응적인 이동 평균의 1차 및 2차 계열 파생자를 계산함으로써, MyQuant 트렌드 식별 전략은 비트코인의 시장 추세를 효과적으로 식별하고 그에 따른 구매 및 판매 결정을 내린다. 판단을 위한 여러 지표를 결합함으로써, 신호에 대한 과도한 노이즈 간섭을 피한다. 시간 및 매개 변수를 추가적으로 최적화하면, 이 전략의 성능을 더욱 향상시킬 수 있다.


/*backtest
start: 2023-02-15 00:00:00
end: 2024-02-21 00:00:00
period: 1d
basePeriod: 1h
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/
// © spacekadet17
// 
//@version=5

strategy(title="Trend Identifier Strategy", shorttitle="Trend Identifier Strategy", format=format.price, precision=4, overlay = false, initial_capital = 1000, pyramiding = 10, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, commission_type = strategy.commission.percent, commission_value = 0.03)

//start-end time
startyear = input.int(2020,"start year")
startmonth = input.int(1,"start month")
startday = input.int(1,"start day")
endyear = input.int(2025,"end year")
endmonth = input.int(1,"end month")
endday = input.int(1,"end day")

timeEnd = time <= timestamp(syminfo.timezone,endyear,endmonth,endday,0,0)
timeStart = time >= timestamp(syminfo.timezone,startyear,startmonth,startday,0,0)
choosetime = input(false,"Choose Time Interval")
condTime = (choosetime ? (timeStart and timeEnd) : true)

// time frame?
tfc = 1
if timeframe.isdaily
    tfc := 24

// indicators: price normalized alma, and its 1st and 2nd derivatives
ema = ta.alma(close,140,1.1,6)
dema = (ema-ema[1])/ema
stodema = ta.ema(ta.ema(ta.stoch(dema,dema,dema,100),3),3)

d2ema = ta.ema(dema-dema[1],5)
stod2ema = ta.ema(ta.ema(ta.stoch(d2ema,d2ema,d2ema,100),3),3)

ind = (close-ta.ema(close,120*24/tfc))/close
heat = ta.ema(ta.stoch(ind,ind,ind,120*24/tfc),3)
index = ta.ema(heat,7*24/tfc)

//plot graph
green = color.rgb(20,255,100)
yellow = color.yellow
red = color.red
blue = color.rgb(20,120,255)
tcolor = (dema>0) and (d2ema>0)? green : (dema>0) and (d2ema<0) ? yellow : (dema < 0) and (d2ema<0) ? red : (dema < 0) and (d2ema>0) ? blue : color.black
demaema = ta.ema(dema,21)
plot(demaema, color = tcolor)

//strategy buy-sell conditions
cond1a = strategy.position_size <= 0
cond1b = strategy.position_size > 0

if (condTime and cond1a and ( ( ((tcolor[1] == red and demaema<0.02) or (tcolor[1] == blue and demaema < 0.02) or (tcolor[1] == yellow and demaema>-0.02) ) and tcolor == green) or (tcolor[1] == red and tcolor == blue and demaema < -0.01) ) and index<85 and ind<0.4)
    strategy.entry("buy",strategy.long, (strategy.equity-strategy.position_size*close)/1/close)
    
if (condTime and cond1b and ( (((tcolor[1] == yellow and demaema > -0.02) or (tcolor[1] == blue and demaema < 0.02) or (tcolor[1] == green and demaema < 0.02)) and tcolor == red) or (tcolor[1] == green and tcolor == yellow and demaema > 0.015) ) and index>15 and ind>-0.1)
    strategy.order("sell",strategy.short, strategy.position_size)


더 많은