OPEN-SOURCE SCRIPT

Alpha Scalper Quantum

672
ALPHA SCALPER QUANTUM

WHAT IT IS

Alpha Scalper Quantum (ASQ) is a multi-timeframe RSI-based signal engine that combines a custom momentum oscillator with a four-layer macro moving average trend filter. It operates across two timeframes simultaneously — a user-defined macro timeframe that establishes trend context, and the chart's native timeframe where precision entry signals fire. The result is a system that does not generate signals blindly against the trend: every micro entry is validated against a macro structural bias before it reaches the chart.
スナップショット
スナップショット
The oscillator itself is not a standard RSI. It uses a custom range-normalized momentum formula that tracks where the current price sits relative to its recent high/low range, weighted optionally by volume. This makes it respond differently to strong-volume impulses versus low-volume noise — something the classic Wilder RSI does not distinguish.

THE RSI ENGINE — HOW IT ACTUALLY WORKS

Standard RSI compares average gains to average losses over N bars. ASQ replaces this with a range-normalized momentum approach: it measures the distance the current bar has moved relative to the highest high and lowest low of the lookback window. The result is scaled to a 0–100 range, centered at 50. This naturally responds more cleanly to sharp moves because it anchors to actual price range extremes, not just close-to-close differences.

When Volume Weighted RSI is enabled, each momentum reading is multiplied by the bar's volume before being smoothed. A candle that moves 30 pips on ten times average volume carries ten times the weight in the oscillator. A whipsaw on paper-thin volume barely registers. This is particularly useful in futures and crypto markets where volume spikes around institutional entries create reliable momentum anchors.

The Higher Timeframe RSI option feeds the micro signal engine with RSI data from a higher timeframe instead of the chart timeframe. This is a structurally different approach from simply showing two RSI plots side by side — the trigger conditions themselves use the HTF oscillator reading, meaning your entry triggers fire based on momentum state at a more macro level while you watch price on a faster chart.

MACRO TREND FILTER — THE FOUR-MA STACK

ASQ uses four moving averages computed on the macro timeframe (default: 15-minute), defaulting to EMA 8, EMA 16, EMA 30, and EMA 50. Each MA type is individually selectable: SMA, EMA, WMA, VWMA, or HMA. You can mix types — for example, an HMA 8 for speed with an SMA 50 as the anchor.
スナップショット
スナップショット
Macro bullish alignment is declared when MA1 > MA2 > MA3 > MA4 — a clean stack from fastest to slowest, all pointing the same direction. Macro bearish alignment is the exact inverse. This is a strict condition. In a choppy, ranging market, it will not align, and ASQ will not produce macro signals. This is by design: the filter is intentionally conservative to keep signal quality high.

The macro trend condition additionally requires price to close above MA1 (for bull) or below MA1 (for bear). This means an MA stack can be fully aligned but if price is under MA1, the system does not declare a macro uptrend. Trend structure and price position must agree.

The dashboard shows each MA pair relationship individually (8 vs 16, 16 vs 30, 30 vs 50) as green/red cells, so you can see at a glance how close the stack is to full alignment — useful when the market is transitioning.

All four MAs are pulled from the macro timeframe using request.security, meaning even on a 1-minute chart you are looking at the structural alignment of the 15-minute (or whatever macro TF you set) moving average stack. No repainting when "Wait for Macro Candle Close" is enabled.


MICRO SIGNAL ENGINE — THREE DISTINCT TRIGGER PATTERNS

This is where ASQ separates itself from basic RSI crossover indicators. There are three independent micro signal patterns, each targeting a different price behavior.

Signal 1 — Full Cycle Reversal
Trigger: RSI has touched the oversold zone (30 or below), then the same RSI crosses back above the overbought zone (70 or above) while the macro trend is bullish.
スナップショット
スナップショット
This captures parabolic V-shaped recoveries. The RSI must have genuinely entered oversold territory before this triggers, and it only fires when the momentum swing is so strong that RSI launches directly from below 30 to above 70 without a 50 midline rejection. In strong bull trends this pattern often precedes the sharpest impulse legs. The sell-side equivalent requires RSI to touch overbought then crash directly below 30.

Signal 2 — Failed Breakout Pullback
Trigger: RSI reaches overbought (70 or above), then retreats below 70 (shallow pullback), but has not yet fallen to 50. While RSI is between 50 and 70 during this cooling phase, if it then crosses back above 70 again — signal fires.
スナップショット
スナップショット
This is a pullback-to-continuation pattern on the oscillator level. Price pulls back, RSI pulls off extreme territory, but the trend is intact — and when RSI re-enters overbought from this shallow position it signals the next impulse leg is beginning. This is used in trending markets to catch the second and third wave of a move without waiting for a full RSI reset.

Signal 3 — Midline Momentum Confirmation
Trigger: RSI has previously entered overbought (70 or above) and then crossed back below 50, while macro trend is bearish. When RSI then crosses above 50 upward while in this state — signal fires. Inverted for buys: RSI must have been in oversold, crossed above 50, then crossed back below 50 downward in a downtrend.
スナップショット
スナップショット
This pattern targets the momentum confirmation at the 50 midline — where RSI often pauses during a trend change. It is the most conservative of the three patterns, firing at the earliest stage of a new directional momentum shift when RSI recrosses the equilibrium level.

All three signals require macro trend alignment at the time of fire. A micro buy only generates in a macro bullish structure. A micro sell only generates in a macro bearish structure. Signals that do not meet both conditions are silently discarded.


MACRO SIGNAL — TREND ALIGNMENT DETECTION

Separate from micro signals, ASQ fires a Macro Buy or Macro Sell signal the moment the four-MA stack first achieves full alignment in either direction. This is a transition event — it fires once when the stack locks into alignment, not on every subsequent bar. It is the structural entry signal: you are being told the macro trend just confirmed.

The macro signal is visualized with a square marker (default) on the RSI sub-pane and simultaneously draws a pivot-based stop line on the main chart. The candle coloring system also activates with the deeper macro colors (darker green for bull, darker red for bear) when a macro signal is active.


DIVERGENCE DETECTION — REGULAR AND HIDDEN

ASQ includes a full divergence detection module that operates independently of the signal engine. It uses pivot highs and pivot lows on both the RSI oscillator and the price series simultaneously. Two conditions are evaluated for each pivot pair.

Regular Bullish Divergence: Price makes a lower low, RSI makes a higher low. Classic exhaustion divergence — momentum is building even as price tests new lows, warning of a reversal.

Regular Bearish Divergence: Price makes a higher high, RSI makes a lower high. Classic topping divergence — momentum is weakening even as price extends higher.

Hidden Bullish Divergence: Price makes a higher low (within an uptrend), RSI makes a lower low. This is a trend continuation pattern — the pullback is shallower in price than in momentum, suggesting the underlying trend is intact and the dip is buyable.

Hidden Bearish Divergence: Price makes a lower high (within a downtrend), RSI makes a higher high. Trend continuation sell signal on a bounce — momentum already peaked, price is just retesting resistance.

Hidden divergences only activate when the matching macro trend is confirmed (hidden bull requires macro uptrend, hidden bear requires macro downtrend), which prevents you from misreading continuation patterns as reversals.
スナップショット
スナップショット
The divergence engine filters by minimum pivot strength (default 0.3 from midline), meaning RSI pivots near the 50 level do not qualify — only pivots with meaningful displacement toward either extreme count. A minimum bar distance between pivots (default 10) prevents duplicate detections on clustered pivots.

Divergence lines are drawn directly on the RSI sub-pane: solid lines for regular divergences, dashed lines for hidden divergences. Marker shapes appear at the divergence pivot location so they are unmistakable on a busy chart.


PIVOT-BASED STOP LOSS LINES

Every time a confirmed micro or macro signal fires, ASQ draws a horizontal stop-loss reference line on the main chart. For buy signals, the line is drawn at the most recent pivot low. For sell signals, at the most recent pivot high. The line extends forward by a configurable number of bars.
スナップショット
スナップショット
The pivot calculation uses left/right bar parameters (default 3 left, 1 right) which you can adjust based on the timeframe and volatility of the asset. Shorter bar counts produce tighter, more recent pivots. Longer counts identify stronger structural pivots. The suggested stop loss value will appear on the dashboard, this facilitate the trade for scalpers.

This is not a hard stop — it is a reference. The intent is to show you the nearest relevant structural level at the moment the signal fired. Micro buy stops use the micro buy color. Macro buy stops use the macro buy color. This way you can instantly see which timeframe's logic generated the stop reference. A configurable maximum line count keeps older lines from cluttering the chart.


CANDLE COLORING — DUAL-LAYER SYSTEM

ASQ overlays colored candles on the main chart using a layered priority system. There are four possible candle states: macro bull, macro bear, micro bull, and micro bear. Macro signals take visual priority over micro signals when both are active.

Once a signal activates the candle coloring, a secondary filter kicks in: an 8-period EMA is computed on the chart timeframe and candle color is sustained only if price remains above the EMA and the EMA is rising (for bull) or below the EMA and the EMA is falling (for bear). If two consecutive candles violate this filter, the candle coloring resets to inactive. This prevents the color from lingering through a clear reversal.
スナップショット
スナップショット

The four candle color states are independently togglable. You can disable macro candle coloring but keep micro active, or vice versa. Opacity is adjustable from 0 (fully opaque) to 100 (invisible), which lets you layer ASQ's colored candles transparently over a custom candle scheme if you use one.

Candle coloring uses force overlay so it appears on the main chart even though ASQ lives in a sub-pane. No need to move the indicator to the price panel.

DASHBOARD — REAL-TIME STRUCTURAL READOUT
スナップショット
スナップショット
スナップショット
The dashboard is a 2-column, 11-row table drawn on the chart displaying:

Macro Trend — BULL / BEAR / NEUTRAL in color
Macro MA Alignment overview row (8v16, 16v30, 30v50)
MA 8 vs 16 — confirmed or not, with green/red background
MA 16 vs 30 — confirmed or not, with green/red background
MA 30 vs 50 — confirmed or not, with green/red background
Price vs Macro MA8 — ABOVE or BELOW
Macro RSI value — colored green if overbought, red if oversold
Micro RSI value — colored by same threshold logic
Stop Loss value – colored as the most recent pivot
Divergence — type of active divergence or None
Last Signal — BUY / SELL / None

Every row color-codes by state, so the dashboard functions as a quick structural checklist without requiring you to zoom into the oscillator on every bar. You can position it at any of nine screen locations and resize from tiny to huge. Background, border, and all text colors are fully customizable.

REPAINT PROTECTION

The "Wait for Macro Candle Close" setting enforces bar confirmation discipline across the entire system. When enabled, the macro timeframe data uses lookahead_off, meaning macro MA alignment and macro RSI values only update on confirmed macro candle closes — not during the formation of the current macro candle. Micro signals are additionally gated by barstate.isconfirmed on the chart timeframe.

The practical consequence: with this setting on, a signal that appears on the current bar is only plotted and alerted after that bar closes. No signal will appear mid-candle and then disappear. If you are automating via webhooks or using alerts for actual trade execution, enable this. For purely visual real-time monitoring, you may prefer it off for earlier awareness.

ALERTS — FULL GRANULAR COVERAGE

ASQ provides 14 independent alert conditions:

Micro Buy Signal 1 (full-cycle RSI reversal)
Micro Buy Signal 2 (shallow pullback re-entry)
Micro Buy Signal 3 (midline momentum confirmation)
Micro Sell Signal 1, 2, 3 (inverse of above)
Any Micro Buy (any of the three buy patterns)
Any Micro Sell (any of the three sell patterns)
Macro Buy (MA stack locks bullish)
Macro Sell (MA stack locks bearish)
Macro Trend Bullish (trend state turns bullish)
Macro Trend Bearish (trend state turns bearish)
Regular Bullish Divergence
Regular Bearish Divergence
Hidden Bullish Divergence
Hidden Bearish Divergence

Alert messages include ticker, interval, and price at time of trigger. You can wire the "Any Micro Buy" and "Any Micro Sell" alerts to a webhook for automation, while using the individual signal alerts for pattern-specific setups.

SIGNAL SHAPE CUSTOMIZATION

Every signal type (micro buy, micro sell, macro buy, macro sell, bull divergence, bear divergence) has its own independently selectable shape, color, and on/off toggle. Shapes available: Circle, Square, Triangle Up, Triangle Down, Diamond, Cross, Star. Signals are plotted on the RSI sub-pane at fixed Y positions by type (divergences at 0/100, macro signals at 5/95, micro signals at 10/90) to prevent overlap between signal layers.

RSI DISPLAY — ZONE FILLS AND PRICE LINE

The RSI sub-pane shows the oscillator with three reference lines: overbought (default 70, green), oversold (default 30, red), and the 50 midline (black). Each line has independent width and color settings. When RSI crosses into the overbought zone, the area between RSI and the 70 line fills with the bullish fill color. When RSI drops into the oversold zone, the area fills with the bearish fill color. The fill is removed as soon as RSI returns to the neutral zone.

The RSI line color itself changes dynamically: green in overbought territory, red in oversold, and the user-defined base color in between. The "Show RSI Price Line" option enables a horizontal tracking line on the right scale that follows the current RSI value — useful when you want to read the exact RSI level without hovering.

HOW TO USE IT — PRACTICAL WORKFLOW

The cleanest workflow is to first establish macro context from the dashboard, then look for micro entry signals.

Step 1 — Check Macro Trend. Dashboard shows BULL or BEAR. If NEUTRAL, the four-MA stack is not aligned and no macro or micro signals will fire. Respect this. A neutral reading means range or transition — scalping through it blindly is the fastest way to get chopped.

Step 2 — Confirm MA Stack. Check the three green/red cells for 8v16, 16v30, 30v50. If only two of three are green but the third is borderline, you can anticipate the macro signal is close. Full green (or full red) is required for signals to fire.

Step 3 — Watch for Macro Signal. When the square marker appears and candles shift to the deeper macro color, you have a structural alignment confirmation. This is a position-building zone, not a scalp trigger. Swing traders and investors can enter here with the pivot stop line as a stop reference.

Step 4 — Layer Micro Signals for Precision Entry. Once macro is confirmed, micro signals (circle markers by default) show precision oscillator-based re-entries within the trend. Signal 1 fires on full RSI cycle completions — highest conviction, least frequent. Signal 2 fires on shallow pullback continuations — good for trend-following scalps. Signal 3 fires at the 50 midline confirmation — earliest entry, slightly lower conviction but gives the best risk/reward if timed right within a strong trend.

Step 5 — Use Pivot Lines as Stop Reference. Each signal automatically draws a stop line at the most recent structural pivot. You do not need to manually find the nearest swing low or high — ASQ draws it for you at the moment the signal fires.

Step 6 — Divergence as Trend Exhaustion Warning. Even when macro trend is bullish and micro signals are firing long, if regular bearish divergence appears in the dashboard or on the RSI, reduce position size or tighten stops. Divergence does not override signals — it adds context. Hidden bullish divergence during a confirmed macro uptrend is a high-probability continuation setup and can be traded alongside micro signals.

WHAT MAKES IT DIFFERENT

Most RSI indicators either show RSI and a static overbought/oversold line, or they add a signal when RSI crosses 50. ASQ does neither in isolation. The three micro signal patterns are specifically engineered to capture different phases of an RSI behavioral cycle: the full reset, the shallow continuation, and the midline confirmation. Each is a distinct market behavior, and treating them as three separate concepts rather than one "RSI crossover" event is what drives their selectivity.

The volume weighting option makes the oscillator structurally different from any standard RSI derivative. Most volume-weighted RSI implementations simply multiply the RSI output by volume. ASQ weights the internal momentum calculation before smoothing — which means the smoothing itself reflects volume pressure, not just the final number.

The dual-timeframe architecture is native to the signal logic, not bolted on as a filter. The macro condition is a prerequisite, not a visual overlay you can choose to ignore. Either the macro agrees and signals fire, or they do not.

The candle coloring with EMA-based auto-reset is not cosmetic. It tells you when the signal state is being structurally sustained versus when it is starting to break down — and it resets automatically rather than requiring you to judge it manually.

MARKETS AND TIMEFRAMES
スナップショット
スナップショット
スナップショット
スナップショット
ASQ works on any market with volume data: crypto, forex, equities, futures, commodities, indices. Volume Weighted RSI is most powerful on assets with reliable volume data — crypto spot/perps, equity futures. On forex spot, standard RSI mode is recommended since tick volume is a proxy, not true market volume.

Recommended Timeframe Configurations by Trading Style:

Pure Scalping (1–5 min entries): Set macro TF to 15min. Chart on 1min or 3min. Use micro signals, Signals 2 and 3 are most active here. Expect higher signal frequency with tighter invalidation. Use pivot stops aggressively as hard stops, not just references.

Intraday Day Trading (5–15 min chart): Set macro TF to 1H or 4H. Macro signal gives you the session bias. Micro signals give you intraday entry points within that bias. This is the primary intended use case.

Swing Trading (1H–4H chart): Set macro TF to Daily. Macro signal identifies multi-day trend confirmation. Signal 1 on the 4H chart within a daily bullish macro alignment is a high-conviction swing entry. Divergences here carry more structural weight.

Position / Investing (Daily chart): Set macro TF to Weekly. Use macro signals and divergences only. The weekly MA stack alignment is a structural trend confirmation. Regular bearish divergence on the daily RSI within a weekly macro bull signal is a classic position-sizing warning.

The indicator is not limited to these configurations — they are starting points. The macro TF and all MA lengths are fully adjustable, so you can calibrate the system to any asset's specific volatility profile.

DISCLAIMER

Alpha Scalper Quantum is a technical analysis tool and is provided for educational and informational purposes only. No indicator guarantees profitable results. Past signal performance does not predict future outcomes. Trading financial instruments involves significant risk of capital loss. Always apply proper risk management and position sizing. This indicator does not constitute financial advice. Use it as one component of a broader decision-making process, not as a standalone signal system.

免責事項

これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。