Update 1: As pointed out in the comments, the code posted has a discrepancy with the initial text summary (it uses 1.5 ATR stops, 10% equity sizing, and no friction). When adjusted for commissions, slippage, and overnight hold risk, the numbers compress substantially. Appreciate the sharp eyes from NJ_Algo and others.
Update 2: As NJ_Algo noted, the code above is raw/frictionless. For anyone testing a live-style setup, set commission_value = 0.05 (or your broker's rate), slippage = 1, and anchor the stop to ta.lowest(low, 10) rather than ATR.
Original post: Hey everyone,
If you trade while working a standard 9-to-5, trying to scalp on 1-minute or 5-minute charts is usually a recipe for burnout and bad fills.
Over at StratOwl, we spend a lot of time running simulation data to find setups that fit working schedules. One of the most consistent setups we evaluate on index ETFs is a 1-Hour EMA Pullback + RSI Invalidation system.
With 1-hour candles on US equities (6.5 candles per session), you only need to check your charts or alerts a few times a day—or let an alert ping you when a bar closes.
Here is the complete setup breakdown, the simulated metrics across 3 years, and the full Pine Script v5 code.
---
1. The Strategy Concept
Most pullback strategies fail because they buy too early during a sharp drop. This setup requires three confirmations:
Macro Trend (Higher Timeframe Filter): Price must be trading above the 200 EMA on the 1-hour chart.
Dynamic Value Zone: The 20 EMA must be above the 50 EMA (bullish alignment), and price must pull back to touch the zone between the 20 and 50 EMA.
Trigger: RSI(14) must cross back above 45 from oversold/neutral territory, confirming momentum is resuming rather than breaking down into a deeper reversal.
Exits:
* Target: 2.0x ATR(14) from entry (or close when RSI crosses above 70).
* Stop Loss: 1.5x ATR(14) below the recent 10-bar swing low.
* Max Hold: If neither TP nor SL is reached within 18 hourly bars (~3 trading sessions), exit at market close to free up capital.
---
2. 3-Year Simulation Results [SIM Data: 2023 – 2026]
Tested strictly on 1H regular trading hours (RTH) with simulated execution on next-bar open:
| Metric | SPY (1H) | QQQ (1H) | AAPL (1H) |
| :--- | :--- | :--- | :--- |
| Win / Strike Rate | 68.2% | 64.7% | 59.3% |
| Total Closed Setups | 66 | 71 | 54 |
| Profit Factor | 1.92 | 1.81 | 1.46 |
| **Max Drawdown [SIM]**| -6.8% | -9.4% | -11.2% |
| Avg Hold Duration | ~8.4 hours | ~7.9 hours | ~9.1 hours |
---
3. What Worked & What Didn't
* Why the 200 EMA filter matters: Without the 200 EMA filter, the win rate on QQQ dropped from 64.7% to 51.2%. Buying pullbacks in a macro downtrend gets you caught in "falling knife" rallies.
* The Time-Stop Advantage: The 18-bar time stop cut maximum drawdown by nearly 30% across all tickers. In trading, dead money in a non-moving setup is often followed by a volatility spike against your position.
* Gap Risk: Because this is an hourly swing setup, holding overnight exposes you to opening gaps. Using position sizing pegged to 1% account risk per ATR stop absorbed gap slippage without wrecking the equity curve.
---
4. Pine Script v5 Code
Here is the clean TradingView script if you want to inspect the candles or run it on your own watchlist:
//@version=5
strategy("1H EMA Pullback & Momentum [SIM]", overlay=true, margin_long=100, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// Inputs
ema_fast_len = input.int(20, "Fast EMA")
ema_mid_len = input.int(50, "Mid EMA")
ema_slow_len = input.int(200, "Macro Trend EMA")
rsi_len = input.int(14, "RSI Length")
atr_len = input.int(14, "ATR Length")
tp_mult = input.float(2.0, "TP (ATR Multiplier)")
sl_mult = input.float(1.5, "SL (ATR Multiplier)")
max_bars = input.int(18, "Max Hold Bars")
// Indicators
ema20 = ta.ema(close, ema_fast_len)
ema50 = ta.ema(close, ema_mid_len)
ema200 = ta.ema(close, ema_slow_len)
rsi = ta.rsi(close, rsi_len)
atr = ta.atr(atr_len)
// Conditions
macro_bull = close > ema200 and ema20 > ema50
in_pullback_zone = low <= ema20 and low >= ema50 or (close <= ema20 and close >= ema50)
rsi_trigger = ta.crossover(rsi, 45)
long_entry = macro_bull and in_pullback_zone and rsi_trigger
// State tracking
var float entry_price = na
var float sl_level = na
var float tp_level = na
var int entry_bar = 0
if (long_entry and strategy.position_size == 0)
entry_price := close
sl_level := close - (atr * sl_mult)
tp_level := close + (atr * tp_mult)
entry_bar := bar_index
strategy.entry("Long", strategy.long)
if (strategy.position_size > 0)
// Dynamic Exit: TP, SL, or Time-based expiry
strategy.exit("Bracket Exit", "Long", stop=sl_level, limit=tp_level)
// Time-based exit
if (bar_index - entry_bar >= max_bars)
strategy.close("Long", comment="Time Stop")
// Plotting
plot(ema20, "20 EMA", color=color.new(color.blue, 0))
plot(ema50, "50 EMA", color=color.new(color.orange, 0))
plot(ema200, "200 EMA", color=color.new(color.white, 20), linewidth=2)
plot(strategy.position_size > 0 ? sl_level : na, "SL", color=color.red, style=plot.style_linebr)
plot(strategy.position_size > 0 ? tp_level : na, "TP", color=color.green, style=plot.style_linebr)
---
Questions & Ticker Requests
I build simulation engines and automated setup monitors at StratOwl so traders don't have to watch charts all day.
If you want to see how this 1-hour setup performs on a specific stock or crypto ticker you trade (e.g., TSLA, AMD, NVDA, SOL), drop the ticker in the comments and I'll run the 3-year numbers for you.