BIBOT
BIBOT
BIBOT
전체 방문자
오늘
어제
  • 분류 전체보기 (79)
    • 경제뉴스 일기 (11)
    • 바이낸스 (17)
    • 코딩 (15)
    • 기술적 트레이딩 (27)
    • 기타 (1)
    • 경제상식 (6)
    • 일상 (1)

블로그 메뉴

  • 홈
  • 선물거래 계산기
  • 태그
  • 방명록

공지사항

인기 글

태그

  • 서버
  • 우분투
  • 파이썬 바이낸스
  • 파이썬

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
BIBOT

BIBOT

기술적 트레이딩

Tradingview 전략 : Multi Timeframe RSI Buy Sell Strategy

2024. 6. 6. 23:08

"다중 시간대 RSI 매수/매도 전략"은 여러 시간대의 RSI 지표를 활용하여 매수 및 매도 신호를 생성합니다. 이 전략은 최대 3개의 RSI를 지원하며, 각 RSI는 시간대, 길이 및 데이터 소스를 사용자 정의할 수 있습니다.

작동 방식:

  1. 여러 RSI: 다양한 시간대의 최대 3개의 RSI를 사용합니다.
  2. 사용자 정의 설정: RSI 설정을 조정하고 활성 RSI 수를 선택합니다.
  3. 이동 평균: 활성 RSI의 평균 값을 계산합니다.
  4. 신호 생성: 모든 활성 RSI가 동시에 해당 임계값을 초과할 때 매수/매도 신호를 생성합니다.

적용:

  • 시간대별 극단적인 시장 조건을 감지하는 데 이상적입니다.
  • 분기점 및 넓은 추세 내에서의 잠재적 단기 반전을 식별하는 데 도움이 됩니다.

 

import pandas as pd

# Load data
data = pd.read_csv('data.csv')

# Parameters
initial_capital = 10000
equity_per_trade = 0.6

# RSI Calculation
def calculate_rsi(data, window):
    delta = data['Close'].diff()
    gain = (delta.where(delta > 0, 0)).rolling(window=window).mean()
    loss = (-delta.where(delta < 0, 0)).rolling(window=window).mean()
    rs = gain / loss
    rsi = 100 - (100 / (1 + rs))
    return rsi

# Function to identify RSI strategy signals
def multi_timeframe_rsi_strategy(data, windows, thresholds, equity_per_trade):
    signals = []
    capital = initial_capital
    rsi_values = [calculate_rsi(data, window) for window in windows]
    data['Avg_RSI'] = pd.concat(rsi_values, axis=1).mean(axis=1)

    for i in range(max(windows), len(data)):
        if all(rsi[i] > threshold for rsi, threshold in zip(rsi_values, thresholds)):
            signals.append({'Date': data['Date'][i], 'Signal': 'Buy', 'Price': data['Close'][i]})
            capital -= equity_per_trade * capital
        elif all(rsi[i] < threshold for rsi, threshold in zip(rsi_values, thresholds)):
            signals.append({'Date': data['Date'][i], 'Signal': 'Sell', 'Price': data['Close'][i]})
        else:
            signals.append({'Date': data['Date'][i], 'Signal': 'Hold', 'Price': data['Close'][i]})
    
    return pd.DataFrame(signals)

windows = [14, 21, 28]
thresholds = [70, 70, 70]
signals = multi_timeframe_rsi_strategy(data, windows, thresholds, equity_per_trade)
print(signals)

 

The "Multi Timeframe RSI Buy/Sell Strategy" employs Relative Strength Index (RSI) indicators across multiple timeframes to generate buy and sell signals. The strategy supports up to three RSIs, each customizable in terms of timeframe, length, and data source.

How It Works:

  1. Multiple RSIs: Utilize up to three RSIs from different timeframes.
  2. Customizable Settings: Adjust RSI settings and choose the number of active RSIs.
  3. Moving Average: Calculate the average value of active RSIs.
  4. Signal Generation: Trigger buy/sell signals when all active RSIs cross their respective thresholds simultaneously.

Application:

  • Ideal for detecting extreme market conditions across timeframes.
  • Helps identify divergences and potential short-term reversals within broader trends.
반응형
저작자표시 비영리 변경금지 (새창열림)
    '기술적 트레이딩' 카테고리의 다른 글
    • Tradingview 전략 : Ichimoku Theories [LuxAlgo]
    • Tradingview 전략 : Price and Volume Breakout Buy Strategy
    • 차트 중심의 기술적 트레이딩이 실패하는 이유
    • 르네상스 테크놀로지(Renaissance Technologies)의 키포인트
    BIBOT
    BIBOT

    티스토리툴바