
この戦略は,ランダムなスローインジケータ (Stochastic Slow Oscillator) をベースにした取引戦略であり,移動平均 (Moving Average),相対的に強い指数 (RSI) と人工知能 (AI) 技術を組み合わせている.この戦略は,ランダムなスローインジケータの交差信号を判断し,価格の200日移動平均の位置と人工知能モデルによって生成された信号を考慮しながら,買賣シグナルを決定する.この戦略は,リスクを制御するためにストップとストップロスを設定します.
この戦略は,ランダムなスローインジケータ,移動平均,相対的に強い指数と人工知能技術を組み合わせて,多要素取引戦略を構築している.戦略は,トレンドフィルターとインテリジェント信号生成を使用しながら,乱価指標を利用して,オーバーバイオーバーセール信号を捕捉し,戦略の安定性と適応性を向上させている.戦略には,指標の失敗やモデルの不確実性などの一定のリスクがあるにもかかわらず,指標のパラメータを最適化し,人工知能モデルを改善し,ダイナミックリスク管理措置の方法を採用することで,戦略の性能とリスク管理能力をさらに向上させることができる.
/*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")