Turtle Soup Reversal Map [AGPro Series]Turtle Soup Reversal Map
🔹 Overview
Turtle Soup Reversal Map is a mean-reversion pattern detector inspired by Linda Raschke's classic "Turtle Soup" setup — a counter-attack on failed 20-bar breakouts. When price pierces a multi-bar extreme and then closes back inside the prior range, institutional traders often interpret it as trapped breakout participants being flushed. This script automates the detection, qualifies each setup with a transparent 0–100 score, and projects a reference target alongside an auto-resolving rejection zone. It is designed for traders who want a disciplined, rule-based way to spot failed breakouts without drawing them manually.
🔹 Unique Edge
Unlike generic liquidity-sweep or wick-rejection indicators, Turtle Soup Reversal Map is built around Raschke's specific 20-bar-extreme rule — a pattern with decades of documented performance in swing-trading literature. Three characteristics separate it from similar tools:
• Strict N-bar-extreme definition (not a simple swing-high/low fade). Price must violate the exact prior-lookback extreme, not just a minor pivot.
• Five-component adaptive quality score — wick rejection, volume spike, overshoot magnitude, higher-timeframe trend alignment, and key-level proximity. Each component is a transparent weighted contribution, with clear A+ / A / B / C grades.
• Full lifecycle state engine — Pending → Fired → Target/Stop/Invalidated. Setups that do not confirm within their window are auto-invalidated (not left hanging), and live win-rate plus average R-multiple are tracked over the most recent resolved setups.
🔹 Methodology
The script continuously monitors for price piercing the highest high or lowest low of the prior N bars (default 20, range 10–50). When a sweep occurs, a Pending setup is created. Confirmation is then evaluated in one of two user-selectable modes:
• Same-Bar Close — the violating bar must close back inside the prior range on the same bar (faster, more signals).
• Next-Bar Close — Raschke's original specification; the next bar must close back inside the prior range (slower, higher reliability).
If confirmation fires, the setup becomes Fired and a reference target is projected from the confirmation close (default 2.5 × ATR(14)). Stop is placed at the sweep extreme plus a configurable ATR buffer. Setups that fail to confirm within their window, or where price overshoots the stop before confirmation, are automatically invalidated.
The quality score blends: wick-to-range ratio at the extreme bar, relative volume spike versus its 20-bar average, overshoot magnitude (ATR-normalized with a sweet-spot curve), counter-trend alignment against a user-defined higher timeframe, and proximity to round numbers or recent pivot levels.
🔹 Signals & Alerts
The script produces three alert types, all configurable:
• Pending — sweep detected, awaiting confirmation.
• Fired — confirmation closed back inside prior range.
• Invalidated — setup dismissed due to overshoot or window timeout.
Each alert message includes direction (Bull/Bear), current grade, ticker, and timeframe. Fired setups are visualized with a labeled confirmation marker, a dashed target-projection line, a dotted stop-reference line, and an auto-closing rejection zone. Labels display the Soup-Bull / Soup-Bear name, grade, and numeric score.
🔹 Key Inputs
• Lookback Bars — size of the extreme window (default 20, range 10–50).
• Confirmation Mode — Same-Bar Close or Next-Bar Close.
• Invalidation Distance (ATR) — stop buffer beyond the sweep extreme (default 0.5).
• Target Projection (ATR) — reference reversal target distance from entry (default 2.5).
• Quality Score Components — each of the five score components can be toggled independently for custom configurations.
• HTF for Trend — higher timeframe used for the trend-alignment component (default 240 min).
• Stats Sample Size — rolling window of resolved setups used for win-rate and average reward metrics (default 30).
• Visual & Panel Options — zones, lines, labels, target projection, panel location, font sizes, and per-element toggles.
🔹 How to Use
1. Apply to any liquid instrument and timeframe. The pattern's rule set is symbol-agnostic but performs differently across assets — review the live Win Rate and Avg Reward metrics in the panel to calibrate expectations.
2. Watch the Status field in the panel. Idle means no active setup; Pending Bull/Bear means a sweep has occurred and the script is waiting for confirmation; Fired Bull/Bear means confirmation closed and a target has been projected.
3. Filter setups by grade. A+ and A setups have stronger confluence — particularly wick rejection, volume, and HTF alignment. B setups are acceptable under favorable market regimes; C grades are educational only.
4. Treat the target projection as a reference, not a trade instruction. The stop reference line marks where the structural invalidation lies. Always combine with your own risk management.
5. The historical Win Rate is computed over the last N resolved setups on the current chart; it reflects the pattern's fit with the current symbol and timeframe, not a guarantee.
🔹 Limitations & Transparency
This indicator identifies historical setups algorithmically. It does not predict future price movement, and no indicator does. Turtle Soup is a counter-trend mean-reversion pattern — in strong trending regimes, false signals increase; in consolidation and range-bound conditions, it performs best. The displayed Win Rate and Avg Reward are historical, rolling, chart-dependent, and should not be interpreted as future expectations. Target and stop references are geometric projections based on ATR, not optimized parameters.
🔹 Risk Disclosure
This script is a technical analysis tool for educational and research purposes. It is not a trading strategy, not a recommendation, and not financial advice. Past performance does not guarantee future results. Always conduct your own analysis and use proper risk management. Trade at your own risk. Indicator

EMA bands + leledc + bollinger bands trend following strategy v2The basics:
In its simplest form, this strategy is a positional trend following strategy which enters long when price breaks out above "middle" EMA bands and closes or flips short when price breaks down below "middle" EMA bands. The top and bottom of the middle EMA bands are calculated from the EMA of candle highs and lows, respectively.
The idea is that entering trades on breakouts of the high EMAs and low EMAs rather than the typical EMA based on candle closes gives a bit more confirmation of trend strength and minimizes getting chopped up. To further reduce getting chopped up, the strategy defaults to close on crossing the opposite EMA band (ie. long on break above high EMA middle band and close below low EMA middle band).
This strategy works on all markets on all timeframes, but as a trend following strategy it works best on markets prone to trending such as crypto and tech stocks. On lower timeframes, longer EMAs tend to work best (I've found good results on EMA lengths even has high up to 1000), while 4H charts and above tend to work better with EMA lengths 21 and below.
As an added filter to confirm the trend, a second EMA can be used. Inputting a slower EMA filter can ensure trades are entered in accordance with longer term trends, inputting a faster EMA filter can act as confirmation of breakout strength.
Bar coloring can be enabled to quickly visually identify a trend's direction for confluence with other indicators or strategies.
The goods:
Waiting for the trend to flip before closing a trade (especially when a longer base EMA is used) often leaves money on the table. This script combines a number of ways to identify when a trend is exhausted for backtesting the best early exits.
"Delayed bars inside middle bands" - When a number of candle's in a row open and close between the middle EMA bands, it could be a sign the trend is weak, or that the breakout was not the start of a new trend. Selecting this will close out positions after a number of bars has passed
"Leledc bars" - Originally introduced by glaz, this is a price action indicator that highlights a candle after a number of bars in a row close the same direction and result in greatest high/low over a period. It often triggers when a strong trend has paused before further continuation, or it marks the end of a trend. To mitigate closing on false Leledc signals, this strategy has two options: 1. Introducing requirement for increased volume on the Leledc bars can help filter out Leledc signals that happen mid trend. 2. Closing after a number of Leledc bars appear after position opens. These two options work great in isolation but don't perform well together in my testing.
"Bollinger Bands exhaustion bars" - These bars are highlighted when price closes back inside the Bollinger Bands and RSI is within specified overbought/sold zones. The idea is that a trend is overextended when price trades beyond the Bollinger Bands. When price closes back inside the bands it's likely due for mean reversion back to the base EMA in which this strategy will ideally re-enter a position. Since the added RSI requirements often make this indicator too strict to trigger a large enough sample size to backtest, I've found it best to use "non-standard" settings for both the bands and the RSI as seen in the default settings.
"Buy/Sell zones" - Similar to the idea behind using Bollinger Bands exhaustion bars as a closing signal. Instead of calculating off of standard deviations, the Buy/Sell zones are calculated off multiples of the middle EMA bands. When trading beyond these zones and subsequently failing back inside, price may be due for mean reversion back to the base EMA. No RSI filter is used for Buy/Sell zones.
If any early close conditions are selected, it's often worth enabling trade re-entry on "middle EMA band bounce". Instead of waiting for a candle to close back inside the middle EMA bands, this feature will re-enter position on only a wick back into the middle bands as will sometimes happen when the trend is strong.
Any and all of the early close conditions can be combined. Experimenting with these, I've found can result in less net profit but higher win-rates and sharpe ratios as less time is spent in trades.
The deadly:
The trend is your friend. But wouldn't it be nice to catch the trends early? In ranging markets (or when using slower base EMAs in this strategy), waiting for confirmation of a breakout of the EMA bands at best will cause you to miss half the move, at worst will result in getting consistently chopped up. Enabling "counter-trend" trades on this strategy will allow the strategy to enter positions on the opposite side of the EMA bands on either a Leledc bar or Bollinger Bands exhaustion bar. There is a filter requiring either a high/low (for Leledc) or open (for BB bars) outside the selected inner or outer Buy/Sell zone. There are also a number of different close conditions for the counter-trend trades to experiment with and backtest.
There are two ways I've found best to use counter-trend trades
1. Mean reverting scalp trades when a trend is clearly overextended. Selecting from the first 5 counter-trend closing conditions on the dropdown list will usually close the trades out quickly, with less profit but less risk.
2. Trying to catch trends early. Selecting any of the close conditions below the first 5 can cause the strategy to behave as if it's entering into a new trend (from the wrong side).
This feature can be deadly effective in profiting from every move price makes, or deadly to the strategy's PnL if not set correctly. Since counter-trend trades open opposite the middle bands, a stop-loss is recommended to reduce risk. If stop-losses for counter-trend trades are disabled, the strategy will hold a position open often until liquidation in a trending market if th trade is offsides. Note that using a slower base EMA makes counter-trend stop-losses even more necessary as it can reduce the effectiveness of the Buy/Sell zone filter for opening the trades as price can spend a long time trending outside the zones. If faster EMAs (34 and below) are used with "Inner" Buy/Zone filter selected, the first few closing conditions will often trigger almost immediately closing the trade at a loss.
The niche:
I've added a feature to default into longs or shorts. Enabling these with other features (aside from the basic long/short on EMA middle band breakout) tends to break the strategy one way or another. Enabling default long works to simulate trying to acquire more of the asset rather than the base currency. Enabling default short can have positive results for those high FDV, high inflation coins that go down-only for months at a time. Otherwise, I use default short as a hedge for coins that I hold and stake spot. I gain the utility and APR of staking while reducing the risk of holding the underlying asset by maintaining a net neutral position *most* of the time.
Disclaimer:
This script is intended for experimenting and backtesting different strategies around EMA bands. Use this script for your live trading at your own risk. I am a rookie coder, as such there may be errors in the code that cause the strategy to behave not as intended. As far as I can tell it doesn't repaint, but I cannot guarantee that it does not. That being said if there's any question, improvements, or errors you've found, drop a comment below! Strategy

Indicator

Indicator

Indicator
