RSI 기반 동적 포지션 추가 전략


생성 날짜: 2024-02-06 09:44:05 마지막으로 수정됨: 2024-02-06 09:44:05
복사: 1 클릭수: 727
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

RSI 기반 동적 포지션 추가 전략

개요

이 전략은 상대적으로 강한 지수 ((RSI) 와 마틴 겔 가장점 원칙을 결합한다. RSI가 초과 판매선보다 낮을 때, 첫 번째 구매를 하고 포지션을 열고, 이후 가격이 계속 떨어지면 2의 지수에서 가장점을 하여 이익을 막는다. 이 전략은 높은 시장 가치의 화폐의 현금 거래에 적합하며, 장기적으로 안정적인 수익을 얻을 수 있다.

전략 원칙

  1. RSI 지표를 사용하여 시장 과매매를 판단합니다. RSI 기간 동안은 14로 설정하고, 과매매 절벽은 30으로 설정합니다.
  2. RSI <30일 때, 계정 이자율의 5%로 첫 번째 포지션을 추가하십시오.
  3. 만약 가격이 처음 진입 가격보다 0.5% 떨어지면, 2배의 포지션으로 더 많은 포지션을 한다. 만약 가격이 계속 떨어지면, 4배의 포지션으로 다시 포지션을 한다.
  4. 매번 0.5%씩 상승하면 수익금으로 청산한다.
  5. 상술한 단계를 반복하여 순환 거래를 진행하십시오.

우위 분석

  • RSI를 통해 시장의 과매매 지점을 판단하여 상대적으로 낮은 지점에서 더 많은 지점을 열 수 있습니다.
  • 마틴겔은 매장가격이 낮아질 수 있도록 해줍니다.
  • 소액의 금리는 지속적인 안정적인 수익을 얻을 수 있습니다.
  • 고시장 가치의 현금 거래에 적합하며, 위험은 통제할 수 있다.

위험 분석

  • 지분 손실이 더 커질 수 있습니다.
  • 최대 손실을 제한할 수 없습니다.
  • “이런 일이 벌어진다면, 우리는 더 큰 손실을 입게 될 것입니다”.
  • 하지만, 이 시장은 여전히 큰 위험에 처해 있습니다.

전략 최적화

  1. 최대 손실을 제한하는 스톱로스를 설정할 수 있습니다.
  2. RSI 파라미터를 최적화하여 최적의 오버셀 오버 바이 신호를 찾습니다.
  3. 특정 화폐의 변동율에 따라 합리적인 제한 범위를 설정할 수 있다.
  4. 총자산 또는 개별 지분 비율에 따라 지분 상승률을 설정할 수 있다.

요약하다

이 전략은 RSI 지표와 마틴겔 가장치 원칙을 결합하여 과매매 지점을 판단할 때 적절히 가장치 더하여 작은 정지점으로 수익을 얻는다. 그것은 지속적인 안정적인 수익을 얻을 수 있지만, 또한 약간의 위험이 있다.

전략 소스 코드
/*backtest
start: 2024-01-06 00:00:00
end: 2024-02-05 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Stavolt

//@version=5
strategy("RSI Martingale Strategy", overlay=true, default_qty_type=strategy.cash, currency=currency.USD)

// Inputs
rsiLength = input(14, title="RSI Length")
oversoldThreshold = input(30, title="Oversold Threshold") // Keeping RSI threshold
profitTargetPercent = input(0.5, title="Profit Target (%)") / 100
initialInvestmentPercent = input(5, title="Initial Investment % of Equity")

// Calculating RSI
rsiValue = ta.rsi(close, rsiLength)

// State variables for tracking the initial entry
var float initialEntryPrice = na
var int multiplier = 1

// Entry condition based on RSI
if (rsiValue < oversoldThreshold and na(initialEntryPrice))
    initialEntryPrice := close
    strategy.entry("Initial Buy", strategy.long, qty=(strategy.equity * initialInvestmentPercent / 100) / close)
    multiplier := 1

// Adjusting for errors and simplifying the Martingale logic
// Note: This section simplifies the aggressive position size adjustments without loops
if (not na(initialEntryPrice))
    if (close < initialEntryPrice * 0.995) // 0.5% drop from initial entry
        strategy.entry("Martingale Buy 1", strategy.long, qty=((strategy.equity * initialInvestmentPercent / 100) / close) * 2)
        multiplier := 2 // Adjusting multiplier for the next potential entry

    if (close < initialEntryPrice * 0.990) // Further drop
        strategy.entry("Martingale Buy 2", strategy.long, qty=((strategy.equity * initialInvestmentPercent / 100) / close) * 4)
        multiplier := 4

    // Additional conditional entries could follow the same pattern

// Checking for profit target to close positions
if (strategy.position_size > 0 and (close - strategy.position_avg_price) / strategy.position_avg_price >= profitTargetPercent)
    strategy.close_all(comment="Take Profit")
    initialEntryPrice := na // Reset for next cycle