Chiến lược chuyển đổi đám mây thông minh

EMA RSI VOLUME Multi-Timeframe
Ngày tạo: 2025-09-25 15:08:48 sửa đổi lần cuối: 2025-09-25 15:08:48
sao chép: 0 Số nhấp chuột: 214
2
tập trung vào
319
Người theo dõi

Chiến lược chuyển đổi đám mây thông minh Chiến lược chuyển đổi đám mây thông minh

️ Đây không phải là một chiến lược trung bình bình thường, mà là một hệ thống giao dịch thông minh để “xem thời tiết”!

Bạn có biết không? Hầu hết các nhà giao dịch đều sử dụng EMA giao dịch trên một khung thời gian duy nhất, giống như việc chỉ nhìn vào thời tiết ngày hôm nay để quyết định những gì sẽ mặc trong tuần này là không đáng tin cậy!

Mở rộng sự chú ý! Bộ lọc ba lần giúp bạn tránh được bẫy đột phá giả

Hướng dẫn thoát hố đã đến!Một trong những điểm thông minh nhất của chiến lược này là tính năng “chấm dứt giao dịch”:

  • Xác nhận số lượng giao hàngCác tín hiệu không có độ phóng đại là “con hổ giấy”, phải vượt quá mức trung bình 20 chu kỳ 1,3 lần để được chấp nhận
  • Bộ lọc rungKhi thị trường đi vào chế độ trục trượt nhàm chán, chiến lược sẽ tự động “tấn công”, tránh bị lật trong bùn.
  • RSI quá mua quá bán: Trên 70 và dưới 30 tự động phanh, không phải là “người cầm đĩa”

Hãy tưởng tượng nó giống như có một trợ lý giao dịch siêu hợp lý, nắm lấy nó khi tâm trạng thị trường mất kiểm soát và nói, “Anh trai, bây giờ không phải là thời gian!”

Bốn trạng thái thị trường, chiến lược để xác định chính xác

Chiến lược này phân chia thị trường thành bốn giai đoạn, giống như phân tích cảm xúc của thị trường:

  • TRENDING (thời kỳ xu hướng)“Được rồi, giao dịch bình thường”.
  • RANGE BOUNDHình ảnh: Đèn vàng, ngừng giao dịch
  • COILING (thời kỳ tăng trưởng)“Đóng đèn, sẵn sàng”
  • LOADING ((thời gian lắp đạn))Hình ảnh: Đèn đỏ, trò chơi lớn sắp được phát hành 🔴

Khi chiến lược hiển thị “RANGE BOUND”, bạn biết rằng bạn nên đi uống cà phê và chờ đợi cơ hội tốt hơn.

Ứng dụng chiến đấu thực tế: Làm cho giao dịch của bạn thông minh hơn

Chiến lược này giúp bạn giải quyết vấn đề gì?

  1. Tạm biệt sự mất mát thường xuyênLưu ý: Có thể giảm tín hiệu giả đáng kể bằng cách xác nhận nhiều lần
  2. Tăng tỷ lệ thắngCác nhà kinh tế đã đưa ra một số biện pháp để ngăn chặn các giao dịch “thời gian lãng phí” trên thị trường.
  3. Kiểm soát cảm xúc“Bạn có thể mua và bán một cách có hệ thống, không dựa vào cảm xúc”

Hãy nhớ rằng, chiến lược giao dịch tốt nhất không phải là để bạn giao dịch nhiều hơn, mà là để bạn giao dịch chính xác hơn! Chiến lược di chuyển trên đám mây này giống như việc bạn có một “bảo vệ giao dịch” chuyên nghiệp, có thể nắm bắt cơ hội và bảo vệ bạn khỏi rủi ro ️

Mã nguồn chiến lược
/*backtest
start: 2025-01-01 00:00:00
end: 2025-09-24 00:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"ETH_USDT","balance":500000}]
*/

//@version=5
strategy("EMA Crossover Cloud w/Range-Bound Filter", overlay=true, default_qty_type=strategy.fixed, default_qty_value=500, initial_capital=50000)

// === INPUTS ===
rsi_length = input.int(14, "RSI Length")
rsi_overbought = input.int(70, "RSI Overbought Level")
rsi_oversold = input.int(30, "RSI Oversold Level")

ema_fast_1m = input.int(10, "1m Cloud Fast EMA")
ema_slow_1m = input.int(20, "1m Cloud Slow EMA")
ema_fast_5m = input.int(10, "5m Cloud Fast EMA") 
ema_slow_5m = input.int(20, "5m Cloud Slow EMA")

volume_multiplier = input.float(1.3, "Volume Multiplier (vs 20-bar avg)")

// === STAY OUT FILTER INPUTS ===
enable_stay_out_filter = input.bool(true, "Enable Stay Out Filter", group="Range-Bound Filter")
enable_filter_for_backtest = input.bool(false, "Apply Filter to Backtest", group="Range-Bound Filter")
range_threshold_pct = input.float(0.5, "Max Range % for Stay Out", group="Range-Bound Filter")
range_period = input.int(60, "Period to Check Range (bars)", group="Range-Bound Filter")
min_bars_in_range = input.int(25, "Min Bars in Range to Trigger", group="Range-Bound Filter")

// === MARKET ATTENTION INPUTS ===
volume_attention_multiplier = input.float(2.0, "Volume Multiplier for Attention", group="Market Attention")
range_attention_threshold = input.float(1.5, "Range ($) Threshold for Attention", group="Market Attention")

// === CALCULATIONS ===
rsi = ta.rsi(close, rsi_length)
volume_avg = ta.sma(volume, 20)
volume_surge = volume > (volume_avg * volume_multiplier)

// Multi-timeframe EMAs
ema_fast_1m_val = ta.ema(close, ema_fast_1m)
ema_slow_1m_val = ta.ema(close, ema_slow_1m)

ema_fast_5m_val = request.security(syminfo.tickerid, "5", ta.ema(close, ema_fast_5m))
ema_slow_5m_val = request.security(syminfo.tickerid, "5", ta.ema(close, ema_slow_5m))

// === STAY OUT FILTER ===
// Range-bound detection: Count consecutive tight-range bars
range_threshold_dollar = close * (range_threshold_pct / 100) // Convert % to dollar amount

// Calculate current bar's range
current_bar_range = high - low

// Count consecutive tight-range bars
var int consecutive_tight_bars = 0

// Check if current bar is within tight range threshold
current_bar_tight = current_bar_range <= range_threshold_dollar

if current_bar_tight
    consecutive_tight_bars := consecutive_tight_bars + 1
else
    consecutive_tight_bars := 0 // Reset counter when range expands

tight_range_bars = consecutive_tight_bars

// Market is range-bound if we've had enough consecutive tight bars
market_range_bound = enable_stay_out_filter and tight_range_bars >= min_bars_in_range
market_ok_to_trade = not market_range_bound

// Separate condition for backtest - can override the filter
backtest_ok_to_trade = enable_filter_for_backtest ? market_ok_to_trade : true

// For display purposes, also calculate recent period range
highest_in_period = ta.highest(high, range_period)
lowest_in_period = ta.lowest(low, range_period)
dollar_range = highest_in_period - lowest_in_period

// Consolidation stage determination
consolidation_stage = tight_range_bars < min_bars_in_range ? "TRENDING" :
                     tight_range_bars <= 60 ? "RANGE BOUND" :
                     tight_range_bars <= 90 ? "COILING" : "LOADING"

consolidation_color = consolidation_stage == "TRENDING" ? color.green :
                     consolidation_stage == "RANGE BOUND" ? color.red :
                     consolidation_stage == "COILING" ? color.yellow : color.orange

// === MARKET ATTENTION GAUGE ===
// Current bar activity indicators
current_range = high - low
recent_volume_avg = ta.sma(volume, 10)
volume_spike = volume > (recent_volume_avg * volume_attention_multiplier)
range_expansion = current_range > range_attention_threshold

// Activity level determination
market_activity = volume_spike and range_expansion ? "ACTIVE" :
                 volume_spike or range_expansion ? "BUILDING" :
                 not market_range_bound ? "QUIET" : "DEAD"

// Cloud Definitions
cloud_1m_bull = ema_fast_1m_val > ema_slow_1m_val
cloud_5m_bull = ema_fast_5m_val > ema_slow_5m_val

// Price position relative to clouds
price_above_5m_cloud = close > math.max(ema_fast_5m_val, ema_slow_5m_val)
price_below_5m_cloud = close < math.min(ema_fast_5m_val, ema_slow_5m_val)

// === CROSSOVER SIGNALS ===
// When 1m fast crosses above/below 1m slow with volume
crossoverBull = ta.crossover(ema_fast_1m_val, ema_slow_1m_val) and volume_surge and backtest_ok_to_trade
crossoverBear = ta.crossunder(ema_fast_1m_val, ema_slow_1m_val) and volume_surge and backtest_ok_to_trade

// Visual warnings for blocked signals (always uses the indicator filter, not backtest filter)
blocked_crossover_bull = ta.crossover(ema_fast_1m_val, ema_slow_1m_val) and volume_surge and market_range_bound
blocked_crossover_bear = ta.crossunder(ema_fast_1m_val, ema_slow_1m_val) and volume_surge and market_range_bound

// === STRATEGY EXECUTION ===

// Crossover entries (original 1/3 size from diamonds)
if crossoverBull
    strategy.entry("Cross Long", strategy.long, qty=167)

if crossoverBear
    strategy.entry("Cross Short", strategy.short, qty=167)

// === EXIT LOGIC ===
// Conservative stops using recent swing levels (not wide cloud stops)
longStop = ta.lowest(low[3], 10)  // Recent swing low
shortStop = ta.highest(high[3], 10)  // Recent swing high

// Position management exits
price_above_1m_cloud = close > math.max(ema_fast_1m_val, ema_slow_1m_val)
price_below_1m_cloud = close < math.min(ema_fast_1m_val, ema_slow_1m_val)

// Exit when price breaks opposite cloud structure
longExit = price_below_1m_cloud and price_below_5m_cloud
shortExit = price_above_1m_cloud and price_above_5m_cloud

// Execute exits for all positions
if strategy.position_size > 0
    if close <= longStop
        strategy.close_all(comment="Stop Loss")
    else if longExit or rsi >= rsi_overbought
        strategy.close_all(comment="Exit Signal")

if strategy.position_size < 0
    if close >= shortStop
        strategy.close_all(comment="Stop Loss")
    else if shortExit or rsi <= rsi_oversold
        strategy.close_all(comment="Exit Signal")

// === VISUAL ELEMENTS ===
plotshape(crossoverBull, "CROSS BULL", shape.triangleup, location.belowbar, 
         color.new(color.aqua, 50), size=size.small, text="↑")
plotshape(crossoverBear, "CROSS BEAR", shape.triangledown, location.abovebar,
         color.new(color.orange, 50), size=size.small, text="↓")

// STAY OUT warnings - signals you should see but not take
plotshape(blocked_crossover_bull, "BLOCKED BULL", shape.triangleup, location.belowbar, 
         color.new(color.gray, 0), size=size.tiny, text="RANGE")
plotshape(blocked_crossover_bear, "BLOCKED BEAR", shape.triangledown, location.abovebar,
         color.new(color.gray, 0), size=size.tiny, text="RANGE")

// Clouds with abbreviated titles
ema1 = plot(ema_fast_1m_val, "1F", color.new(color.blue, 60), linewidth=1, display=display.none)
ema2 = plot(ema_slow_1m_val, "1S", color.new(color.blue, 60), linewidth=1, display=display.none)
fill(ema1, ema2, color=cloud_1m_bull ? color.new(color.green, 85) : color.new(color.red, 85))

ema3 = plot(ema_fast_5m_val, "5F", color.new(color.orange, 40), linewidth=2, display=display.none)
ema4 = plot(ema_slow_5m_val, "5S", color.new(color.orange, 40), linewidth=2, display=display.none)
fill(ema3, ema4, color=cloud_5m_bull ? color.new(color.blue, 85) : color.new(color.purple, 85))



// === ALERTS ===
// Consolidation stage changes
alertcondition(consolidation_stage == "RANGE BOUND" and consolidation_stage[1] == "TRENDING", "Range Bound Alert", "🔴 TSLA RANGE BOUND - Stay Out!")
alertcondition(consolidation_stage == "COILING" and consolidation_stage[1] == "RANGE BOUND", "Coiling Alert", "🟡 TSLA COILING - Watch Close!")
alertcondition(consolidation_stage == "LOADING" and consolidation_stage[1] == "COILING", "Loading Alert", "🟠 TSLA LOADING - Big Move Coming!")
alertcondition(consolidation_stage == "TRENDING" and consolidation_stage[1] != "TRENDING", "Breakout Alert", "🟢 TSLA BREAKOUT - Back to Trading!")

// Market attention changes
alertcondition(market_activity == "ACTIVE" and market_activity[1] != "ACTIVE", "Market Active", "🔥 TSLA ACTIVE - Watch Close!")
alertcondition(market_activity == "DEAD" and market_activity[1] != "DEAD", "Market Dead", "💀 TSLA DEAD - Handle Other Business")

// Blocked signals
alertcondition(blocked_crossover_bull or blocked_crossover_bear, "Signal Blocked", "⚠️ SIGNAL BLOCKED - Range Bound Period")