
Chiến lược này là một hệ thống giao dịch đường ngắn kết hợp nhiều chỉ số kỹ thuật để tạo ra tín hiệu giao dịch dựa trên RSI (chỉ số tương đối mạnh), EMA (chỉ số di chuyển trung bình) và ATR (trung bình sóng thực). Chiến lược này sử dụng nhiều chỉ số kết hợp, xem xét xu hướng giá cả và sự biến động của thị trường, đồng thời có thể chọn lọc thêm bộ lọc giao dịch, để xây dựng một hệ thống quyết định giao dịch tương đối hoàn chỉnh.
Chiến lược này sử dụng cơ chế lọc ba lần để đảm bảo tín hiệu giao dịch được tin cậy:
Các điều kiện kích hoạt cụ thể của tín hiệu đa không gian như sau:
Đây là một hệ thống giao dịch đa chỉ số được thiết kế hợp lý, tăng độ tin cậy giao dịch thông qua cơ chế xác nhận nhiều lần. Ưu điểm cốt lõi của chiến lược là kết hợp phân tích xu hướng và biến động, đồng thời xem xét nhiều chiều của thị trường. Mặc dù có một số không gian tối ưu hóa, nhưng nói chung là một chiến lược giao dịch đáng để hoàn thiện và thực hành hơn nữa.
/*backtest
start: 2024-12-12 00:00:00
end: 2024-12-19 00:00:00
period: 3m
basePeriod: 3m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Scalp Master BTCUSDT Strategy", overlay=true, max_labels_count=500, initial_capital=10000, commission_type=strategy.commission.percent, commission_value=0.1)
//=== Kullanıcı Parametreleri ===
rsi_length = input.int(14, "RSI Length")
rsi_lower_band = input.float(45, "RSI Lower Band")
rsi_upper_band = input.float(55, "RSI Upper Band")
ema_fast_length = input.int(5, "Fast EMA")
ema_slow_length = input.int(21, "Slow EMA")
atr_period = input.int(14, "ATR Period")
atr_mult = input.float(0.8, "ATR Multiplier")
volume_filter = input.bool(false, "Enable Volume Filter")
volume_period = input.int(20, "Volume SMA Period")
volume_mult = input.float(1.0, "Volume Threshold Multiplier")
//=== Hesaplamalar ===
// RSI Hesabı
rsi_val = ta.rsi(close, rsi_length)
// ATR Tabanlı Volatilite Kontrolü
atr_val = ta.atr(atr_period)
volatility_ok = atr_val > (ta.sma(atr_val, atr_period) * atr_mult)
// EMA Trend
ema_fast_val = ta.ema(close, ema_fast_length)
ema_slow_val = ta.ema(close, ema_slow_length)
trend_up = ema_fast_val > ema_slow_val
trend_down = ema_fast_val < ema_slow_val
// Hacim Filtresi
volume_sma = ta.sma(volume, volume_period)
high_volume = volume > (volume_sma * volume_mult)
// Sinyal Koşulları (Aynı Alarm Koşulları)
long_signal = trend_up and rsi_val < rsi_lower_band and volatility_ok and (volume_filter ? high_volume : true)
short_signal = trend_down and rsi_val > rsi_upper_band and volatility_ok and (volume_filter ? high_volume : true)
//=== Strateji Mantığı ===
// Basit bir yaklaşım:
// - Long sinyali gelince önce Short pozisyonu kapat, sonra Long pozisyona gir.
// - Short sinyali gelince önce Long pozisyonu kapat, sonra Short pozisyona gir.
if (long_signal)
strategy.close("Short") // Eğer varsa Short pozisyonu kapat
strategy.entry("Long", strategy.long)
if (short_signal)
strategy.close("Long") // Eğer varsa Long pozisyonu kapat
strategy.entry("Short", strategy.short)
// EMA Çizimleri
plot(ema_fast_val, title="Fast EMA (5)", color=color.new(color.orange, 0), linewidth=2)
plot(ema_slow_val, title="Slow EMA (21)", color=color.new(color.blue, 0), linewidth=2)
// Sinyal İşaretleri
plotshape(long_signal, title="BUY Signal", location=location.belowbar,
color=color.new(color.green, 0), style=shape.labelup, text="BUY")
plotshape(short_signal, title="SELL Signal", location=location.abovebar,
color=color.new(color.red, 0), style=shape.labeldown, text="SELL")
// Arka plan renklendirmesi
bgcolor(long_signal ? color.new(color.green, 85) : short_signal ? color.new(color.red, 85) : na)
// Alarm Koşulları (İndikatör ile aynı koşullar)
alertcondition(long_signal, title="Buy Alert", message="BTCUSDT Scalp Master: Buy Signal Triggered")
alertcondition(short_signal, title="Sell Alert", message="BTCUSDT Scalp Master: Sell Alert Triggered")