OPEN-SOURCE SCRIPT

Chop Stopper EMA Px

1 609
CHOP STOPPER EMA

Chop Stopper EMA is a trend-bias filter built on an Exponential Moving Average. Most EMA tools flip the moment price crosses the line, which causes constant false signals in sideways markets. This script only flips its trend state after price has closed on the same side of the EMA for a set number of consecutive bars.

The result is a long/short bias that holds through noise and changes only when a move has shown real follow-through.

━━━━━━━━━━━━━━━━━━━━
HOW IT WORKS
━━━━━━━━━━━━━━━━━━━━
1. The script counts consecutive closes above the EMA and consecutive closes below it.
2. When closes above the EMA reach the Confirmation Bars (N), the state locks to LONG.
3. When closes below the EMA reach N, the state locks to SHORT.
4. Between flips, the state stays unchanged. A single close on the wrong side does not reverse it.
5. While a run is forming but has not yet reached N, the script enters a neutral "building" phase. This is the early warning that a flip may be coming, but it is not yet confirmed.

Every decision uses closed-bar values only, so signals do not repaint once a bar closes.

━━━━━━━━━━━━━━━━━━━━
WHAT YOU SEE ON THE CHART
━━━━━━━━━━━━━━━━━━━━
- EMA line: green in a confirmed long state, red in a confirmed short state, black (neutral) while a new run is building.

תמונת-בזק

- Candle tint: candles take the same colors, including neutral during the building phase.

תמונת-בזק

- Triangle markers: appear once, on the bar where the trend state actually flips.
- Background zone: a faint tint showing the current confirmed state.

━━━━━━━━━━━━━━━━━━━━
SETTINGS
━━━━━━━━━━━━━━━━━━━━
- EMA Length: period of the EMA (default 34).
- Confirmation Bars (N): consecutive closes on one side needed to confirm a flip (default 5). Higher = fewer, slower flips. Lower = faster, but more noise.
- Neutral Trigger Bars (n): consecutive closes needed before the neutral/building color appears (default 1). Should be lower than N to have a visible effect.
- Colors: bullish, bearish, and neutral/building colors are all customizable.

━━━━━━━━━━━━━━━━━━━━
ALERTS
━━━━━━━━━━━━━━━━━━━━
Two alert conditions are included: "flipped LONG" and "flipped SHORT". They trigger when a flip is confirmed.

━━━━━━━━━━━━━━━━━━━━
NOTES
━━━━━━━━━━━━━━━━━━━━
- Because confirmation requires N closes, flips are intentionally delayed. That delay is the trade-off for filtering chop.
- This indicator is a tool for reading trend context, not a complete trading system.

כתב ויתור

המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.