
Chiến lược này là chiến lược giao dịch tần suất cao dựa trên khung thời gian 15 phút. Chiến lược này kết hợp nhiều chỉ báo kỹ thuật, bao gồm đường trung bình động hàm mũ (EMA), chỉ số sức mạnh tương đối (RSI), chỉ số định hướng trung bình (ADX) và phạm vi thực trung bình (ATR) để đạt được tín hiệu giao dịch thông qua sự kết hợp của các chỉ báo này. Nắm bắt chính xác và quản lý rủi ro một cách năng động. Chiến lược này sử dụng thiết kế trực quan rõ ràng, giúp các nhà giao dịch dễ dàng theo dõi tình hình thị trường và tín hiệu giao dịch theo thời gian thực.
Logic cốt lõi của chiến lược này là tạo ra các tín hiệu giao dịch dựa trên sự giao nhau giữa đường EMA nhanh (9 kỳ) và đường EMA chậm (21 kỳ). RSI (14 kỳ) được sử dụng để lọc các vùng quá bán, ADX (14 kỳ) được sử dụng để xác nhận sức mạnh của xu hướng và ATR (14 kỳ) được sử dụng để thiết lập mục tiêu dừng lỗ và lợi nhuận một cách linh hoạt. Sự kết hợp của nhiều chỉ báo kỹ thuật đảm bảo độ tin cậy của tín hiệu giao dịch. Điều kiện vào lệnh bao gồm: dài hạn – đường EMA nhanh cắt lên trên đường EMA chậm và RSI dưới 70, ADX trên 20; ngắn hạn – đường EMA nhanh cắt xuống dưới đường EMA chậm và RSI trên 30, ADX trên 20. Exit sử dụng cài đặt mục tiêu lợi nhuận và dừng lỗ động dựa trên ATR.
Chiến lược này đạt được sự cân bằng giữa việc nắm bắt tín hiệu và kiểm soát rủi ro trong giao dịch tần suất cao thông qua sự kết hợp của nhiều chỉ báo kỹ thuật. Thiết kế trực quan rõ ràng và hỗ trợ tự động hóa hoàn toàn giúp ứng dụng thực tế hơn. Thông qua việc liên tục tối ưu hóa và cải thiện quản lý rủi ro, chiến lược này được kỳ vọng sẽ duy trì hiệu suất ổn định trong các môi trường thị trường khác nhau. Mặc dù có một số rủi ro nhất định, nhưng những rủi ro này có thể kiểm soát được thông qua việc thiết lập thông số hợp lý và các biện pháp kiểm soát rủi ro. Để vận hành thành công chiến lược này, các nhà giao dịch phải hiểu sâu sắc về thị trường và luôn tập trung vào rủi ro.
/*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"}]
*/
//@version=5
strategy("Scalping BTC Ottimizzato - Grafica Chiara", shorttitle="Scalp BTC Opt", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// === 📊 INPUTS ===
// 📈 Medie Mobili
emaFastLength = input.int(9, title="EMA Veloce", minval=1)
emaSlowLength = input.int(21, title="EMA Lenta", minval=1)
// 💡 RSI
rsiLength = input.int(14, title="RSI Length", minval=1)
rsiOverbought = input.int(70, title="RSI Overbought")
rsiOversold = input.int(30, title="RSI Oversold")
// 📊 ATR (Stop Loss e Take Profit)
atrLength = input.int(14, title="ATR Length", minval=1)
stopATR = input.float(1.5, title="Stop Loss (ATR Multiplo)", step=0.1)
takeProfitATR = input.float(2.0, title="Take Profit (ATR Multiplo)", step=0.1)
// 🔀 ADX
adxLength = input.int(14, title="ADX Length", minval=1)
adxSmoothing = input.int(14, title="ADX Smoothing", minval=1)
adxThreshold = input.int(20, title="Soglia ADX per Trend Forte", minval=1)
// === 📊 CALCOLI PRINCIPALI ===
// 📈 Medie Mobili
emaFast = ta.ema(close, emaFastLength)
emaSlow = ta.ema(close, emaSlowLength)
// 💡 RSI
rsi = ta.rsi(close, rsiLength)
// 📊 ATR
atr = ta.atr(atrLength)
// 🔀 ADX tramite DMI con Smoothing
[adx, diPlus, diMinus] = ta.dmi(adxLength, adxSmoothing)
// === 📊 CONDIZIONI LONG E SHORT ===
// ✅ Long: EMA Veloce incrocia EMA Lenta al rialzo, RSI sotto 70, ADX > 20
longCondition = (ta.crossover(emaFast, emaSlow)) and (rsi < rsiOverbought) and (adx > adxThreshold)
// 🔻 Short: EMA Veloce incrocia EMA Lenta al ribasso, RSI sopra 30, ADX > 20
shortCondition = (ta.crossunder(emaFast, emaSlow)) and (rsi > rsiOversold) and (adx > adxThreshold)
// 📉 Stop Loss e Take Profit Dinamici
longStop = strategy.position_avg_price - (atr * stopATR)
longTarget = strategy.position_avg_price + (atr * takeProfitATR)
shortStop = strategy.position_avg_price + (atr * stopATR)
shortTarget = strategy.position_avg_price - (atr * takeProfitATR)
// === 🚀 INGRESSO E USCITA ===
// 🚦 Ingresso LONG
if (longCondition and strategy.position_size == 0)
strategy.entry("Long", strategy.long)
strategy.exit("TakeProfit/StopLoss Long", stop=longStop, limit=longTarget)
// 🚦 Ingresso SHORT
if (shortCondition and strategy.position_size == 0)
strategy.entry("Short", strategy.short)
strategy.exit("TakeProfit/StopLoss Short", stop=shortStop, limit=shortTarget)
// 🛑 USCITA MANUALE BASATA SU RSI
if (rsi > rsiOverbought and strategy.position_size > 0)
strategy.close("Long", comment="RSI Overbought Exit")
if (rsi < rsiOversold and strategy.position_size < 0)
strategy.close("Short", comment="RSI Oversold Exit")
// === 📊 VISUALIZZAZIONE GRAFICA OTTIMIZZATA ===
// 📈 MEDIE MOBILI ANCORATE ALLE CANDELE
plot(emaFast, title="EMA Veloce", color=color.blue, linewidth=2)
plot(emaSlow, title="EMA Lenta", color=color.red, linewidth=2)
// 📊 SEGNALI VISIVI ANCORATI ALLE CANDELE
plotshape(longCondition, title="Segnale Long", style=shape.triangleup, location=location.belowbar, color=color.green, text="Long", size=size.small)
plotshape(shortCondition, title="Segnale Short", style=shape.triangledown, location=location.abovebar, color=color.red, text="Short", size=size.small)
// 📊 RSI (Pannello Separato)
var float rsiPanel = na
rsiPanel := rsi
plot(rsiPanel, title="RSI", color=color.orange, linewidth=2)
hline(rsiOverbought, "RSI Overbought", color=color.red, linestyle=hline.style_dotted)
hline(rsiOversold, "RSI Oversold", color=color.green, linestyle=hline.style_dotted)
// 📊 ADX (Pannello Separato)
var float adxPanel = na
adxPanel := adx
plot(adxPanel, title="ADX", color=color.blue, linewidth=2)
hline(adxThreshold, "ADX Soglia", color=color.gray, linestyle=hline.style_dotted)
// 📊 ATR (Pannello Separato)
var float atrPanel = na
atrPanel := atr
plot(atrPanel, title="ATR", color=color.purple, linewidth=2)
// 🔔 ALERT
alertcondition(longCondition, title="Segnale Long", message="Entra Long Manualmente!")
alertcondition(shortCondition, title="Segnale Short", message="Entra Short Manualmente!")