MyQuant 트렌드 식별 전략


생성 날짜: 2024-02-22 16:04:04 마지막으로 수정됨: 2024-02-22 16:04:04
복사: 2 클릭수: 633
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

MyQuant 트렌드 식별 전략

개요

MyQuant 트렌드 식별 전략은 비트코인 일일 거래에 사용되는 전략이다. 이 전략은 가격의 이동 평균과 그 1차 및 2차 변수를 계산하여 시장의 트렌드를 식별하고, 이에 따라 매매 결정을 내린다.

전략 원칙

이 전략은 우선 가격의 적응 이동 평균 ((ALMA) 과 그 1 단계 배역 및 2 단계 배역을 계산한다. 1 단계 배역은 가격 변화 속도를 반영하고, 2 단계 배역은 가격 곡선을 반영한다. 1 단계 및 2 단계 배역 값에 따라 현재 상승 추세, 하향 추세 또는 변동 기간에 있다고 판단한다.

특히, 전략은 다음과 같은 지표를 계산합니다.

  • ALMA: 가격의 적응 이동 평균, 길이는 140, 빠른 인수는 1.1, 시그마는 6
  • dema: ALMA의 1차함수
  • d2ema: dema의 1차 지수, 가격의 2차 지수를 반영
  • index: dema 지표의 흔들림 지수
  • ind: 가격의 평균에서 벗어난 지수

구매 조건이 충족되면 CAUSED.Accumulation/Distribution Bands 및 Caused Exposure Top and Bottom Finder 신호에 따라 구매 주식의 수를 계산한다. 판매 조건이 충족되면 전체 포지션을 판매한다.

전략적 이점

이 전략은 추세와 지표 판단을 결합하여 시장 추세 전환점을 효과적으로 식별할 수 있다. 가격의 1단과 2단 지수를 사용하여 추세를 판단하고, 가격 변동의 영향을 피하여 신호를 더 명확하게 만든다. 일반적인 이동 평균 전략에 비해 판단 정확도가 높은 장점이 있다.

위험 분석

이 전략은 거래 시간대의 선택과 파라미터 조정에 매우 민감하다. 시간대가 잘못 선택되어 중요한 가격 전환점을 포괄하지 못하면 전략의 효과가 좋지 않습니다. 지표 파라미터가 잘못 설정되면 구매 및 판매 신호가 더 많은 잡음으로 영향을 받아 전략 수익에 영향을 미칩니다. 또한 전략의 사전 중단 조건은 최종 수익에도 영향을 미칩니다.

최적화 방향

이 전략은 다음의 몇 가지 측면에서 더욱 개선될 수 있습니다.

  1. 시간대 선택 논리를 최적화하여 회수 및 실판 거래 시간대를 더 지능적으로 선택합니다.
  2. ALMA와 dema의 길이를 조정하는 등 지표 변수를 최적화한다.
  3. 최대 손실을 통제하기 위해 스톱 로즈 판단을 높여라.
  4. 다양한 암호화폐의 효과를 평가하고, 가장 잘하는 것을 선정한다.

요약하다

MyQuant 트렌드 인식 전략은 가격의 자율 이동 평균에 대한 1단계 및 2단계 지수를 계산하여 비트코인의 시장 동향을 효과적으로 식별하고 그에 따른 구매 및 판매 결정을 내립니다. 이 전략은 여러 지표와 결합하여 판단하여 신호가 과도한 잡음으로 방해받지 않도록합니다. 추가 시간 및 매개 변수 최적화를 통해 이 전략의 효과는 향상 될 수 있습니다.

전략 소스 코드
/*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)