
Chiến lược này là một hệ thống giao dịch thích ứng kết hợp tối ưu hóa trí tuệ nhân tạo và nhiều chỉ số kỹ thuật. Nó chủ yếu sử dụng các chỉ số Brin, chỉ số tương đối mạnh ((RSI) và siêu xu hướng ((Supertrend) để tạo ra tín hiệu giao dịch và điều chỉnh các tham số giao dịch thông qua tối ưu hóa trí tuệ nhân tạo. Hệ thống cũng bao gồm cơ chế dừng lỗ thích ứng dựa trên ATR, cho phép chiến lược tự động điều chỉnh các tham số quản lý rủi ro theo biến động của thị trường.
Chiến lược sử dụng cơ chế lọc nhiều lớp để xác định tín hiệu giao dịch. Đầu tiên, thông qua Brin để xác định phạm vi biến động của thị trường, hệ thống sẽ xem xét nhiều tín hiệu khi giá vượt qua đường ray Brin và RSI ở khu vực bán tháo. Ngược lại, khi giá vượt qua đường ray Brin và RSI ở khu vực mua quá mức, hệ thống sẽ xem xét tín hiệu không.
Đây là một chiến lược giao dịch tổng hợp kết hợp phân tích kỹ thuật truyền thống với công nghệ trí tuệ nhân tạo hiện đại. Bằng cách sử dụng nhiều chỉ số kỹ thuật, chiến lược có thể xác định hiệu quả cơ hội thị trường, trong khi mô-đun tối ưu hóa trí tuệ nhân tạo cung cấp khả năng thích ứng mạnh mẽ.
/*backtest
start: 2024-10-01 00:00:00
end: 2024-10-31 23:59:59
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("AI-Optimized Crypto Trading with Trailing Stop", overlay=true, precision=4)
// Input settings for AI optimization
risk_per_trade = input.float(1.0, title="Risk per Trade (%)", minval=0.1, maxval=100) / 100
atr_period = input.int(14, title="ATR Period") // ATR период должен быть целым числом
atr_multiplier = input.float(2.0, title="ATR Multiplier for Stop Loss")
take_profit_multiplier = input.float(2.0, title="Take Profit Multiplier")
ai_optimization = input.bool(true, title="Enable AI Optimization")
// Indicators: Bollinger Bands, RSI, Supertrend
rsi_period = input.int(14, title="RSI Period")
upper_rsi = input.float(70, title="RSI Overbought Level")
lower_rsi = input.float(30, title="RSI Oversold Level")
bb_length = input.int(20, title="Bollinger Bands Length")
bb_mult = input.float(2.0, title="Bollinger Bands Multiplier")
supertrend_factor = input.int(3, title="Supertrend Factor") // Изменено на целое число
// Bollinger Bands
basis = ta.sma(close, bb_length)
dev = bb_mult * ta.stdev(close, bb_length)
upper_band = basis + dev
lower_band = basis - dev
// RSI
rsi = ta.rsi(close, rsi_period)
// Supertrend calculation
atr = ta.atr(atr_period)
[supertrend, _] = ta.supertrend(atr_multiplier, supertrend_factor)
// AI-based entry/exit signals (dynamic optimization)
long_signal = (rsi < lower_rsi and close < lower_band) or (supertrend[1] < close and ai_optimization)
short_signal = (rsi > upper_rsi and close > upper_band) or (supertrend[1] > close and ai_optimization)
// Trade execution with trailing stop-loss
if (long_signal)
strategy.entry("Long", strategy.long, stop=close - atr * atr_multiplier, limit=close + atr * take_profit_multiplier)
if (short_signal)
strategy.entry("Short", strategy.short, stop=close + atr * atr_multiplier, limit=close - atr * take_profit_multiplier)
// Plotting the MAs and Ichimoku Cloud for visualization
plot(upper_band, color=color.red, title="Upper Bollinger Band")
plot(lower_band, color=color.green, title="Lower Bollinger Band")
plot(supertrend, color=color.blue, title="Supertrend")