구성 가능한 멀티 MA 크로스오버 투표 시스템

저자:차오장, 날짜: 2023-09-23 15:52:06
태그:

전반적인 설명

이 전략은 여러 개의 빠른 / 느린 이동 평균 쌍의 유연한 구성을 허용합니다. 모든 빠른 MA가 느린 MA보다 크로스 오버 할 때 길어지고 빠른 MA가 느린 MA보다 낮을 때 종료됩니다. 여러 MA와 함께 투표 메커니즘은 견고한 포지션 보유 결정을 형성하는 것을 목표로합니다.

전략 논리

주요 구성 요소와 규칙은 다음과 같습니다.

  1. 여러 개의 빠른/슬로우 MAs: SMA, WMA, VWMA 등을 사용한다.

  2. 긴 신호: 모든 빠른 MAs는 느린 MAs 위에 넘어가고 있습니다.

  3. 출구 신호: 느린 MA보다 빠른 MA를 가로질러

  4. 수익/손실 포인트: ATR에 기초한 고정 포인트.

  5. 구성 가능: 여러 MA 쌍의 유연한 구성.

다수의 MA를 가진 투표 기반 입력은 신호 신뢰성을 향상시킵니다. 사용자 지정 구성은 유연성을 제공합니다.

장점

단일 MA 전략과 비교하면 다음과 같은 장점이 있습니다.

  1. 여러 MA는 더 포괄적인 경향 평가를 제공합니다.

  2. 투표는 소음으로 인한 잘못된 신호를 피합니다.

  3. 커스텀 MA 구성에서 큰 조정 공간.

  4. 다양한 MA 유형에 대한 지원은 적응력을 향상시킵니다.

  5. 거래 리스크/보상별로 정의된 이익/손실 포인트 제어

  6. 더 긴 시간 내에 더 잘 작동합니다.

  7. 단순하고 직관적인 논리, 실행과 조작이 쉽다.

  8. 전체적으로 단일 MA에 비해 더 안정적이고 더 긴 수명입니다.

위험성

그러나 다음과 같은 위험 요소가 있습니다.

  1. 복수의 MAs로 복잡성이 증가합니다.

  2. 과도한 최적화의 위험.

  3. 트렌드 변화를 파악하는 데 근본적인 지연.

  4. 부피는 고려되지 않습니다. 함락될 위험이 있습니다.

  5. 이윤/손실 포인트는 불필요한 출구를 일으킬 수 있습니다.

  6. 변화하는 시장 체제에 따른 성과

  7. 보상/위험 비율과 곡선의 부드러움을 모니터링해야 합니다.

  8. 모든 도구에 대한 안정성은 검증을 필요로 합니다.

개선

분석에 따라 개선은 다음을 포함 할 수 있습니다.

  1. 다른 기기에 대한 매개 변수 견고성 테스트

  2. 부피 또는 변동성 확인 추가

  3. 이윤/손실 점수를 최적화합니다.

  4. 최대 용납 가능한 사용 한도를 설정합니다.

  5. 역동적인 위치 크기를 측정하는 모델을 구축합니다.

  6. 기계 학습을 도입하는 효과 평가.

  7. 최대 마감량과 곡선 부드러움을 모니터링합니다.

  8. 계속 반복해서 오버피팅을 피합니다.

결론

구성 가능한 멀티-MA 접근 방식은 견고한 포지션 보유 메커니즘을 형성합니다. 그러나 과도한 적합성과 변화하는 시장에 대한 역동적 적응을 방지하는 것이 모든 전략의 장기 생존의 핵심입니다. 엄격한 지속적인 최적화와 테스트를 통해만 양 전략이 성공을 유지할 수 있습니다.


/*backtest
start: 2022-09-16 00:00:00
end: 2023-09-22 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/
// © levieux

//@version=5
strategy(title='Configurable Multi MA Crossover Voting System', shorttitle='Configurable Multi MA Crossover Voting System', initial_capital=1000, overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=0.1)
crossoverConfig= input.string(defval="2x4,3x5,4x6", title="Crossover Config")
source= input.source(high)
maType= input.string("WMA", title="Moving Average Type", options=["WMA","SMA","VWMA"])
atrPeriod= input(14, title="ATR Period")
profitAtr = input(10, title="Profit ATR x")
lossAtr = input(5, title="Loss ATR x")


ma(src,length,type) => 
    float ma = switch type
	    "SMA" => ta.sma(src, length)
	    "WMA" => ta.wma(src, length)
	    "VWMA" => ta.vwma(src, length)

crossoverGroups= str.split(crossoverConfig, ",")
crossoverCount= array.size(crossoverGroups)
crossovers= array.new_string(crossoverCount)
positions= array.new_int(crossoverCount, 0)
longVotes= 0
for i= 0 to crossoverCount-1
    crossover= str.tostring(array.get(crossoverGroups, i))
    crossoverBoundaries= str.split(crossover, "x")
    int fastLength= math.round(str.tonumber(array.get(crossoverBoundaries, 0)))
    int slowLength= math.round(str.tonumber(array.get(crossoverBoundaries, 1)))
    wmaFast= ma(source,fastLength,maType)
    wmaSlow= ma(source,slowLength,maType)
    if wmaFast>wmaSlow
        longVotes:= longVotes + 1
        array.set(positions, i, 1)

longCondition= longVotes==crossoverCount and strategy.position_size==0


//profitTicks = profitAtr*ta.atr(atrPeriod)/syminfo.mintick
//lossTicks = lossAtr*ta.atr(atrPeriod)/syminfo.mintick
profitPrice= close+profitAtr*ta.atr(atrPeriod)
lossPrice= close-lossAtr*ta.atr(atrPeriod)

if strategy.position_size>0
    profitPrice:= profitPrice[1]
    lossPrice:= lossPrice[1]

plot(profitPrice, color=color.green)
plot(lossPrice, color=color.red)

if longCondition and profitPrice>0
    strategy.entry("Long", strategy.long)

if longVotes<crossoverCount and strategy.position_size>0 and (high>profitPrice or low<lossPrice)
    strategy.close("Long")
    
longVotes:= 0

더 많은