
Chiến lược này là một chiến lược giao dịch dựa trên chỉ số Stochastic Slow Oscillator, kết hợp với Moving Average, chỉ số tương đối mạnh (RSI) và công nghệ trí tuệ nhân tạo (AI). Chiến lược này được đánh giá bằng các tín hiệu chéo của chỉ số chậm ngẫu nhiên, đồng thời xem xét vị trí của giá so với trung bình di chuyển 200 ngày và các tín hiệu được tạo ra bởi mô hình trí tuệ nhân tạo để xác định tín hiệu mua và bán.
Chiến lược này được xây dựng bằng cách kết hợp các chỉ số trễ ngẫu nhiên, trung bình di chuyển, chỉ số tương đối mạnh và công nghệ trí tuệ nhân tạo để xây dựng một chiến lược giao dịch đa yếu tố. Chiến lược sử dụng các chỉ số ngẫu nhiên để bắt tín hiệu mua quá mức, đồng thời sử dụng bộ lọc xu hướng và tạo tín hiệu thông minh, cải thiện sự ổn định và thích ứng của chiến lược. Mặc dù có một số rủi ro, chẳng hạn như không hiệu quả của chỉ số và không chắc chắn của mô hình, nhưng có thể nâng cao hơn nữa hiệu suất và khả năng kiểm soát rủi ro của chiến lược bằng cách tối ưu hóa các tham số chỉ số, cải thiện mô hình trí tuệ nhân tạo và áp dụng các biện pháp kiểm soát rủi ro động.
/*backtest
start: 2024-03-12 00:00:00
end: 2024-04-11 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Stochastic Slow Strategy with More Entries and AI", overlay=true)
length = input.int(30, minval=1)
OverBought = input(40)
OverSold = input(19)
smoothK = input.int(18, minval=1)
smoothD = input.int(7, minval=1)
minKValue = input(12, title="Minimum K Value")
// Stochastic calculations
k = ta.sma(ta.stoch(close, high, low, length), smoothK)
d = ta.sma(k, smoothD)
co = ta.crossover(k, d)
cu = ta.crossunder(k, d)
// Trend filter (200-period simple moving average)
ema200 = ta.sma(close, 200)
// Define la función para calcular la señal de la red neuronal recurrente
rnn_signal(price_series) =>
// Aquí implementa tu modelo de red neuronal recurrente para generar la señal
// Puedes usar bibliotecas externas o implementar tu propio modelo aquí
// Ejemplo de señal aleatoria
signal = ta.rsi(price_series, 14) > 50 ? 1 : -1
// Devuelve la señal generada por la red neuronal recurrente
signal
// Calcula la señal utilizando la función definida anteriormente
ai_signal = rnn_signal(close)
// Entry conditions
longCondition = ta.crossover(close, ema200) and k < OverSold and k > minKValue and ai_signal == 1
shortCondition = ta.crossunder(close, ema200) and k > OverBought and k > minKValue and ai_signal == -1
if (not na(k) and not na(d))
if (co and k < OverSold and k > minKValue)
strategy.entry("LONG", strategy.long, comment="LONG")
strategy.exit("ExitLong", "LONG", profit = close * 500, loss = close * 200)
if (cu and k > OverBought and k > minKValue)
strategy.entry("SHORT", strategy.short, comment="SHORT")
strategy.exit("ExitShort", "SHORT", profit = close * 500, loss = close * 200)
if (longCondition)
strategy.entry("LongEntry", strategy.long, comment="LongEntry")
strategy.exit("ExitLongEntry", "LongEntry", profit = close * 500, loss = close * 200)
if (shortCondition)
strategy.entry("ShortEntry", strategy.short, comment="ShortEntry")
strategy.exit("ExitShortEntry", "ShortEntry", profit = close * 500, loss = close * 200)
// Plotting
plot(ema200, color=color.blue, title="200 SMA")