OPEN-SOURCE SCRIPT
Telah dikemas kini Tap'n'Slap (TnS) optimized

█ OVERVIEW
Tap'n'Slap (TnS) is a price-action strategy designed for Micro E-mini Nasdaq (MNQ) futures. It identifies Fair Value Gaps (FVGs) — imbalances left by aggressive price movement — and enters when price "taps" back into these zones, aiming to capture the continuation move as price "slaps" toward the next swing pivot.
█ HOW IT WORKS
1. FVG Detection
The strategy scans for bullish and bearish Fair Value Gaps based on a configurable lookback period. FVGs represent institutional footprints where price moved too quickly to fill orders efficiently.
2. Entry Logic
• Long: Price taps into a bullish FVG from above
• Short: Price taps into a bearish FVG from below
Entries are taken with market orders when conditions align.
3. Take Profit Targeting
Profits are targeted at recent swing highs (for longs) or swing lows (for shorts) identified via pivot detection. This provides logical, structure-based exits.
4. Risk Management
• Trailing Stop: Locks in profits as price moves favorably
• Breakeven Protection: Moves stop to entry + offset after initial profit threshold
• Max Stop Cap: Limits worst-case loss per trade (default: 75 points / \$450 on 3 contracts)
█ KEY FEATURES
✓ Pure price action — no lagging indicators
✓ Institutional concept (FVG) for high-probability entries
✓ Dynamic profit targets based on market structure
✓ Built-in risk controls with capped max loss
✓ Optimized for MNQ 5-minute charts
█ SETTINGS
Trade Management
• Trail Points: Distance for trailing stop activation
• BE Profit Points: Profit threshold to move stop to breakeven
• BE Offset Points: Buffer above breakeven for stop placement
• Max Stop Loss: Hard cap on stop distance (protects against gap risk)
FVG Settings
• Lookback Period: How far back to scan for valid FVGs
• Pivot Length: Sensitivity for swing high/low detection
█ USAGE NOTES
• Designed for MNQ (Micro Nasdaq futures) but adaptable to other instruments
• Best performance observed on 5-minute timeframe
• Recommended to backtest on your preferred session times
• Default settings use 3 contracts — adjust position sizing to your risk tolerance
█ DISCLAIMER
This strategy is for educational purposes. Past backtest performance does not guarantee future results. Always use proper risk management and never risk more than you can afford to lose. Paper trade before going live.
Tap'n'Slap (TnS) is a price-action strategy designed for Micro E-mini Nasdaq (MNQ) futures. It identifies Fair Value Gaps (FVGs) — imbalances left by aggressive price movement — and enters when price "taps" back into these zones, aiming to capture the continuation move as price "slaps" toward the next swing pivot.
█ HOW IT WORKS
1. FVG Detection
The strategy scans for bullish and bearish Fair Value Gaps based on a configurable lookback period. FVGs represent institutional footprints where price moved too quickly to fill orders efficiently.
2. Entry Logic
• Long: Price taps into a bullish FVG from above
• Short: Price taps into a bearish FVG from below
Entries are taken with market orders when conditions align.
3. Take Profit Targeting
Profits are targeted at recent swing highs (for longs) or swing lows (for shorts) identified via pivot detection. This provides logical, structure-based exits.
4. Risk Management
• Trailing Stop: Locks in profits as price moves favorably
• Breakeven Protection: Moves stop to entry + offset after initial profit threshold
• Max Stop Cap: Limits worst-case loss per trade (default: 75 points / \$450 on 3 contracts)
█ KEY FEATURES
✓ Pure price action — no lagging indicators
✓ Institutional concept (FVG) for high-probability entries
✓ Dynamic profit targets based on market structure
✓ Built-in risk controls with capped max loss
✓ Optimized for MNQ 5-minute charts
█ SETTINGS
Trade Management
• Trail Points: Distance for trailing stop activation
• BE Profit Points: Profit threshold to move stop to breakeven
• BE Offset Points: Buffer above breakeven for stop placement
• Max Stop Loss: Hard cap on stop distance (protects against gap risk)
FVG Settings
• Lookback Period: How far back to scan for valid FVGs
• Pivot Length: Sensitivity for swing high/low detection
█ USAGE NOTES
• Designed for MNQ (Micro Nasdaq futures) but adaptable to other instruments
• Best performance observed on 5-minute timeframe
• Recommended to backtest on your preferred session times
• Default settings use 3 contracts — adjust position sizing to your risk tolerance
█ DISCLAIMER
This strategy is for educational purposes. Past backtest performance does not guarantee future results. Always use proper risk management and never risk more than you can afford to lose. Paper trade before going live.
Nota Keluaran
This is a backtestable strategy built by reverse-engineering the logic of the **Plyo Tap'n'Slap (TnS)** indicator. It identifies Fair Value Gap (FVG) setups on the 1-minute chart and enters trades when a qualifying tap candle forms within an active FVG zone.Designed and tested on **1-minute MNQ/NQ futures** (CME Micro E-mini Nasdaq-100).
---
## Backtest Results (Dec 2025 – Mar 2026)
| Metric | Value |
|---|---|
| Period | Dec 12, 2025 – Mar 17, 2026 |
| Total Trades | 166 |
| Win Rate | 41% |
| Profit Factor | **1.32** |
| Net P&L | **+$16,049** |
| Avg Win | $984 |
| Avg Loss | $519 |
| Max Loss (single trade) | $1,216 |
| Trades/Day | ~2.6 |
**Properties used:** Commission $0.62/side, Slippage 2 ticks, Recalculate: OFF
---
## How It Works
### 1. Fair Value Gap (FVG) Detection
An FVG forms when three consecutive candles create a price gap — a zone where no trading occurred.
- **Bullish FVG:** `low > high[2]` — price gapped upward, leaving a support zone
- **Bearish FVG:** `high < low[2]` — price gapped downward, leaving a resistance zone
FVGs remain active for up to 30 bars (configurable).
### 2. Tap Candle (V2 Mode)
The strategy looks for a candle that "taps" back into the FVG zone:
- **Bullish FVG → Long setup:** A **bearish candle** (close < open) whose HIGH is inside the FVG, at least 3 bars after the FVG formed, with a 3-point clearance from each FVG edge
- **Bearish FVG → Short setup:** A **bullish candle** (close > open) whose LOW is inside the FVG, same conditions
The tap candle HIGH (long) or LOW (short) becomes the entry price reference.
### 3. Entry
A **market order** is placed on the bar immediately following tap candle detection. Only one setup is tracked at a time. Entry is blocked if:
- Already in a position
- Daily trade limit reached (default: 3)
- After 15:30 ET (late session filter)
### 4. Stop Loss
Fixed at **25 points** from the actual fill price:
- Long: `fill − 25pts`
- Short: `fill + 25pts`
Calculated from the actual fill (not the setup price) so it is always exactly 25pts regardless of slippage.
### 5. Take Profit (OG TP)
The "Original TP" from the TnS model: the **nearest confirmed swing high/low to the left of the tap candle**, found using an 8-bar pivot lookback.
- Long: nearest pivot HIGH above entry to the left → target for the upside move
- Short: nearest pivot LOW below entry to the left → target for the downside move
A minimum R:R of 1.5 is required — if the TP doesn't offer at least 1.5× the SL distance, the setup is skipped.
### 6. Breakeven
Once the trade moves **20 points in profit**, the stop loss is moved to **fill + 5 points** (long) or **fill − 5 points** (short). This happens exactly once — there is no trailing stop.
- BE trigger: +20 points
- BE lock-in: +5 points above/below fill
### 7. End-of-Day Close
All open positions are closed at session end (16:00 ET) to prevent overnight and weekend gap risk. No trades are entered after 15:30 ET.
---
## Settings Reference
### Settings
| Input | Default | Description |
|---|---|---|
| 1m Preset | ON | Activates 25pt SL and V2 mode |
| Stop Loss | 35pts | Used only when preset is OFF |
| FVG Edge Offset | 3pts | Clearance from FVG edges for tap candle |
| V2 Entry Mode | ON | Requires opposite-color tap candle |
| FVG Max Age | 30 bars | FVGs expire after this many bars |
### Filters
| Input | Default | Description |
|---|---|---|
| Filter Weak SL | ON | Rejects setups where the SL lands inside the FVG |
| Min R:R | 1.5 | Skip setups where TP/SL ratio is below this |
| Max Trades/Day | 3 | Hard cap on daily trade count |
### Session
| Input | Default | Description |
|---|---|---|
| Session Filter | ON | Only trade during 09:30–16:00 ET |
| Close at Session End | ON | Force-close position at 16:00 ET |
| No Entries After 15:30 | ON | Blocks late entries prone to EOD gap risk |
### Breakeven
| Input | Default | Description |
|---|---|---|
| Enable Breakeven | ON | Toggle BE entirely |
| Trigger | 20pts | Profit required to activate BE |
| Lock-in | 5pts | Points above/below fill to place BE stop |
---
## Recommended Properties (TradingView Strategy Tester)
| Property | Value |
|---|---|
| Initial Capital | $1,000,000 |
| Order Size | 1 (Quantity) |
| Commission | $0.62 per contract |
| Slippage | **2 ticks** |
| Recalculate After Order Filled | OFF |
| Recalculate On Every Tick | **OFF** |
> ⚠️ Using 8-tick slippage or "On every tick" recalculation will significantly distort backtest results. The correct setting is 2 ticks with both recalculate options unchecked.
---
## Visual Elements
When a trade is active, the chart displays:
- **Blue line** — fill price
- **Red line** — current stop loss (turns orange when BE is active)
- **Green line** — take profit target
- **Faded blue line** — pending setup (detected but not yet entered)
- **Info table** (bottom right) — fill, stop, target, R:R, BE status, session
---
## Alerts
Three alert conditions are available:
- **TnS Long** — fires when a long position opens
- **TnS Short** — fires when a short position opens
- **TnS Closed** — fires when any position closes
Alert messages include fill price, stop, and target.
---
## Important Notes
1. **This is a strategy, not the original indicator.** The original TnS indicator by Plyo is a separate protected script. This strategy approximates its entry logic for backtesting purposes.
2. **Market orders vs limit orders.** The real TnS indicator uses limit orders at the tap candle high/low. This strategy uses a market order on the next bar as a practical approximation for backtesting — real execution may differ slightly.
3. **January 2026 performance was negative** (−$1,804) during a strong NQ uptrend. FVG retracement strategies naturally underperform in strongly trending, one-directional markets.
4. **Forward test results will vary.** The backtest covers ~3 months of data. This is not financial advice.
5. **Designed for 1-minute MNQ/NQ.** Results on other instruments or timeframes have not been tested.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.