这个策略是一个结合了多个技术指标的短线交易系统,主要基于RSI(相对强弱指标)、EMA(指数移动平均线)和ATR(真实波幅均值)进行交易信号的生成。策略通过多重指标的配合使用,既考虑了价格趋势,又关注了市场波动性,同时还可以选择性地加入成交量过滤,从而构建了一个相对完整的交易决策体系。
策略采用了三重过滤机制来确保交易信号的可靠性: 1. 趋势判断: 通过快速EMA(5周期)和慢速EMA(21周期)的交叉关系判断当前市场趋势 2. 超买超卖: 使用RSI指标(14周期)在45和55的区间内进行反转交易 3. 波动性确认: 利用ATR指标判断当前市场波动是否适合交易,要求ATR值大于其移动平均值的0.8倍 4. 可选择性地添加成交量过滤条件,要求成交量大于其20周期均线
多空信号的具体触发条件如下: - 做多条件: 快速EMA在慢速EMA上方 + RSI低于45 + 波动性条件满足 - 做空条件: 快速EMA在慢速EMA下方 + RSI高于55 + 波动性条件满足
这是一个设计合理的多指标交易系统,通过多重确认机制提高了交易的可靠性。策略的核心优势在于结合了趋势和波动性分析,同时考虑了市场的多个维度。虽然存在一定的优化空间,但总体来说是一个值得进一步完善和实践的交易策略。
/*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")