추세에 기초한 단기 거래 전략

저자:차오장, 날짜: 2023-09-27 16:56:34
태그:

전반적인 설명

이 전략은 단기 거래와 손실 통제를 위한 강력한 트렌드와 유리한 타이밍을 식별합니다. 트렌드 신호로 간단한 이동 평균의 가격 브레이크를 추적하고, 단기 가격 움직임을 포착하기 위해 RSI 오차에 기반한 스톱 로스/프로프트를 설정합니다.

전략 논리

  1. 여러 기간 간 간단한 이동평균을 계산하는 방법

    • 9일, 50일 및 100일 SMA를 설정

    • 짧은 SMA가 긴 SMA를 가로지르는 것은 트렌드 방향을 나타냅니다.

  2. RSI를 이용한 과잉 구매/ 과잉 판매 수준을 판단

    • RSI 길이는 14기입니다.

    • RSI 70 이상은 과잉 구매, 30 이하는 과잉 판매

  3. 9일 SMA를 넘을 때 거래를 하는 경우

    • 가격이 9일 SMA를 넘을 때 길게 가자

    • 가격이 9일 SMA 이하로 떨어지면 단축

  4. RSI 오차에 기초한 스톱 로스/프로프트 취득 설정

    • 스톱 로스 (stop loss) 에 대한 RSI 오차

    • RSI가 미리 설정된 수준에 도달했을 때 수익을 취하십시오.

이점 분석

  • 고주파 거래에 적합한 단기 트렌드를 포착합니다.

  • SMA 조합은 트렌드 신호를 필터링하여 나쁜 거래를 피합니다.

  • RSI는 타이밍을 결정하고 위험을 효과적으로 제어하는 데 도움이됩니다.

  • 유연한 스톱 로스/이익 취득 잠금 단기 이익

  • 지표의 조합은 안정성을 향상시킵니다.

위험 분석

  • 단기 트렌드 판단이 정확하지 않아 추격이 발생합니다.

  • 잘못된 RSI 신호가 손실을 증가시킵니다.

  • 부적절한 스톱 로스/프로프트 취업 설정으로 수익을 줄이거나 손실을 증가시킵니다.

  • 높은 거래 빈도는 비용과 미끄러짐을 증가시킵니다.

  • 비효율적인 매개 변수와 비정상적인 시장 영향 전략

  • 매개 변수를 최적화, 엄격한 스톱 손실, 비용을 관리

최적화 방향

  • 트렌드 판단을 개선하기 위해 다른 SMA 조합을 테스트합니다.

  • RSI 신호를 확인하기 위해 STOCH와 같은 추가 지표를 고려하십시오.

  • 유효한 브레이크오웃을 결정하기 위해 머신러닝을 사용

  • 다른 제품과 세션에 대한 매개 변수를 조정

  • 동적 트레일링을 위한 스톱 로스/프로프트 취업 논리를 최적화

  • 자동 매개 변수 조정 메커니즘을 탐구

결론

이 전략은 보수적인 단기 거래 접근을 위해 SMA와 RSI를 결합합니다. 미세 조정 매개 변수, 신호 검증, 리스크 통제는 더 견고하고 적응력을 갖습니다. 더 많은 SMA 컴보를 탐색하고 기계 학습 모델을 추가하여 개선 할 여지가 있습니다. 지속적인 최적화는 더 많은 성숙으로 이어질 것입니다.


/*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)


더 많은