거래 전략에 따른 동력 지표가 주도하는 경향

저자:차오장, 날짜: 2023-12-12 14:52:11
태그:

img

전반적인 설명

이 전략은 모멘텀 지표 RSI와 가격의 기하급수적인 이동 평균 (EMA) 및 간단한 이동 평균 (SMA) 을 기반으로 거래 신호를 구축합니다. 트렌드 다음 유형의 전략에 속합니다.

전략 원칙

이 전략은 거래 신호를 생성하기 위해 세 가지 조건을 사용합니다.

  1. RSI > 45: RSI 값이 45보다 높으면 좋은 구매 신호로 간주됩니다.
  2. EMA (RSI) > SMA (RSI): SMA (SMA) 보다 큰 EMA선은 RSI가 상승세를 가속화하고 있음을 나타냅니다. 이것은 좋은 추진 신호입니다.
  3. EMA (결결) > SMA (결결): SMA (결결) 보다 큰 EMA 라인은 가격 추세가 상승세를 가속화하고 있음을 나타냅니다.

위의 3가지 조건 중 2가지가 충족되면 구매 신호가 생성되고, 어느 것도 충족되지 않으면 판매 신호가 생성됩니다.

이 전략은 또한 광범위한 시장에 대한 시스템 성능을 테스트하기 위해 항상 구매 모드를 제공합니다.

이점 분석

  1. 시장 조건을 판단하기 위해 모멘텀 지표 RSI를 사용하면 시장 변동 중에 포지션을 줄일 수 있습니다.
  2. 트렌드 방향을 결정하기 위해 EMA와 SMA를 결합하면 가격 변화 추세를 적시에 파악할 수 있습니다.
  3. 간단하고 명확한 조건 규칙, 이해하기 쉽고 최적화
  4. 시스템 장점을 테스트하기 위해 항상 구매 모드를 제공합니다.

위험 분석

  1. 매개 변수 설정에 의존하고, 부적절한 매개 변수는 자주 거래 또는 좋은 거래 기회를 놓칠 수 있습니다.
  2. 넓은 시장의 주요 뉴스는 단기적으로 엄청난 변동성을 일으킬 수 있습니다.
  3. 전략 자체는 트렌드가 반전될 때를 판단할 수 없습니다.

최적화 방향

  1. 가장 좋은 매개 변수 조합을 찾기 위해 RSI, EMA 및 SMA의 매개 변수를 최적화
  2. 규칙 조건을 풍부하게 하기 위해 볼륨, MACD 등과 같은 다른 기술적 지표를 증가
  3. 손실의 가능성을 줄이기 위해 트렌드 반전 지표를 높여야 합니다.

결론

요약하자면, 이 전략은 중장기 가격 트렌드를 포착하면서 단기 시장 변동을 피하는 것을 목표로 하는 중기 주파수 거래 전략에 속한다. 이 전략의 장점과 위험 지점은 상당히 분명하다. 매개 변수 최적화 및 부양 규칙을 통해 안정성을 더욱 향상시키는 것이 연구 및 최적화를 위한 가치있는 고효율의 양적 거래 전략으로 만든다.


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

//@version=5
strategy("I11L Unitrend",overlay=false, initial_capital=1000000,default_qty_value=1000000,default_qty_type=strategy.cash,commission_type=strategy.commission.percent,commission_value=0.00)
tradingMode = input.string("Unitrend", "Trading Mode", ["Unitrend", "Always Buy"], tooltip="Choose the Trading Mode by trying Both in your Backtesting. I use it if one is far better then the other one.")
compoundingMode = input.bool(false)
leverage = input.float(1.0,step=0.1)
SL_Factor = 1 - input.float(1,"Risk Capital per Trade unleveraged (%)", minval=0.1, maxval=100, step=0.1) / 100
TPFactor = input.float(2, step=0.1)




var disableAdditionalBuysThisDay = false
var lastTrade = time
if(time > lastTrade + 1000 * 60 * 60 * 8 or tradingMode == "Always Buy")
    disableAdditionalBuysThisDay := false

if(strategy.position_size != strategy.position_size[1])
    lastTrade := time
    disableAdditionalBuysThisDay := true

//Trade Logic
SCORE = 0

//rsi momentum
RSIFast = ta.ema(ta.rsi(close,50),24)
RSISlow = ta.sma(ta.rsi(close,50),24)
RSIMomentum = RSIFast / RSISlow
goodRSIMomentum = RSIMomentum > 1
SCORE := goodRSIMomentum ? SCORE + 1 : SCORE

//rsi trend
RSITrend = RSISlow / 45
goodRSI = RSITrend > 1
SCORE := goodRSI ? SCORE + 1 : SCORE

//price trend
normalTrend = ta.ema(close,50) / ta.sma(close,50)
goodTrend = normalTrend > 1
SCORE := goodTrend ? SCORE + 1 : SCORE



isBuy =  SCORE > 1 or tradingMode == "Always Buy"
isSell = false //SCORE == 0

//plot(SCORE, color=isBuy ? color.green : #ffffff88)
//reduced some of the values just for illustrative purposes, you can buy after the signal if the trendlines seem to grow
plot(1, color=isBuy ? #77ff7733 : SCORE == 2 ? #ffff0033 : SCORE == 1 ? #ff888833 : #ff000033,linewidth=10)
plot(1 - (1 - RSIMomentum) * 6,color=#00F569)
plot(1 - (1 - RSITrend) * 0.25,color=#00DB9B)
plot(1 - (1 - normalTrend) * 20,color=#00F5EE)


strategy.initial_capital = 50000
if(isBuy and not(disableAdditionalBuysThisDay))
    if(compoundingMode)
        strategy.entry("Long", strategy.long, (strategy.equity / close) * leverage)
    else
        strategy.entry("Long", strategy.long, (strategy.initial_capital / close) * leverage)


if(strategy.position_size != 0)
    strategy.exit("TP/SL Long", "Long", stop=strategy.position_avg_price * (1 - (1 - SL_Factor)), limit=strategy.position_avg_price * (1 + (1 - SL_Factor) * TPFactor))




더 많은