OPEN-SOURCE SCRIPT
Crypto 1H [Universal - Strict + R:R]

Overview This indicator is a trend-following strategy designed specifically for the 1-hour timeframe (though it works universally). It focuses on high-probability "pullback" entries within an established trend.
What distinguishes this script from standard trend indicators is the integrated Risk:Reward (R:R) Pre-Filter. Before generating a signal, the script calculates the distance to the logical Stop Loss and the logical Take Profit (Resistance/Support). If the trade does not offer a minimum Risk-to-Reward ratio (default 1:2), the signal is suppressed.
How It Works
The strategy follows a strictly defined logical flow:
1. Trend Identification The script uses a Baseline EMA (Default: 50) to determine the trend.
Long: Price is above the 50 EMA, and the 50 EMA is sloping up.
Short: Price is below the 50 EMA, and the 50 EMA is sloping down.
2. The Pullback & Trigger Once a trend is identified, the script waits for price to pull back to the "Trigger" EMA (Default: 21).
The Wait Window: The script utilizes a "Max Wait Bars" logic. Once the price touches the Trigger EMA, it listens for an entry signal for exactly 3 bars. If price lingers too long without reacting, the setup is invalidated to avoid chopping markets.
3. The Risk:Reward Filter (Crucial) This is the final gatekeeper. Even if the trend and candle shape are perfect, the script performs a geometric check:
Stop Loss Calculation: Determined by the lowest low (for longs) or highest high (for shorts) of the last 5 bars, plus a small ATR buffer.
Target Calculation: Determined by the highest high or lowest low of the last 24 bars (local Support/Resistance).
The Math: If the distance to the Target is not at least 2.0x the distance to the Stop Loss, the trade is skipped. This prevents buying right into resistance or selling right into support.
Indicator Features & Settings
Session Filter: Defaults to London and NY sessions (UTC) to ensure volume is present.
Volatility Filter: Requires the signal candle to have a minimum body size (0.15% of price) to avoid "doji" or low-momentum entries.
Visuals:
White Line: 50 EMA (Trend)
Yellow Line: 21 EMA (Momentum Trigger)
Labels: Green (Long) and Red (Short) entry markers.
Red Crosses: These indicate exactly where the suggested Stop Loss was located at the moment of entry.
Risk Disclaimer This tool is designed for educational and analytical purposes. The "Strict R:R" filter does not guarantee profit; it simply filters out setups that mathematically do not fit the specified ratio based on historical price action. Always perform your own analysis.
What distinguishes this script from standard trend indicators is the integrated Risk:Reward (R:R) Pre-Filter. Before generating a signal, the script calculates the distance to the logical Stop Loss and the logical Take Profit (Resistance/Support). If the trade does not offer a minimum Risk-to-Reward ratio (default 1:2), the signal is suppressed.
How It Works
The strategy follows a strictly defined logical flow:
1. Trend Identification The script uses a Baseline EMA (Default: 50) to determine the trend.
Long: Price is above the 50 EMA, and the 50 EMA is sloping up.
Short: Price is below the 50 EMA, and the 50 EMA is sloping down.
2. The Pullback & Trigger Once a trend is identified, the script waits for price to pull back to the "Trigger" EMA (Default: 21).
The Wait Window: The script utilizes a "Max Wait Bars" logic. Once the price touches the Trigger EMA, it listens for an entry signal for exactly 3 bars. If price lingers too long without reacting, the setup is invalidated to avoid chopping markets.
3. The Risk:Reward Filter (Crucial) This is the final gatekeeper. Even if the trend and candle shape are perfect, the script performs a geometric check:
Stop Loss Calculation: Determined by the lowest low (for longs) or highest high (for shorts) of the last 5 bars, plus a small ATR buffer.
Target Calculation: Determined by the highest high or lowest low of the last 24 bars (local Support/Resistance).
The Math: If the distance to the Target is not at least 2.0x the distance to the Stop Loss, the trade is skipped. This prevents buying right into resistance or selling right into support.
Indicator Features & Settings
Session Filter: Defaults to London and NY sessions (UTC) to ensure volume is present.
Volatility Filter: Requires the signal candle to have a minimum body size (0.15% of price) to avoid "doji" or low-momentum entries.
Visuals:
White Line: 50 EMA (Trend)
Yellow Line: 21 EMA (Momentum Trigger)
Labels: Green (Long) and Red (Short) entry markers.
Red Crosses: These indicate exactly where the suggested Stop Loss was located at the moment of entry.
Risk Disclaimer This tool is designed for educational and analytical purposes. The "Strict R:R" filter does not guarantee profit; it simply filters out setups that mathematically do not fit the specified ratio based on historical price action. Always perform your own analysis.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.