양적 모델에 기반한 고성능 알고리즘 거래 전략

저자:차오장, 날짜: 2023-12-22 13:14:33
태그:

img

전반적인 설명

이 전략은 양적 모델에 기반한 고성능 알고리즘 거래 전략이다. 모델리우스 볼륨 모델을 기본 모델로 사용하고 추가로 확장하고 최적화한다. 이 전략은 시장에서 양적 거래 기회를 포착하고 안정적인 이익을 얻을 수 있다.

전략 원칙

이 전략의 핵심은 모델리우스 볼륨 모델이다. 이 모델은 가격과 볼륨 변화를 감지하여 시장의 양적 거래 기회를 식별한다. 구체적으로, 전략은 현재 K 라인의 방향을 계산하기 위해 폐쇄 가격, 오픈 가격, 최고 가격, 최저 가격을 결합하여 특정 규칙을 기반으로 한다. K 라인 방향이 변경되면 거래량에 따라 양적 거래 기회의 품질이 판단된다. 또한, 전략은 또한 SAR 지표와 이동 평균 지표를 결합하여 입출 시기를 결정하는 데 도움이 된다.

기본 거래 논리는 지표가 음에서 양으로 돌파 할 때 길게 가고 지표가 양에서 음으로 돌파 할 때 짧게 이동하는 것입니다. 또한 위험 통제를 위해 스톱 로스, 영리, 트레일링 스톱 로스가 설정됩니다.

이점 분석

이 전략의 가장 큰 장점은 모델리우스 볼륨 모델이 양적 거래 기회를 효과적으로 식별 할 수 있다는 것입니다. 전통적인 기술 지표와 비교하면이 모델은 양변에 더 많은 관심을 기울이고 있으며, 이는 오늘날의 고주파량 양적 거래에서 매우 실용적입니다. 또한 전략의 입시 규칙은 상대적으로 엄격하여 양적 거래 기회를 놓치지 않도록 할 수 있으며, 장애의 가능성을 최대한 줄일 수 있습니다.

위험 분석

이 전략의 주요 위험은 모델리우스 볼륨 모델 자체가 소음을 완전히 피할 수 없다는 것입니다. 비정상적인 시장 변동이있을 때 잘못된 거래 신호로 이어질 것입니다. 또한 전략의 매개 변수 설정은 최종 결과에 영향을 줄 것입니다.

위험을 통제하기 위해 매개 변수를 적절히 조정하고 보조 판단을 위해 다른 지표와 결합 할 수 있습니다. 또한, 손실 중지 및 수익을 합리적으로 설정해야합니다.

최적화 방향

이 전략의 최적화를 위해 여전히 여지가 있습니다. 예를 들어, 기계 학습 알고리즘은 매개 변수 설정을 동적으로 최적화하는 것을 고려할 수 있습니다. 또는 감정 분석과 다른 지표를 결합하여 의사 결정의 정확성을 향상시킬 수 있습니다. 또한, 다양한 품종 간의 상관관계를 연구하여 다종류 중재 모델을 설정할 수 있습니다.

요약

요약하자면, 이 전략은 모델리우스 볼륨 양적 모델의 장점을 활용하고 높은 작동성을 가진 알고리즘 거래 전략의 세트를 설계합니다. 실제 거래에서 상대적으로 좋은 안정적인 수익을 얻기 위해 매개 변수 조정, 모델 확장, 기계 학습 등을 통해 추가로 최적화 및 향상시킬 수 있습니다.


/*backtest
start: 2022-12-15 00:00:00
end: 2023-12-21 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/


//@version=3
strategy(title="strategy modelius volume model ", shorttitle="mvm",overlay=true, calc_on_order_fills=true, default_qty_type=strategy.percent_of_equity, default_qty_value=50, overlay=false)

method = input(defval="ATR", options=["ATR", "Traditional", "Part of Price"], title="Renko Assignment Method")
methodvalue = input(defval=14.0, type=float, minval=0, title="Value")
pricesource = input(defval="Close", options=["Close", "Open / Close", "High / Low"], title="Price Source")
useClose = pricesource == "Close"
useOpenClose = pricesource == "Open / Close" or useClose
useTrueRange = input(defval="Auto", options=["Always", "Auto", "Never"], title="Use True Range instead of Volume")
isOscillating=input(defval=true, type=bool, title="Oscillating")
normalize=input(defval=false, type=bool, title="Normalize")
vol = useTrueRange == "Always" or (useTrueRange == "Auto" and na(volume))? tr : volume
op = useClose ? close : open
hi = useOpenClose ? close >= op ? close : op : high
lo = useOpenClose ? close <= op ? close : op : low

if method == "ATR"
    methodvalue := atr(round(methodvalue))
if method == "Part of Price"
    methodvalue := close/methodvalue

currclose = na
prevclose = nz(currclose[1])
prevhigh = prevclose + methodvalue
prevlow = prevclose - methodvalue
currclose := hi > prevhigh ? hi : lo < prevlow ? lo : prevclose

direction = na
direction := currclose > prevclose ? 1 : currclose < prevclose ? -1 : nz(direction[1])
directionHasChanged = change(direction) != 0
directionIsUp = direction > 0
directionIsDown = direction < 0

barcount = 1
barcount := not directionHasChanged and normalize ? barcount[1] + barcount : barcount
vol := not directionHasChanged ? vol[1] + vol : vol
res = barcount > 1 ? vol/barcount : vol


x=isOscillating and directionIsDown ? -res : res

TP = input(0) * 10
SL = input(0) * 10
TS = input(1) * 10
TO = input(3) * 10
CQ = 100

TPP = (TP > 0) ? TP : na
SLP = (SL > 0) ? SL : na
TSP = (TS > 0) ? TS : na
TOP = (TO > 0) ? TO : na

longCondition = crossover(x,0)
if (longCondition)
    strategy.entry("Long", strategy.long)


shortCondition = crossunder(x,0)
if (shortCondition)
    strategy.entry("Short", strategy.short)

strategy.exit("Close Short", "Short", qty_percent=CQ, profit=TPP, loss=SLP, trail_points=TSP, trail_offset=TOP)
strategy.exit("Close Long", "Long", qty_percent=CQ, profit=TPP, loss=SLP, trail_points=TSP, trail_offset=TOP)

더 많은