모멘텀 팔로잉 전략


생성 날짜: 2023-11-23 13:47:02 마지막으로 수정됨: 2023-11-23 13:47:02
복사: 0 클릭수: 355
1
집중하다
1166
수행원

모멘텀 팔로잉 전략

개요

이 전략은 K선 엔터티 크기와 트렌드 동력 지표 EMA를 사용하여 시장 흐름을 판단하여 낮은 가격으로 구매하는 자동 거래 전략입니다. 기본 아이디어는 상승 상황에서 하락을 추적하고, 하락 상황에서 더 많은 것을 보완하는 것입니다.

전략 원칙

  1. K선 개체 크기에 따라 을 퇴적, 소, 대 세 종류로 구분한다.
  2. EMA가 상승하는 경우, 큰 빨간색 이 나타난다면, 시장이 조정되고 있으며, 이 때 더 많은 상이 던진다.
  3. EMA가 하락하는 경우, 큰 녹색 이 나타난다면, 시장이 안정된 것을 나타냅니다.
  4. K선 엔티티 변화와 EMA 트렌드를 실시간으로 모니터링하여 포지션을 동적으로 조정한다.

우위 분석

  1. 전략적 사고가 명확하고, 간단한 지표로 시장 구조를 판단하고, 이해하기 쉽다.
  2. 전략의 매개 변수가 적고, 잘 맞지 않고, 안정성이 높다.
  3. 이 거래는 하위 흡수 하위 반전 거래 논리를 구현하고, 시장의 큰 변동이 있을 때 수익이 뚜렷하다.
  4. 트렌드와 반향을 동시에 고려하고, 상황이 변할 때에도 즉각적으로 대응할 수 있다.

위험과 최적화

  1. 주식 가격의 절대적 폭을 고려하지 않고, 손실 위험을 초래할 수 있다. ATR 지표와 결합하여 손실을 줄 수 있다.
  2. 하지만, 이 문제는 암호화폐의 기저분쟁을 고려하지 않고, 더 많은 거래 쌍을 테스트할 수 있습니다.
  3. 기계 학습 알고리즘을 도입하여 K선 형태를 판단할 수 있다.
  4. 거래량 지표 필터링 품종과 결합할 수 있다.
  5. 다른 주기의 파라미터 조정도 테스트할 수 있다.

요약하다

이 전략의 전체적인 아이디어는 명확하고 이해하기 쉽다. 주요한 특징은 변동량 과 추적 의 두 가지 특징이다. 간단한 EMABOLL 지표를 통해 시장의 주선 방향을 판단하고, K선 엔티티를 판단하여 낮은 흡수 높은 팔을 달성합니다. 전략의 안정성이 높으며, 암호화폐에서 특히 우수한 성능을 보이고 있으며, 추가 테스트 최적화를 할 가치가 있다.

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

//@version=5
//Author @divonn1994

strategy(title='Trend Follower Strategy v2 [divonn1994]', shorttitle='TrendFollowStrategyV2', overlay=false, pyramiding=0, default_qty_value=100, default_qty_type=strategy.percent_of_equity, precision=7, currency=currency.USD, commission_value=0.1, commission_type=strategy.commission.percent, initial_capital=100)

//Important Constants for Classifying Candle Size----------------------------------------------------------------------------------------------------------------------------------------------

timesBigger = 2
crumbSize = 1400
crumbSize2 = 2100
bigCandleSize = 3800

//Key Alerts and Classifications of Candle Size and EMAs---------------------------------------------------------------------------------------------------------------------------------------

emaAlert = ta.ema(close, 8) > ta.ema(open, 8) ? 1 : 0 
CandleSize = close * 1 - open * 1
previousCandleSize = close[1] * 1 - open[1] * 1
greenCandle = close > open ? 1 : 0
previousGreenCandle = close[1] > open[1] ? 1 : 0

crumb = (greenCandle==1 and CandleSize<=crumbSize) or (greenCandle==0 and -CandleSize<=crumbSize) ? 1 : 0
bigCrumb = (greenCandle==1 and CandleSize<=crumbSize2 and CandleSize>crumbSize) or (greenCandle==0 and -CandleSize<=crumbSize2 and -CandleSize>crumbSize) ? 1 : 0
previousCandleIsSmallCrumb = (previousGreenCandle==1 and previousCandleSize<=crumbSize) or (previousGreenCandle==0 and -previousCandleSize<=crumbSize) ? 1 : 0
previousCandleIsBigCrumb = (previousGreenCandle==1 and previousCandleSize<=crumbSize2 and previousCandleSize>crumbSize) or (previousGreenCandle==0 and -previousCandleSize<=crumbSize2 and -previousCandleSize>crumbSize) ? 1 : 0

bigCandle = (greenCandle==1 and previousCandleIsBigCrumb==1 and CandleSize>=math.abs(timesBigger*previousCandleSize)) or (greenCandle==1 and previousCandleIsSmallCrumb==1 and CandleSize>=bigCandleSize) or (greenCandle==1 and previousCandleIsSmallCrumb==0 and previousCandleIsBigCrumb==0 and CandleSize>=math.abs(timesBigger*previousCandleSize)) ? 1 : 0

//Engine (Secret Sauce)------------------------------------------------------------------------------------------------------------------------------------------------------------------------

buy = (crumb==0 and bigCrumb==0 and greenCandle==0) or (greenCandle==1 and bigCandle==1) or (emaAlert==0) ? 0 : 1

//Strategy-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

if ta.crossover(buy, 0.5)
    strategy.entry('long', strategy.long, comment='long')
if ta.crossunder(buy, 0.5)
    strategy.close('long')

//Plot Strategy Behavior-----------------------------------------------------------------------------------------------------------------------------------------------------------------------

plot(buy, color=color.new(color.silver, 0))
plot(0.5, color=color.new(color.fuchsia, 0))