알고리즘 RSI 범주 파업 전략

저자:차오장, 날짜: 2023-10-17 17:14:09
태그:

img

전반적인 설명

이 전략은 RSI 지표가 다른 범위에서 깨지는 것을 모니터링하여 낮은 가격으로 구매하고 높은 가격으로 판매합니다. RSI가 낮은 범위에서 길어지고 RSI가 높은 범위에서 짧아지면 지나치게 구매되거나 지나치게 팔린 상태가 나타날 때 위치를 뒤집습니다.

전략 논리

  1. RSI 기간을 14로 설정

  2. RSI 구매 신호 범위를 설정:

    • 범위 1: RSI <= 27
    • 범위 2: RSI <= 18
  3. RSI 판매 신호 범위를 설정:

    • 범위 1: RSI >= 68
    • 범위 2: RSI >= 80
  4. RSI가 구매 범위에 들어가면, 장거리:

    • 만약 RSI가 범위 1 (하하 27) 에 들어가면, 1 로트를 길게 하
    • 만약 RSI가 범위 2 (하하 18) 에 들어가면, 추가로 1 롯을 길게 가십시오.
  5. RSI가 판매 범위에 들어가면, 단위로 가세요.

    • 만약 RSI가 범위 1 (68 이상) 에 들어가면, 1 로트를 단축합니다.
    • 만약 RSI가 범위 2 (80 이상) 에 들어가면 추가로 1 로트를 단축합니다.
  6. 2500 pips로 수익을 고정하고 5000 pips로 손실을 중지

  7. RSI가 신호 범위를 벗어날 때 포지션을 닫습니다.

이점 분석

  1. 이중 범위 설정은 과도한 구매 및 과도한 판매 조건을 더 잘 식별하여 회수 기회를 놓치지 않도록합니다.

  2. 피프로 고정된 수익을 취하고 손실을 멈추는 것은 트렌드를 너무 많이 쫓는 것을 방지합니다.

  3. RSI는 다른 지표에 대한 장점을 가진 과잉 구매 및 과잉 판매 수준을 식별하는 성숙한 오시레이터입니다.

  4. 적절한 매개 변수 조정을 통해 이 전략은 트렌드 반전 지점을 효과적으로 파악하고 초과 수익을 창출할 수 있습니다.

위험 분석

  1. 지속된 단위 포지션에서 연속적인 손실로 이어지는 RSI 오차가 발생할 수 있습니다.

  2. 고정 취익 및 중지 손실은 시장 변동성과 일치하지 않을 수 있습니다. 수익을 얻지 못하거나 조기 중단 할 수 있습니다.

  3. 부적절한 범위 설정으로 인해 거래가 누락되거나 수익성이 떨어지는 거래가 자주 발생할 수 있습니다.

  4. 이 전략은 백테스트를 기반으로 한 매개 변수 최적화에 많이 의존합니다. 신중한 진행 분석이 필요합니다.

최적화 방향

  1. 다른 기간 길이를 가진 RSI의 시험 효과

  2. 다양한 제품의 특성에 맞게 구매 및 판매 범위 값을 최적화합니다.

  3. 연구 동적 수익을 취하고 수익성 및 합리성을 향상시키기 위해 손실을 중지

  4. 안정성을 높이기 위해 다른 단위 거래 지표를 결합하는 것을 고려하십시오.

  5. 안정성을 위한 파라미터 범위를 자동으로 최적화하기 위한 기계 학습 기술을 탐구

결론

이 전략은 RSI 과잉 구매 및 과잉 판매 원칙에 기반합니다. 이중 거래 범위를 채택함으로써 RSI 지표를 효과적으로 활용하여 괜찮은 안정성으로 시장 극단성을 포착합니다. 그러나 일부 매개 변수 의존도가 있으며 제품 전반에 걸쳐 최적화가 필요합니다. 올바르게 조정되면이 전략은 좋은 초과 수익을 얻을 수 있습니다. 요약하면 성숙한 지표를 사용하여 간단하지만 효과적인 거래 전략으로 개선을 위해 연구하고 양적 거래에 대한 통찰력을 제공합니다.


/*backtest
start: 2023-09-16 00:00:00
end: 2023-10-16 00:00:00
period: 1h
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/
// © Rawadabdo

// Ramy's Algorithm

//@version=5
strategy("BTC/USD - RSI", overlay=false, initial_capital = 5000)

// User input
length = input(title = "Length", defval=14, tooltip="RSI period")

first_buy_level = input(title = "Buy Level 1", defval=27, tooltip="Level where 1st buy triggers")
second_buy_level = input(title = "Buy Level 2", defval=18, tooltip="Level where 2nd buy triggers")

first_sell_level = input(title = "Sell Level 1", defval=68, tooltip="Level where 1st sell triggers")
second_sell_level = input(title = "Sell Level 2", defval=80, tooltip="Level where 2nd sell triggers")

takeProfit= input(title="target Pips", defval=2500, tooltip="Fixed pip stop loss distance")
stopLoss = input(title="Stop Pips", defval=5000, tooltip="Fixed pip stop loss distance")

lot = input(title = "Lot Size", defval = 1, tooltip="Trading Lot size")

// Get RSI
vrsi = ta.rsi(close, length)

// Entry Conditions
long1 = (vrsi <= first_buy_level and vrsi>second_buy_level)
long2 = (vrsi <= second_buy_level)

short1= (vrsi >= first_sell_level and vrsi<second_sell_level)
short2= (vrsi >= second_sell_level)


// Entry Orders
// Buy Orders
if (long1 and strategy.position_size == 0)
    strategy.entry("Long", strategy.long, qty=lot, comment="Buy")
    if (long2 and  strategy.position_size == 0)
        strategy.entry("Long", strategy.long, qty=lot, comment="Buy")

// Short Orders
if (short1 and strategy.position_size == 0)
    strategy.entry("Short", strategy.short,qty=lot, comment="Sell")
    if (short2 and strategy.position_size == 0)
        strategy.entry("Short", strategy.short,qty=lot, comment="Sell")
    
// Exit our trade if our stop loss or take profit is hit
strategy.exit(id="Long Exit", from_entry="Long",qty = lot, profit=takeProfit, loss=stopLoss)
strategy.exit(id="Short Exit", from_entry="Short", qty = lot, profit=takeProfit, loss=stopLoss)

// plot data to the chart
hline(first_sell_level, "Overbought Zone", color=color.red, linestyle=hline.style_dashed, linewidth = 2)
hline(second_sell_level, "Overbought Zone", color=color.green, linestyle=hline.style_dashed, linewidth = 2)
hline(first_buy_level, "Oversold Zone", color=color.red, linestyle=hline.style_dashed, linewidth = 2)
hline(second_buy_level, "Oversold Zone", color=color.green, linestyle=hline.style_dashed, linewidth = 2)
plot (vrsi, title = "RSI", color = color.blue, linewidth=2)





더 많은