
Esta estrategia es un sistema de seguimiento de tendencias que combina un indicador aleatorio relativamente débil (Stochastic RSI) y un promedio móvil (Moving Average). La estrategia identifica los puntos de inflexión en la tendencia del mercado mediante el análisis de las señales cruzadas de estos dos indicadores técnicos, lo que permite capturar posibles oportunidades de negociación. La estrategia utiliza una verificación cruzada de múltiples indicadores, lo que reduce la interferencia de señales falsas y mejora la precisión de las operaciones.
La lógica central de la estrategia se basa en dos sistemas de indicadores principales:
La estrategia construye un sistema de comercio de seguimiento de tendencias relativamente completo mediante la combinación de indicadores aleatorios relativamente fuertes y un sistema de medias móviles. La ventaja de la estrategia reside en el mecanismo de verificación cruzada de múltiples indicadores, que puede reducir eficazmente la interferencia de señales falsas. Pero al mismo tiempo, también se debe tener en cuenta el control de riesgos, especialmente en el rendimiento de los mercados convulsos.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-12-25 08:00:00
period: 1d
basePeriod: 1d
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/
// © Quantuan_Research
//@version=6
version=6
strategy("Quantuan Research - Alpha", overlay=true, pyramiding=200, default_qty_value=1)
// Define Stochastic RSI settings
lengthRSI = input(17, title="RSI Length")
lengthStoch = input(20, title="Stochastic Length")
src = input(close, title="Source")
rsi = ta.rsi(src, lengthRSI)
k = ta.stoch(rsi, rsi, rsi, lengthStoch)
d = ta.sma(k, 3)
// Define MA settings
fastMALength = input(10, title="Fast MA Length")
slowMALength = input(20, title="Slow MA Length")
fastMA = ta.sma(close, fastMALength)
slowMA = ta.sma(close, slowMALength)
// Define long and short conditions
longCondition = k < 17 and d < 23 and k > d
shortCondition = k > 99 and d > 90 and k < d
// Create long and short signals
if longCondition//@
strategy.entry("Long", strategy.long)
if shortCondition
strategy.entry("Short", strategy.short)
// Add alerts for long and short signals
alertcondition(longCondition, title="Long Signal", message="Long signal generated")
alertcondition(shortCondition, title="Short Signal", message="Short signal generated")
// Plot Moving Averages with color based on trend
plot(fastMA, color = fastMA > slowMA ? color.new(color.rgb(0, 255, 170), 0) : color.new(color.rgb(255, 0, 0), 0), title = 'Fast MA')
plot(slowMA, color = color.new(color.rgb(255, 255, 0), 0), title = 'Slow MA')