이 전략은 RSI와 Estocastic의 두 가지 다른 유형의 기술 지표를 통합하여 TSLA 5 분과 S&P 100 1 분의 두 개의 시간 프레임에 거래 규칙을 설계하여 자동화된 TSLA 주식 거래 시스템을 구현합니다.
이 전략의 주요 아이디어는 TSLA 자체의 가격 기술 지표와 미국 주식 시장의 기술 지표를 동시에 모니터링하고, 둘 다 동시에 과매매 과매매 상태에 도달했을 때 거래 신호를 발산하는 것입니다. 전략은 5 분과 1 분의 두 시간 주기 지표를 조합하여 일부 잡음 거래 신호를 효과적으로 필터링 할 수 있습니다.
우선, 전략은 TSLA의 5분 K선에서 5일 RSI를 계산하고, S&P100의 1분 K선에서 14일 RSI를 계산한다. TSLA의 5일 RSI가 30보다 낮고, S&P100의 14일 RSI도 30보다 낮을 때, TSLA 주식 가격이 초매매 상태에 있다고 인정되며, 이 시점에 구매 신호가 발송된다.
구매 후, 전략은 TSLA 1분 K 선의 14일 Estocastic 지표를 계속 모니터링한다. Estocastic 지표가 78을 넘으면, TSLA 주식의 가격이 상향으로 반발한 부린 밴드를 인식하고, 그 시점에서 판매 신호를 낸다.
또한, 전략은 3%의 상쇄 지점을 설정하고, 가격이 상향으로 상쇄 지점을 넘으면 상쇄 지점을 자발적으로 제거합니다.
이 전략은 전반적으로 전형적인 오버 바이 오버 셀 역전 전략이며, 동시에 여러 시간 프레임 검증과 스톱 로드 모듈을 추가하여 전략을 더욱 안정적으로 만든다. 이 전략의 장점은 간단하고 이해하기 쉽고 실행하기 쉽다는 것이다. 다음 연구 방향은 위험을 통제하면서 더 많은 알파를 얻는 방법이다. 이것은 지표와 모델에 대한 맞춤형 최적화를 필요로 한다.
/*backtest
start: 2023-11-21 00:00:00
end: 2023-12-21 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Estrategia de Trading TSLA", overlay=true)
// Condiciones de entrada
rsi5 = ta.rsi(close, 5) // RSI en el gráfico de TSLA de 5 minutos
rsiUS100 = ta.rsi(request.security(syminfo.tickerid, "1", close), 14) // RSI en el gráfico de US100 de 1 minuto
// Condiciones de entrada
condicion_entrada = rsi5 < 30 and rsiUS100 < 30
// Cantidad de acciones a comprar
cantidad_compra = 2
// Condiciones de salida
estocastico = ta.stoch(close, high, low, 14) // Estocástico en el gráfico de TSLA de 1 minuto
condicion_salida = estocastico > 78
// Stop loss
stop_loss = strategy.position_avg_price * 0.03
// Ejecutar la estrategia
if condicion_entrada
strategy.entry("Compra", strategy.long, qty = cantidad_compra)
if condicion_salida or ta.highest(high, 10) <= stop_loss
strategy.close("Compra")
// Mostrar indicadores en el gráfico
plot(rsi5, "RSI 5 (TSLA)", color=color.blue)
plot(rsiUS100, "RSI US100", color=color.red)
plot(estocastico, "Estocástico (TSLA)", color=color.green)