
Chiến lược này là một hệ thống giao dịch thông minh dựa trên nhiều chỉ báo kỹ thuật, kết hợp các tín hiệu thị trường từ ba chiều: đường trung bình động (MA), khối lượng (Volume) và độ biến động (ATR). Phân tích toàn diện về độ biến động để nắm bắt cơ hội thị trường. Chiến lược này sử dụng hệ thống trung bình động kép làm cơ sở chính để đánh giá xu hướng và đưa khối lượng giao dịch và tính biến động vào làm điều kiện lọc giao dịch, do đó đạt được nhiều lần xác minh tín hiệu giao dịch.
Logic cốt lõi của chiến lược này dựa trên ba chiều sau:
Chiến lược này chỉ đưa ra tín hiệu giao dịch khi các điều kiện của ba chiều này được đáp ứng cùng một lúc. Cơ chế lọc nhiều này cải thiện hiệu quả độ chính xác của giao dịch.
Chiến lược này xây dựng một hệ thống ra quyết định giao dịch hoàn chỉnh thông qua việc phân tích hợp tác nhiều chỉ báo kỹ thuật. Thiết kế chiến lược xem xét đầy đủ các đặc điểm của thị trường như xu hướng, tính thanh khoản và biến động, có tính thực tế và độ tin cậy cao. Thông qua quá trình tối ưu hóa và cải tiến liên tục, chiến lược này dự kiến sẽ duy trì hiệu suất ổn định trong nhiều môi trường thị trường khác nhau. Thiết kế mô-đun của chiến lược cũng cung cấp nền tảng tốt cho việc mở rộng sau này và có thể linh hoạt điều chỉnh và tối ưu hóa theo nhu cầu thực tế.
/*backtest
start: 2019-12-23 08:00:00
end: 2025-01-04 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Advanced Trading Strategy", overlay=true)
// Parâmetros de entrada
shortPeriod = input.int(9, title="Short Period", minval=1)
longPeriod = input.int(21, title="Long Period", minval=1)
volumeThreshold = input.float(1.5, title="Volume Threshold Multiplier", minval=0.1)
volatilityPeriod = input.int(14, title="Volatility Period", minval=1)
// Cálculo das médias móveis
shortSMA = ta.sma(close, shortPeriod)
longSMA = ta.sma(close, longPeriod)
// Cálculo do volume médio
averageVolume = ta.sma(volume, longPeriod)
// Cálculo da volatilidade (ATR - Average True Range)
volatility = ta.atr(volatilityPeriod)
// Condições de compra e venda baseadas em médias móveis
maBuyCondition = ta.crossover(shortSMA, longSMA)
maSellCondition = ta.crossunder(shortSMA, longSMA)
// Verificação do volume
volumeCondition = volume > averageVolume * volumeThreshold
// Condição de volatilidade (volatilidade acima de um certo nível)
volatilityCondition = volatility > ta.sma(volatility, volatilityPeriod)
// Condições finais de compra e venda
buyCondition = maBuyCondition and volumeCondition and volatilityCondition
sellCondition = maSellCondition and volumeCondition and volatilityCondition
// Plotando as médias móveis
plot(shortSMA, title="Short SMA", color=color.red)
plot(longSMA, title="Long SMA", color=color.blue)
// Sinal de compra
if (buyCondition)
strategy.entry("Buy", strategy.long)
// Sinal de venda
if (sellCondition)
strategy.close("Buy")
// Plotando sinais no gráfico
plotshape(series=buyCondition, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(series=sellCondition, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
// Configurando alertas
alertcondition(buyCondition, title="Buy Alert", message="Buy Signal Triggered")
alertcondition(sellCondition, title="Sell Alert", message="Sell Signal Triggered")