추세 추종에 기반한 단기 거래 전략


생성 날짜: 2023-09-27 16:56:34 마지막으로 수정됨: 2023-09-27 16:56:34
복사: 0 클릭수: 669
avatar of ChaoZhang ChaoZhang
1
집중하다
1621
수행원

개요

이 전략은 강력한 추세와 유리한 시기를 식별하여 손실 통제를 위한 단선 거래를 수행한다. 이 전략은 가격의 간단한 이동 평균의 트렌드 신호를 뚫고, RSI 초과 구매 초과 판매 영역에서 이탈하는 경우 적시에 손실을 중지하고, 단기 가격 하락을 포착한다.

전략 원칙

  1. 다주기 간단한 이동 평균을 계산합니다.

    • 9일선, 50일선 및 100일선으로 설정된 SMA

    • 짧은 주기선에서 긴 주기선으로 트렌드 방향을 판단

  2. RSI 지표는 과매매를 판단합니다.

    • RSI를 14주기로 설정합니다.

    • RSI 70 이상은 과매도이고 30 이하는 과매도입니다.

  3. 9일 선을 넘으면 입점

    • 가격 상승이 9일 선을 넘으면 더 많은 돈을 벌 수 있습니다.

    • 9일선 아래로 하락하면서 공백이 생겼다.

  4. RSI가 THENJournal에서 벗어날 때

    • RSI가 가격에서 벗어난 상태에서 멈췄다

    • RSI가 설정된 변수를 달성하면 멈춥니다.

우위 분석

  • 단기 트렌드를 추적하여 고주파 거래에 적합합니다.

  • 이동 평균 포트폴리오는 트렌드 방향을 판단하여 잘못된 거래를 방지합니다.

  • RSI 지표는 위험을 통제할 수 있는 시기를 결정합니다.

  • 유연한 H&L 중지, 단기 수익 잠금

  • 지표 신호와 결합하여 전략적 안정성을 높이는 방법

위험 분석

  • 단기적 추세 판단이 틀릴 수도 있고, 상승과 하락을 따라갈 수도 있다.

  • RSI는 손실을 확대하는 잘못된 신호를 내보냅니다.

  • 손실을 막기 위해 스톱 변수가 잘못 설정되어 수익을 줄이거나 손실을 확대합니다.

  • 거래 빈도가 너무 높아서 거래 비용과 점유율이 증가합니다.

  • 매개 변수 실패 및 비정상적인 시장 영향 전략 효과

  • 최적화 매개 변수를 설정하고, 엄격하게 중지하고, 비용 관리를 고려합니다.

최적화 방향

  • 다른 이동 평균 조합을 테스트하여 판단 효과를 최적화합니다.

  • RSI 신호를 검증하는 다른 지표들, 예를 들어 STOCH를 고려하십시오.

  • 기계학습을 통해 돌파구를 판단할 수 있습니다.

  • 다른 품종과 거래 시간에 대한 조정 파라미터

  • 정지/정지 논리를 최적화하여 동적 추적을 구현합니다.

  • 자동 조회 메커니즘을 통합하는 것을 고려

요약하다

이 전략은 평행선 지표와 RSI 지표의 장점을 통합하여 보수적인 단선 거래 전략을 구현한다. 변수 최적화, 신호 검증, 위험 제어 등으로 전략을 더 완성시키고, 시장의 변화에 적응할 수 있는 지속적인 효과를 얻을 수 있다. 이동 평균 포트폴리오를 계속 확장하고, 기계 학습을 추가하는 등의 방법으로 전략 효과를 향상시킬 수 있으며, 지속적인 최적화 과정에서 성숙되고 있다.

전략 소스 코드
/*backtest
start: 2023-08-27 00:00:00
end: 2023-09-26 00:00:00
period: 3h
basePeriod: 15m
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/
// © Coinrule

//@version=4
strategy(shorttitle='Maximized Scalping On Trend',title='Maximized Scalping On Trend (by Coinrule)', overlay=true, initial_capital = 1000, process_orders_on_close=true, default_qty_type = strategy.percent_of_equity, default_qty_value = 30, commission_type=strategy.commission.percent, commission_value=0.1)

//Backtest dates
fromMonth = input(defval = 1,    title = "From Month",      type = input.integer, minval = 1, maxval = 12)
fromDay   = input(defval = 10,    title = "From Day",        type = input.integer, minval = 1, maxval = 31)
fromYear  = input(defval = 2019, title = "From Year",       type = input.integer, minval = 1970)
thruMonth = input(defval = 1,    title = "Thru Month",      type = input.integer, minval = 1, maxval = 12)
thruDay   = input(defval = 1,    title = "Thru Day",        type = input.integer, minval = 1, maxval = 31)
thruYear  = input(defval = 2112, title = "Thru Year",       type = input.integer, minval = 1970)

showDate  = input(defval = true, title = "Show Date Range", type = input.bool)

start     = timestamp(fromYear, fromMonth, fromDay, 00, 00)        // backtest start window
finish    = timestamp(thruYear, thruMonth, thruDay, 23, 59)        // backtest finish window
window()  => true      // create function "within window of time"

//MA inputs and calculations
movingaverage_fast = sma(close, input(9))
movingaverage_mid= sma(close, input(50))
movingaverage_slow = sma(close, input (100))


//Trend situation
Bullish= cross(close, movingaverage_fast)

Momentum = movingaverage_mid > movingaverage_slow

// RSI inputs and calculations
lengthRSI = 14
RSI = rsi(close, lengthRSI)

//Entry
strategy.entry(id="long", long = true, when = Bullish and Momentum and RSI > 50)

//Exit

TP = input(70)
SL =input(30)
longTakeProfit  = RSI > TP
longStopPrice = RSI < SL

strategy.close("long", when = longStopPrice or longTakeProfit and window())

plot(movingaverage_fast, color=color.black, linewidth=2 )
plot(movingaverage_mid, color=color.orange, linewidth=2)
plot(movingaverage_slow, color=color.purple, linewidth=2)