Poor trend[ALT_analyst]Poor trend
ATTENTION: This script is STRICTLY for market environment recognition (Regime Filter). It does NOT provide entry signals or trading recommendations.
■Overview
This indicator, "Poor trend ", is an administrative filter designed not to search for entry signals, but to logically validate and enforce the decision to "take no position."
In directional trading, significant drawdowns occur during low-quality, trendless environments. This script continuously quantifies market stagnation across five independent modules. By mathematically demonstrating the degradation of a directional edge, it provides an objective baseline to suppress unnecessary entries and avoid whipsaw losses.
■Mathematical Proof of Edge Degradation in "Poor Trends"
The mathematical edge of a directional strategy is governed by the Expected Value equation:
Expected Value = (Win Probability * Average Win) - (Loss Probability * Average Loss)
For directional trading (trend-following or breakout), a "Poor Trend" mathematically degrades this equation. When market action exhibits low volatility, restricted ranges, and low liquidity, the probability of a directional breakout (Win Probability) decreases. Simultaneously, the shrinking ATR compresses the potential profit margin (Average Win). As the Average Win approaches transaction costs (spread/commission) and the Win Probability drops, the Expected Value strictly converges toward a negative figure. This script objectively flags the exact parameters where this mathematical degradation occurs.
5 Danger Detection Modules (Calculation Logic & Output Examples)
The script evaluates five independent conditions to calculate a total "Danger Score" (0 to 5).
1. Lack of Trend (ADX)
Calculation Logic:
is_low_adx = adx < adx_threshold (Default: 20)
Why this calculation: The Average Directional Index (ADX) measures absolute trend strength. A value below 20 statistically demonstrates that price action is dominated by noise rather than a directional vector, lowering the Win Probability.
Actual Output Example: If the current ADX value is 15.5, the logic evaluates 15.5 < 20. This returns true (Boolean), adding 1 to the Danger Score.
2. Low Volume (SMA)
Calculation Logic:
is_low_vol = sma(volume, 20) < sma(volume, 50)
Why this calculation: Compares short-term versus long-term volume averages. A drop in short-term volume detects liquidity withdrawal from the market, mathematically increasing slippage risks and transaction costs.
Actual Output Example: If the 20-period SMA volume is 1,200 and the 50-period SMA is 1,500, the logic evaluates 1200 < 1500. This returns true, adding 1 to the Danger Score.
3. Volatility Shrinking (Z-Score)
Calculation Logic:
width_z = (st_width - width_mean) / width_std < 0.0
Why this calculation: Standardizes the current ATR band width against its 50-period history using a Z-score. A negative Z-score proves statistical volatility compression, severely limiting the Average Win potential.
Actual Output Example: If the current band width is 10, the 50-period mean is 15, and the standard deviation is 5. The Z-score is (10 - 15) / 5 = -1.0. Since -1.0 < 0.0, it returns true, adding 1 to the Danger Score.
4. Unstable Direction (Whipsaw)
Calculation Logic: flip_count >= whip_threshold (Default: 3)
Why this calculation: Counts how many times the Supertrend direction has flipped over the last 20 periods. Frequent flips empirically prove directional instability and high whipsaw risk.
Actual Output Example: If the Supertrend has changed direction 4 times within the last 20 bars, the logic evaluates 4 >= 3. This returns true, adding 1 to the Danger Score.
5. Price Stuck (Trapped Inside Bands)
Calculation Logic:
is_trapped = (high < upperBand) and (low > lowerBand)
Why this calculation: Confirms both the high and low of the current candle are completely confined within the ATR boundaries. This proves zero momentum exists to break statistical limits.
Actual Output Example: If the Upper Band is 110, Lower Band is 90, Candle High is 105, and Candle Low is 95. The logic evaluates (105 < 110) and (95 > 90). Both are true, returning true, adding 1 to the Danger Score.
■Visual & UI Specifications
Danger Ribbon: The space between the Normal and Inverse lines fills with color based on the Danger Score (1: Yellow to 5: Dark Red). A score of 0 ("PEACE") renders the ribbon fully transparent.
Sparse Labels: To eliminate chart clutter, status labels ("WAIT", "STOP", "MAX DANGER") are strictly plotted only on the exact bar where the Danger Score increases or resets to 0.
Dashboard Table: A real-time matrix at the bottom right displays the precise binary status ("DETECTED" or "CLEAR") of all 5 modules, providing instantaneous administrative clarity on market conditions.
■Operating Policy
When the Danger Score is active (Ribbon is colored, modules are DETECTED), the statistical Expected Value for directional trading is compromised. Utilize this indicator strictly as an objective administrative filter to halt new entries and justify capital preservation.
Disclaimer
The information and scripts provided in this publication are for educational and informational purposes only. They do not constitute financial, investment, or trading advice. Trading in financial markets involves a high degree of risk, and you may lose some or all of your capital. Past performance is not necessarily indicative of future results. The author assumes no responsibility or liability for any trading losses incurred as a result of using this script. Please conduct your own due diligence and make trading decisions at your own risk.
Indicator

SuperTrend Engine [Quantum Algo]SuperTrend Engine
====================================================
🔶 OVERVIEW
SuperTrend Engine is a volatility-adaptive SuperTrend indicator built on one idea: every SuperTrend gives you signals — this one shows you the whipsaws it saved you from, tells you its real win rate on your chart, and admits when it is wrong.
The engine self-tunes its factor with a fully transparent formula, confirms flips through a Whipsaw Shield that absorbs fake-outs and marks every one it absorbed, stamps every buy and sell flip with its live, honestly-computed win rate on the current symbol, settles every marker into its real outcome ten bars later, and draws the trade geometry — entry, trailing stop, one-R and two-R references — the moment a flip confirms.
🔶 WHAT IS A SUPERTREND?
A SuperTrend is a trailing stop built from the Average True Range: a band placed a volatility-scaled distance from price that ratchets in the trend's favor and never retreats. While price holds above the band, the trend is up and the band trails below as a stop; a close through the band flips the state. It is one of the most followed trend-following tools in retail trading — and its famous weakness is the whipsaw: sideways markets flip it back and forth, and a fixed factor that survives chop is too slow in trends. This engine is built specifically against that weakness.
🔶 WHY THIS SCRIPT IS ORIGINAL
1. The Whipsaw Shield — visible absorbed fake-outs. A flip only confirms when the close clears the opposite band by a volatility margin. When the raw trail flips and reverses before clearing it, the engine holds its direction and prints a small ghost marker where the whipsaw died, with a running Whipsaws Shielded counter in the dashboard. Other tools try to reduce whipsaws quietly; to our knowledge, none renders the failures it absorbed. Here the evidence is on the chart.
2. Honest per-symbol flip statistics. Every flip is stamped with its live win rate on this exact symbol and timeframe — shrinkage-adjusted so thin history cannot show fake confidence, with a Wilson confidence bound and sample count in the hover tooltip. The indicator audits itself in public instead of asserting signals.
3. Markers that settle into their outcome. Each buy and sell marker resolves ten bars later: the trend color if the flip delivered, faded gray if it failed. Scroll any chart and read the engine's true track record directly off the markers — including the losses.
4. Transparent adaptation, not a black box. The factor self-tunes between your two bounds using Perry Kaufman's Efficiency Ratio — tight when price moves cleanly, wide in chop — and the dashboard shows the live factor and efficiency reading every bar. The adaptation can be verified with a calculator; nothing asks for trust.
5. A trade plan, not just a line. On every confirmed flip the engine draws the entry, the trailing stop, and one-R and two-R reference levels, and the dashboard tracks the open signal's running R-multiple live.
6. A breathing chart. The glow between price and trail intensifies with trend distance and fades as price returns to the stop, grade-A flips (volume, efficiency, and a decisive break together) print in the accent color, and the whole layer stays capped and clean.
🔶 HOW IT WORKS
Adaptive trail: Classic ratcheting SuperTrend bands are computed from the Average True Range, with the factor interpolated between the trend bound and the chop bound by the Efficiency Ratio — the ratio of net price movement to total path length over the lookback.
Whipsaw Shield: The raw band flip is treated as a candidate, not a signal. Only a close beyond the opposite band plus the margin confirms the flip; a raw flip that reverses first is counted, marked as a ghost, and absorbed.
Statistics: Each confirmed flip records what price did ten and thirty bars later, in the flip's direction, into capped first-in-first-out databases. Win rates are pulled toward fifty percent by pseudo-samples and carry Wilson lower bounds. Until the minimum sample is met, markers read "collecting history" instead of inventing a number.
Outcome settlement: Every marker stores its flip price and recolors by the realized ten-bar outcome, then joins the capped history.
Grading: Volume z-score, efficiency level, and break decisiveness combine into an A, B, C grade on every flip.
Non-repainting: Flips, shields, grades, statistics, and settlement are all evaluated on closed bars. Once printed, nothing moves.
🔶 HOW TO USE IT
1. Works on any market — cryptocurrency, forex, gold, indices, stocks, futures — and any timeframe. Trending instruments suit tighter trend bounds; choppy ones benefit from a wider chop bound and a larger shield margin.
2. Treat the flip as regime information and the trail as the stop: the line is the invalidation, and the one-R and two-R references scale targets to the risk the stop defines.
3. Read the ghost markers as the tool working: a cluster of × marks in a range is the chop a fixed-factor SuperTrend would have traded.
4. Judge fresh flips against the settled history and the statistics rows — a symbol whose markers keep settling gray is telling you trend-following struggles there, and that is information worth having before the next flip.
5. Use the grade for position confidence: an A-grade flip with volume, high efficiency, and a decisive break is a different event from a drift-through.
6. Watch the live factor and efficiency in the dashboard to see the adaptation reasoning in real time.
🔶 SETTINGS
- Adaptive trail: Average True Range length, factor in strong trend, factor in chop, Efficiency Ratio length.
- Whipsaw Shield: flip margin and ghost marker toggle.
- Statistics: sample cap, minimum samples to grade, shrinkage strength, Wilson z-score, markers to keep.
- Trade plan toggle and plans to keep.
- Visuals: all colors, glow fill, candle tinting.
- Themeable dashboard: position, four text sizes, title band, background, frame, grid, and three text colors.
🔶 ALERTS
- Buy Flip / Sell Flip — the adaptive trail flipped with the confirmation margin cleared.
- Whipsaw Shielded — a raw flip reversed before confirming; the engine held its direction.
- Grade A Flip — full quality confluence: volume, efficiency, and a decisive break.
🔶 FREQUENTLY ASKED QUESTIONS
Does the indicator repaint? No. Every flip, shield event, grade, statistic, and marker settlement is evaluated at bar close. Once printed, nothing moves.
How is this different from other adaptive or machine-learning SuperTrends? Adaptation itself is not the claim — several tools adapt the factor. The differences are transparency and honesty: the adaptation here is one verifiable formula shown live on the dashboard, the whipsaws it absorbs are rendered instead of hidden, every signal carries its real statistics with confidence bounds, and every marker settles into its true outcome.
What does a ghost × marker mean? The raw SuperTrend flipped there and reversed before clearing the confirmation margin. The engine held its direction and counted the whipsaw it absorbed.
Why does a marker turn gray? The flip failed: ten bars later, price had not moved in its direction. Gray markers are the audit trail working — an honest tool must be able to show its losses.
Why do the win rates hover near fifty percent on some symbols? Because that is the truth of trend-flip performance there. The shrinkage and confidence bounds are designed to display small honest numbers rather than large misleading ones.
🔶 CREDITS
The SuperTrend trailing stop was created by Olivier Seban; the Average True Range is by J. Welles Wilder Jr. (1978); the Efficiency Ratio is by Perry J. Kaufman; the Wilson score interval is by Edwin B. Wilson (1927). This script gratefully acknowledges all four. The Whipsaw Shield, the transparent adaptive-factor design, the per-symbol statistical engine, the outcome-settling markers, the trade plan layer, and all code in this script are original work — no third-party or open-source script code was reused.
🔶 LIMITATIONS
Trend-following flips underperform by nature in prolonged ranges; the shield reduces but cannot eliminate that cost, and shielded entries confirm slightly later than raw ones — the margin trades earliness for reliability. Statistics need history to mature and are honest about being thin early. Volume grading is less meaningful on symbols with unreliable volume reporting. No indicator replaces independent analysis.
🔶 DISCLAIMER
This script is provided strictly for educational and informational purposes. It is not financial advice, an investment recommendation, or a solicitation to buy or sell any financial instrument. Past behavior of any flip, statistic, or grade does not guarantee future results. Trading involves substantial risk. Always do your own research and manage risk independently. Indicator

Point and Figure (PnF) ChartThis is live and non-repainting Point and Figure Charting tool. The tool has it’s own P&F engine and not using integrated function of Trading View.
Point and Figure method is over 150 years old. It consist of columns that represent filtered price movements. Time is not a factor on P&F chart but as you can see with this script P&F chart created on time chart.
P&F chart provide several advantages, some of them are filtering insignificant price movements and noise, focusing on important price movements and making support/resistance levels much easier to identify.
If you are new to Point & Figure Chart then you better get some information about it before using this tool. There are very good web sites and books. Please PM me if you need help about resources.
Options in the Script
Box size is one of the most important part of Point and Figure Charting. Chart price movement sensitivity is determined by the Point and Figure scale. Large box sizes see little movement across a specific price region, small box sizes see greater price movement on P&F chart. There are four different box scaling with this tool: Traditional, Percentage, Dynamic (ATR), or User-Defined
4 different methods for Box size can be used in this tool.
User Defined: The box size is set by user. A larger box size will result in more filtered price movements and fewer reversals. A smaller box size will result in less filtered price movements and more reversals.
ATR: Box size is dynamically calculated by using ATR, default period is 20.
Percentage: uses box sizes that are a fixed percentage of the stock's price. If percentage is 1 and stock’s price is $100 then box size will be $1
Traditional: uses a predefined table of price ranges to determine what the box size should be.
Price Range Box Size
Under 0.25 0.0625
0.25 to 1.00 0.125
1.00 to 5.00 0.25
5.00 to 20.00 0.50
20.00 to 100 1.0
100 to 200 2.0
200 to 500 4.0
500 to 1000 5.0
1000 to 25000 50.0
25000 and up 500.0
Default value is “ATR”, you may use one of these scaling method that suits your trading strategy.
If ATR or Percentage is chosen then there is rounding algorithm according to mintick value of the security. For example if mintick value is 0.001 and box size (ATR/Percentage) is 0.00124 then box size becomes 0.001.
And also while using dynamic box size (ATR or Percentage), box size changes only when closing price changed.
Reversal : It is the number of boxes required to change from a column of Xs to a column of Os or from a column of Os to a column of Xs. Default value is 3 (most used). For example if you choose reversal = 2 then you get the chart similar to Renko chart.
Source: Closing price or High-Low prices can be chosen as data source for P&F charting.
Chart Style: There are 3 options for chart style: “Candle”, “Area” or “Don’t show”.
As Area:
As Candle:
X/O Column Style: it can show all columns from opening price or only last Xs/Os.
Color Theme: different themes exist => Green/Red, Yellow/Blue, White/Yellow, Orange/Blue, Lime/Red, Blue/Red
Show Breakouts is the option to show Breakouts
This tool detects & shows following Breakouts:
Triple Top/Bottom,
Triple Top Ascending,
Triple Bottom Descending,
Simple Buy/Sell (Double Top/Bottom),
Simple Buy With Rising Bottom,
Simple Sell With Declining Top
Catapult bullish/bearish
Show Horizontal Count Targets: Finds the congestion or consolidation pattern and if there is breakout then it calculates the Target by using Horizontal Count method (based on the width of congestion pattern). It shows how many column exist on congestion area. There is no guarantee that prices will reach the target.
Show Vertical Count Targets: When Triple Top/Bottom Breakouts occured the script calculates the target by using Vertical Count Method (based on the length of the column). There is no guarantee that prices will reach the target.
For both methods there is auto target cancellation if price goes below congestion bottom or above congestion top.
trend is calculated by EMA of closing price of the P&F
Whipsaw protection:
Last options are “Show info panel” and Labeling Offset. Script shows current box size, reversal, and recommanded minimum and maximum box size. And also it shows the price level to reverse the column (Xs <-> Os) and the price level to add at least 1 more box to column. This is the option to put these labels 10, 20, 30, 50 or 100 bars away from the last bar. Labeling content and color change according to X/O column.
do not hesitate to comment.
Indicator

Repulsion Moving Average - Least Crosses MAA Moving Average With Less Whipsaws Signals
The cross of the price with a moving average is one of the easiest strategy in technical analysis and could have worked if market price wasn't so noisy (In general periods of 1 to 20 produces the most whipsaws) . So it is possible to create a moving average who can manage to escape those noisy periods and produce 0 whipsaws ?
This question was asked by one of my work colleagues and i responded : "well... almost 0".
The Motion Of A Moving Average
Moving Average estimate the Trend and will always have phase shift, they will still follow the price and cross it during high volatility or low volatility periods, and when a moving average cross the price during a low volatility period you can expect lot of crosses.
In order to fix this behaviour a simple calculation exist :
FixMa = LongPeriodMA + MediumPeriodMA - ShortPeriodMA
We can see things in that way, the medium term MA is high pass filtered (subtracted) with a short term MA and the result is summed to a long term MA. We give more reactivity to our long term MA and thus creating some kind of repulsion motion with the price. Of course this can sometimes make the filter kinda zero-lag to some price periods (when the long term MA is near the price) .
Comparison
In red a simple moving average of period 100 and in blue our repulsion moving average :
In the image the short term moving average period is 100, since the long term period of the moving average is equal to short term x 3 you could be interested to look at the comparison of our moving average with the actual long term moving average :
Less crosses, i think you can see it.
Something to notice is that its always a tradeoff between Signal Speed and Signal Numbers , a classic moving average create faster signals but also a high numbers of them, a classic trailing stop create less signals but slowest ones, our moving average is some kind of average between those indicators.
Improvement Methods - Choice of The Filter/More Terms
A bad behaviour of our filter can be fixed by using filters who tend to create less crosses with the price or by developing the formula of our filter by adding more terms as follow :
fixma = ma(Price,a) + ma(Price,b) + ma(Price,c) - ma(Price,d) - ma(Price,e)
where a > b > c > d > e . The number of subtractive terms is equal to the number of summing terms - 1.
Way To Use
This indicator can be used like any moving average with cross strategy. Can also be used as a trailing stop.
No tests have been made proving that this indicator provide support and resistance levels, such signals come from more centered indicators.
Hope you enjoy
For any questions/demands feel free to pm me, i would be happy to help you :)
Indicator
