Bank nifty with RSI + SMA (Bli-Rik)best to trade for 100 points on 15 mins time frame, very rarly fails
Osciladores
Baseline Deviation Oscillator [Alpha Extract]A sophisticated normalized oscillator system that measures price deviation from a customizable moving average baseline using ATR-based scaling and dynamic threshold adaptation. Utilizing advanced HL median filtering and multi-timeframe threshold calculations, this indicator delivers institutional-grade overbought/oversold detection with automatic zone adjustment based on recent oscillator extremes. The system's flexible baseline architecture supports six different moving average types while maintaining consistent ATR normalization for reliable signal generation across varying market volatility conditions.
🔶 Advanced Baseline Construction Framework
Implements flexible moving average architecture supporting EMA, RMA, SMA, WMA, HMA, and TEMA calculations with configurable source selection for optimal baseline customization. The system applies HL median filtering to the raw baseline for exceptional smoothing and outlier resistance, creating ultra-stable trend reference levels suitable for precise deviation measurement.
// Flexible Baseline MA System
ma(src, length, type) =>
if type == "EMA"
ta.ema(src, length)
else if type == "TEMA"
ema1 = ta.ema(src, length)
ema2 = ta.ema(ema1, length)
ema3 = ta.ema(ema2, length)
3 * ema1 - 3 * ema2 + ema3
// Baseline with HL Median Smoothing
Baseline_Raw = ma(src, MA_Length, MA_Type)
Baseline = hlMedian(Baseline_Raw, HL_Filter_Length)
🔶 ATR Normalization Engine
Features sophisticated ATR-based scaling methodology that normalizes price deviations relative to current volatility conditions, ensuring consistent oscillator readings across different market regimes. The system calculates ATR bands around the baseline and uses half the band width as the normalization factor for volatility-adjusted deviation measurement.
🔶 Dynamic Threshold Adaptation System
Implements intelligent threshold calculation using rolling window analysis of oscillator extremes with configurable smoothing and expansion parameters. The system identifies peak and trough levels over dynamic windows, applies EMA smoothing, and adds expansion factors to create adaptive overbought/oversold zones that adjust to changing market conditions.
1D
3D
1W
🔶 Multi-Source Configuration Architecture
Provides comprehensive source selection including Close, Open, HL2, HLC3, and OHLC4 options for baseline calculation, enabling traders to optimize oscillator behavior for specific trading styles. The flexible source system allows adaptation to different market characteristics while maintaining consistent ATR normalization methodology.
🔶 Signal Generation Framework
Generates bounce signals when oscillator crosses back through dynamic thresholds and zero-line crossover signals for trend confirmation. The system identifies both standard threshold bounces and extreme zone bounces with distinct alert conditions for comprehensive reversal and continuation pattern detection.
Bull_Bounce = ta.crossover(OSC, -Active_Lower) or
ta.crossover(OSC, -Active_Lower_Extreme)
Bear_Bounce = ta.crossunder(OSC, Active_Upper) or
ta.crossunder(OSC, Active_Upper_Extreme)
// Zero Line Signals
Zero_Cross_Up = ta.crossover(OSC, 0)
Zero_Cross_Down = ta.crossunder(OSC, 0)
🔶 Enhanced Visual Architecture
Provides color-coded oscillator line with bullish/bearish dynamic coloring, signal line overlay for trend confirmation, and optional cloud fills between oscillator and signal. The system includes gradient zone fills for overbought/oversold regions with configurable transparency and threshold level visualization with automatic label generation.
snapshot
🔶 HL Median Filter Integration
Features advanced high-low median filtering identical to DEMA Flow for exceptional baseline smoothing without lag introduction. The system constructs rolling windows of baseline values, performs median extraction for both odd and even window lengths, and eliminates outliers for ultra-clean deviation measurement baseline.
🔶 Comprehensive Alert System
Implements multi-tier alert framework covering bullish bounces from oversold zones, bearish bounces from overbought zones, and zero-line crossovers in both directions. The system provides real-time notifications for critical oscillator events with customizable message templates for automated trading integration.
🔶 Performance Optimization Framework
Utilizes efficient calculation methods with optimized array management for median filtering and minimal computational overhead for real-time oscillator updates. The system includes intelligent null value handling and automatic scale factor protection to prevent division errors during extreme market conditions.
🔶 Why Choose Baseline Deviation Oscillator ?
This indicator delivers sophisticated normalized oscillator analysis through flexible baseline architecture and dynamic threshold adaptation. Unlike traditional oscillators with fixed levels, the BDO automatically adjusts overbought/oversold zones based on recent oscillator behavior while maintaining consistent ATR normalization for reliable cross-market and cross-timeframe comparison. The system's combination of multiple MA type support, HL median filtering, and intelligent zone expansion makes it essential for traders seeking adaptive momentum analysis with reduced false signals and comprehensive reversal detection across cryptocurrency, forex, and equity markets.
Frequency Momentum Oscillator [QuantAlgo]🟢 Overview
The Frequency Momentum Oscillator applies Fourier-based spectral analysis principles to price action to identify regime shifts and directional momentum. It calculates Fourier coefficients for selected harmonic frequencies on detrended price data, then measures the distribution of power across low, mid, and high frequency bands to distinguish between persistent directional trends and transient market noise. This approach provides traders with a quantitative framework for assessing whether current price action represents meaningful momentum or merely random fluctuations, enabling more informed entry and exit decisions across various asset classes and timeframes.
🟢 How It Works
The calculation process removes the dominant trend from price data by subtracting a simple moving average, isolating cyclical components for frequency analysis:
detrendedPrice = close - ta.sma(close , frequencyPeriod)
The detrended price series undergoes frequency decomposition through Fourier coefficient calculation across the first 8 harmonics. For each harmonic frequency, the algorithm computes sine and cosine components across the lookback window, then derives power as the sum of squared coefficients:
for k = 1 to 8
cosSum = 0.0
sinSum = 0.0
for n = 0 to frequencyPeriod - 1
angle = 2 * math.pi * k * n / frequencyPeriod
cosSum := cosSum + detrendedPrice * math.cos(angle)
sinSum := sinSum + detrendedPrice * math.sin(angle)
power = (cosSum * cosSum + sinSum * sinSum) / frequencyPeriod
Power measurements are aggregated into three frequency bands: low frequencies (harmonics 1-2) capturing persistent cycles, mid frequencies (harmonics 3-4), and high frequencies (harmonics 5-8) representing noise. Each band's power normalizes against total spectral power to create percentage distributions:
lowFreqNorm = totalPower > 0 ? (lowFreqPower / totalPower) * 100 : 33.33
highFreqNorm = totalPower > 0 ? (highFreqPower / totalPower) * 100 : 33.33
The normalized frequency components undergo exponential smoothing before calculating spectral balance as the difference between low and high frequency power:
smoothLow = ta.ema(lowFreqNorm, smoothingPeriod)
smoothHigh = ta.ema(highFreqNorm, smoothingPeriod)
spectralBalance = smoothLow - smoothHigh
Spectral balance combines with price momentum through directional multiplication, producing a composite signal that integrates frequency characteristics with price direction:
momentum = ta.change(close , frequencyPeriod/2)
compositeSignal = spectralBalance * math.sign(momentum)
finalSignal = ta.ema(compositeSignal, smoothingPeriod)
The final signal oscillates around zero, with positive values indicating low-frequency dominance coupled with upward momentum (trending up), and negative values indicating either high-frequency dominance (choppy market) or downward momentum (trending down).
🟢 How to Use This Indicator
→ Long/Short Signals: the indicator generates long signals when the smoothed composite signal crosses above zero (indicating low-frequency directional strength dominates) and short signals when it crosses below zero (indicating bearish momentum persistence).
→ Upper and Lower Reference Lines: the +25 and -25 reference lines serve as threshold markers for momentum strength. Readings beyond these levels indicate strong directional conviction, while oscillations between them suggest consolidation or weakening momentum. These references help traders distinguish between strong trending regimes and choppy transitional periods.
→ Preconfigured Presets: three optimized configurations are available with Default (32, 3) offering balanced responsiveness, Fast Response (24, 2) designed for scalping and intraday trading, and Smooth Trend (40, 5) calibrated for swing trading and position trading with enhanced noise filtration.
→ Built-in Alerts: the indicator includes three alert conditions for automated monitoring - Long Signal (momentum shifts bullish), Short Signal (momentum shifts bearish), and Signal Change (any directional transition). These alerts enable traders to receive real-time notifications without continuous chart monitoring.
→ Color Customization: four visual themes (Classic green/red, Aqua blue/orange, Cosmic aqua/purple, Custom) allow chart customization for different display environments and personal preferences.
GTI - Overbought and Oversold indicatorFor this indicator I've merged 6 indicators (RSI, Stochastic, CCI, MFI, UO and William %R) that are decent to spot overbought and oversold conditions into one indicator.
The idea is the more indicators that agree on overbought and oversold conditions, the better chance that the condition is correct.
Possible input settings
Set your own values for the overbought and oversold bands.
Noise suppression (On/Off)
Length for noise suppression calculations
Overbought noise suppression
Oversold noise suppression
Plot divergences (On/Off)
Left/Right lookback settings for finding pivot highs/lows
Min/Max lookback range to compare pivots for divergences
Style settings
Enabled/Disable the line for reversal value
Set the color for the line (default is 100% transparent value)
Enable/Disable fill color between reversal value and the 0 line
Set the fill color
Precision for reversal value, default is 2
Explanations
The scale goes from 100 to -100, where outliners above 85 or below -85 is expected to be extremely rare. The overbought and oversold bands are calculated from the typical values from each indicator used in the calculation.
The noise suppression is a percentile calculation from the last X bars back, where X is the length you set in the settings. 100 is the default value. This is very good to use in strong trends as an asset in a strong bullish trend tend to not touch/breach the oversold band and vise versa. The percentile calculation might still be able to catch the overbought/oversold condition in a strong opposite trending asset. 85 is a default value, but keep in mind that every asset moves differently due to their liquidity pool. The default is only a guide line.
The divergence settings only plots normal divergences. Hidden divergences are not calculated.
If you want the possibility to plot/see hidden divergences too, let me know in the comments. If enough people wants it I'll consider adding them.
when it comes to the style, you might be a bit confused at first. The reversal value is enabled, but not showing. That's because it's enabled with 100% transparency as I like using the fill more than just a line.
If you want to use a line instead of the fill, Disable the fill -> edit reversal value color -> set your chosen color and make sure to remove the transparency to make it visible.
Exmaple, ticker NOVO_B
In the example ticker I've enabled "Noise suppression", using the default 100 length and set noise suppression for both OB and OS to 90.
The green and red circles are plotted when the "reversal value" falls below the percentile set, indicating that a possible top was just formed.
Keep in mind that strong bullish or bearish trends tend to stay overbought/oversold for a longer time and are likely to print several false signals before the eventual reversal. If a divergences is printed, normally that is either the bottom or close to the bottom before a stronger reversal.
Suggestion
As all other indicators, don't use this indicator alone to spot reversals. Use it together with 1-3 other indicators like MACD, ADX and OBV. I like to use MACD as a confirmation tool after this tool starts indicating overbought/oversold conditions.
For an overbought condition, wait for MACD to cross below the signal line.
For an oversold condition, wait for the MACD to cross above the signal line.
This way you don't act on false signal.
Another way would be to use a DCA strategy, where you buy on each signal. In such a situation I suggest starting small enough to be able to double the total for each time, example below.
First signal: $100, then another $100 on second signal, $200 on third signal, $400 on fourth signal and so on. The amounts are an example, find what works for you.
RSI Maniac
RSI Maniac
A powerful, fully-customizable RSI indicator designed for traders who want deeper insight into momentum across multiple timeframes. This indicator enhances the traditional RSI by adding multi-timeframe analysis, multi-timeframe moving averages, and optional Bollinger Bands applied directly on the RSI curve.
----- Key Features -----
1️⃣ Multi-Timeframe RSI (HTF RSI) : Analyse higher-timeframe momentum while staying on your current chart.
Enable/Disable HTF RSI
Select any timeframe (1m → 1M)
Dedicated RSI length & source for HTF
Great for spotting:
Trend confirmation or divergence between LTF & HTF momentum
2️⃣ Multi-Timeframe Moving Averages : A powerful addition for traders using higher timeframe confirmation.
Enable/Disable HTF MAs
Independent Fast & Slow MA settings
Separate HTF timeframe
Separate MA type for HTF (EMA or HMA)
Great for spotting:
HTF RSI trend direction
HTF momentum overlays on LTF RSI
Cross-timeframe momentum alignment
🎛️ Clean & Organized User Interface : The indicator organizes settings into intuitive groups.
Current Timeframe RSI
Current Timeframe MA
Higher Timeframe RSI
Higher Timeframe MA
Bollinger Bands Settings
Traders can toggle any component independently.
How to trade ?
Based on my approach, I don’t use RSI to catch reversals. Instead, I use it to trade continuations—when the lower timeframe (LTF) RSI aligns with the higher timeframe (HTF) trend. I simply wait for the LTF RSI to move in the same direction as the HTF RSI and then take the continuation trade. Please check the snapshots for a clearer understanding of how these trades work.
Trade less, trade better!
AURORA LEGACY INDICATOR
The AURORA LEGACY is an advanced indicator developed in Pine Script v6 for the TradingView platform, designed to integrate multiple approaches of technical analysis into a single modular and customizable system. Its architecture combines classic elements, such as exponential moving averages (EMA Ribbon), RSI, and ATR, with modern tools inspired by Smart Money Concepts (SMC), including Supply & Demand zones, Break of Structure (BOS), and Points of Interest (POI).
The indicator is structured to provide traders with flexibility, offering pre-configured trading profiles (Scalper, Day Trade, Swing Trade, Sniper) or full manual customization of moving averages. The dynamic Ribbon serves as the core of trend analysis, supported by additional confluences through secondary moving averages (VWMA, LWMA, SMMA) and volatility filters based on ATR.
Key features include:
Trend & Signal System: detection of reversals and trend confirmations through Ribbon color alignment, with automated buy/sell alerts.
Automated Risk Management: dynamic calculation of entry levels, Stop Loss (SL), and multiple Take Profits (TPs), displayed on chart with labels and risk-reward ratio (R:R).
Multi-Timeframe (MTF) Trend Table: consolidated overview of trend, RSI, and volatility (ATR) across different timeframes (5M, 15M, 1H, 4H, Daily).
Smart Money Concepts Integration: automatic detection and marking of Supply & Demand zones, BOS, market structure zigzag, and points of interest.
Complementary Tools: customizable RSI signals by profile, daily support and resistance levels, CPR levels, and visual session markers (London, New York) including overlap zones.
This system was designed to provide a holistic trading approach, combining price action, volatility, indicator confluence, and institutional concepts to support traders of different profiles in making clearer and more precise decisions.
Known Reversals (CreativeAdvance)1 min left to edit script
13 minutes ago
Known Reversals (CreativeAdvance)
Manage access
Add to favorites
Use on chart
0
0
Known Reversals
Non-repainting 1-bar reversal detector
What it does:
Pinpoints the earliest confirmed reversals by detecting a subtle divergence within prevailing momentum. Delivers signals with zero lag and no repaint.
Core logic:
- Monitors directional momentum via highs in uptrends and lows in downtrends
- Activates only when the **close breaks alignment** with that momentum in a single candle
- Proprietary volatility-adjusted oscillator ensures signals fire exclusively in high-probability reversal contexts
Key advantage:
Reveals lower-timeframe reversals the moment they confirm on the current chart — true X-ray vision for precision entries.
Pro tip:
Use with distinct candlestick outline colors to instantly distinguish bullish vs. bearish signals, especially on inside bar reversals (painted uniformly for clarity).
No inputs. No curve-fitting. Just pure, actionable reversal confirmation.
CandelaCharts - Trend Oscillator 📝 Overview
Trend Oscillator is a simple yet effective trend identification tool that uses the relationship between two exponential moving averages (EMAs) to determine market direction. It calculates the spread between a fast and slow EMA, applies a bias multiplier, and smooths the result to produce a clean oscillator that oscillates above and below a zero line. When the oscillator is above zero, the trend is considered bullish (upward); when below zero, it's bearish (downward). The indicator provides clear visual feedback through color-coded plots and optional price bar coloring, making it easy to identify trend direction at a glance.
📦 Features
This section highlights the core capabilities you'll rely on most.
Dual EMA system — Uses a fast EMA (default 9) and slow EMA (default 21) to capture trend momentum and direction.
Bias multiplier — Applies a small multiplier (default 1.001) to the EMA spread, providing a slight bias that helps filter noise and confirm trend strength.
Smoothed output — Applies an additional EMA smoothing (default 5 periods) to the raw spread, creating a cleaner, less choppy oscillator line.
Zero-line reference — Plots a horizontal zero line that serves as the critical threshold between bullish and bearish conditions.
Color-coded visualization — Automatically colors the oscillator line green/lime when bullish (above zero) and red when bearish (below zero).
Price bar coloring — Optional feature to color price bars based on the current trend direction, providing immediate visual context on the main chart.
Customizable parameters — Adjust EMA lengths, bias multiplier, smoothing period, and colors to match your trading style and timeframe.
⚙️ Settings
Use these controls to fine-tune the oscillator's sensitivity, appearance, and behavior.
Fast EMA Length — Period for the fast exponential moving average (default: 9). Lower values make the indicator more responsive to price changes.
Slow EMA Length — Period for the slow exponential moving average (default: 21). Higher values create a smoother baseline for trend identification.
Bias Multiplier — Multiplier applied to the EMA spread (default: 1.001). Small adjustments can help filter minor whipsaws and confirm trend strength.
Smoothing Length — Period for smoothing the raw spread calculation (default: 5). Higher values create a smoother oscillator line but may lag price action.
Colors — Set the bullish (default: lime) and bearish (default: red) colors for the oscillator line.
Color Price Bars — Toggle to enable/disable coloring of price bars based on the current trend direction.
⚡️ Showcase
Oscillator Line
Bar Coloring
Divergences
📒 Usage
Follow these steps to effectively use Trend Oscillator for trend identification and trading decisions.
1) Select your timeframe — The indicator works across all timeframes, but higher timeframes (daily, weekly, monthly) typically provide more reliable trend signals with less noise. Lower timeframes (1m, 5m, 15m) may produce more frequent but potentially less reliable signals. Consider your trading style: swing traders benefit from daily/weekly charts, while day traders can use 15m/1h timeframes. Always align the indicator's sensitivity with your timeframe choice.
2) Adjust EMA lengths — The default 9/21 combination works well for most cases. For faster signals, try 5/13; for slower, more conservative signals, try 12/26 or 20/50. Match the lengths to your trading style and timeframe.
3) Interpret the zero line — When the oscillator is above zero (green/lime), the trend is bullish. When below zero (red), the trend is bearish. The further from zero, the stronger the trend.
4) Watch for crossovers — Trend changes occur when the oscillator crosses the zero line. A cross from below to above indicates a shift to bullish; from above to below indicates a shift to bearish.
5) Identify divergences — Divergences can signal potential trend reversals. Bullish divergence : price makes lower lows while the oscillator makes higher lows (suggests weakening bearish momentum). Bearish divergence : price makes higher highs while the oscillator makes lower highs (suggests weakening bullish momentum). Divergences are most reliable when they occur near extreme levels and should be confirmed with price action before taking trades.
6) Use smoothing wisely — The smoothing parameter helps reduce noise but adds lag. Lower smoothing (3-5) is more responsive; higher smoothing (7-10) is more stable but slower to react.
7) Combine with price action — Use the oscillator to confirm trend direction, then look for entry opportunities when price pulls back in the direction of the trend. The optional price bar coloring helps visualize trend alignment on the main chart.
8) Filter with bias multiplier — The bias multiplier can help reduce false signals. Experiment with values between 1.000 and 1.005 to find the sweet spot for your instrument and timeframe.
🚨 Alerts
There are no built-in alerts in this version.
⚠️ Disclaimer
Trading involves significant risk, and many participants may incur losses. The content on this site is not intended as financial advice and should not be interpreted as such. Decisions to buy, sell, hold, or trade securities, commodities, or other financial instruments carry inherent risks and are best made with guidance from qualified financial professionals. Past performance is not indicative of future results.
Average True Range with MAKey features
ATR calculation: true range (ta.tr(true)) is smoothed using a selectable method to produce the ATR.
ATR smoothing options: RMA, SMA, EMA, or WMA for the ATR calculation.
MA-on-ATR: a separate moving average computed on the ATR values with its own length and smoothing method.
Display controls: toggles to show/hide the ATR and the ATR MA independently.
Appearance controls: separate color inputs for the ATR and the ATR MA, and a thicker line for the MA (linewidth=2).
Inputs
ATR Length (default 14): length used to smooth true range into the ATR.
ATR Smoothing (default RMA): smoothing method applied to the true range to form ATR.
MA Length (on ATR) (default 14): length for the moving average applied to the ATR series.
MA Smoothing (default SMA): smoothing method used for the MA applied to ATR.
Show ATR / Show ATR MA: booleans to toggle visibility.
ATR Color / ATR MA Color: choose plot colors.
How to interpret
ATR line: shows current volatility (average true range). Rising ATR indicates increasing volatility; falling ATR indicates decreasing volatility.
ATR MA line: smooths the ATR to reveal trend direction and reduce noise.
Use crossovers: ATR crossing above its MA may signal volatility is picking up; ATR crossing below its MA suggests volatility is subsiding.
Combine with price action or other indicators (e.g., breakout systems, position sizing rules) to make decisions based on volatility regime.
Custom Reversal Scalper – Adib NooraniCustom Reversal Scalper – Adib Noorani (Modified Edition)
An improved, non-repainting visual reversal indicator inspired by Adib Noorani's "Reversal Scalper" and updated to address key shortcomings with compliance to Adib's rules and recommendations.
Reversal Logic & Entry Filtering: Combines Adib's reversal oscillator and trend ribbon logic with added 30-minute exclusion, optimizing signals for volatile Indian indices like $NSE:NIFTY.
Shortcomings Addressed:
Eliminates repainting—entries and exits only display after the required market action.
Implements strict intraday time filtering per Adib's guidance.
Uses automatic, dynamic trailing stop (red line) post-take-profit for advanced risk management.
Maintains risk:reward visualization and minimizes chart clutter.
Directly Based on: Adib Noorani's YouTube training: www.youtube.com
How to Use:
Trade only outside first 30 minutes, per Adib's rules.
Go Long on black candle after confirmation and price crosses blue line.
Go Short on white candle after confirmation and price crosses blue line.
Stop into trailing is handled automatically after take profit.
Follow all further execution and visual risk management recommendations as per Adib's video.
This script incorporates the key corrections and execution principles demonstrated by Adib Noorani for safe scalping on Indian indices and F&O instruments.
Credits: Original logic and teaching by Adib Noorani . Modifications, anti-repainting logic, and full RR/visual improvements by script author.
For educational purposes. Please backtest and follow personal risk management.
Enhanced Multi-Indicator StrategyEnhanced Multi-Indicator Strategy v7 is a trend-following confirmation tool that combines several classic indicators into one clear “voting system.”
Instead of relying on a single signal, this script counts how many indicators agree on a bullish or bearish bias and only fires when the majority lines up and the trend is strong.
It’s designed to help you:
Filter out low-quality signals
Avoid trading against the dominant trend
Get clean, one-time BUY/SELL markers instead of noisy spam signals
How it Works
The indicator evaluates up to 10 components on each bar:
Trend & Structure
Moving Average (MA 50)
EMA Fast (20) vs EMA Slow (50)
Momentum
RSI (14)
MACD (12/26/9)
KDJ
Volatility & Price Location
Bollinger Bands (20, 2)
VWAP
Volume
Volume vs Volume MA (20)
Trend Strength & Direction
ADX + DMI (trend strength and up/down direction)
Optional
Ichimoku Cloud (price vs Senkou A/B)
Each indicator votes bullish or bearish.
The script then:
Counts how many are bullish → bullish_count
Counts how many are bearish → bearish_count
Requires at least Min Indicators for Entry (user-defined) to agree in one direction
Requires ADX above a threshold (default 20) to confirm trend strength
(Optionally) forces entries to follow the DMI trend:
Longs only in uptrends
Shorts only in downtrends
Only when these conditions are met does the script consider a valid long zone or short zone.
Signals: 1x Fire + Cooldown
To keep the chart clean and prevent over-trading:
A BUY arrow is plotted only on the first bar when price enters a new bullish zone.
A SELL arrow is plotted only on the first bar when price enters a new bearish zone.
A cooldown (in bars) can be configured separately for BUY and SELL so the script will not fire again in the same direction too frequently.
Background colors (optional):
Green background = bullish zone (majority indicators bullish + strong trend)
Red background = bearish zone (majority indicators bearish + strong trend)
This makes it easy to see when the “environment” is favorable for longs or shorts, while the arrows highlight the first opportunity in each zone.
Inputs & Tuning
Key inputs:
Min Indicators for Entry – how many indicators must agree (e.g. 5–7 for stricter filtering)
Strict Trend Filter – if enabled, entries must follow DMI trend (recommended for trend-following)
Cooldown BUY / SELL – minimum number of bars before a new signal in the same direction
Toggles to enable/disable each component (MA, EMA, RSI, MACD, KDJ, BB, Volume, VWAP, ADX, Ichimoku)
General ideas:
Increase Min Indicators for Entry and/or cooldown to reduce the number of signals and focus on stronger trends.
Lower values will make the indicator more active, suitable for shorter-term trading or scalping.
Important Note
This is an indicator, not a full trading system:
It does not manage entries/exits, position sizing, or risk by itself.
Always combine it with your own risk management, stop-loss / take-profit rules, and higher-timeframe context.
Use it as a confirmation / regime tool:
Trade only in the direction of the active zone,
Take BUY signals during bullish regimes,
Take SELL signals during bearish regimes.
hell 1good for finding tops and bottoms in a trend .set to log scale and strech it like it looks in the chart
Stoch Cross OB/OS Signals CleanStoch Cross OB/OS Signals
Displays fast (%K) and slow (%D) Stochastic lines with visual signals for overbought and oversold conditions. Alerts when the fast line crosses the slow line in OB/OS zones using customizable symbols. Ideal for spotting short-term reversals and timing entries/exits. Features adjustable periods, OB/OS levels, and symbol sizes for clear chart visualization.
BIAS RSI STOCH MACD Displaysimple but effective to prevent chart clutter.
Hi Traders! Today I’m showing you a **custom indicator** that combines **BIAS, RSI, Stochastic, and MACD** in one easy-to-read panel. Let’s break it down:
1️⃣ **BIAS** – Shows how far the price is from its moving average.
* Positive BIAS → price is above the average.
* Negative BIAS → price is below the average.
2️⃣ **RSI (Relative Strength Index)** – Measures momentum.
* Above 70 → overbought
* Below 30 → oversold
* **50 line added** → midpoint for trend direction
3️⃣ **Stochastic (STOCH)** – Confirms momentum like RSI.
* Above 80 → overbought
* Below 20 → oversold
4️⃣ **MACD (Moving Average Convergence Divergence)** – Shows trend and momentum.
* Histogram colors indicate strength
* Lines show trend direction
5️⃣ **Visual Table** – On the top right, you can see all current indicator values at a glance, with color coding for easy interpretation.
6️⃣ **Plots & Levels** –
* BIAS, RSI, Stoch are plotted clearly
* RSI has **midline at 50** for trend reference
* Standard overbought/oversold levels highlighted
✅ **How to Use:**
* Look for RSI or Stoch crossing midline or extreme levels for potential entries.
* Check MACD histogram and lines for confirmation of trend strength.
* Use BIAS to see if price is stretched from the moving average.
This indicator is perfect for **momentum, trend, and mean-reversion traders**, giving multiple signals in one pane without clutter.
---
CII OM version 1CII OM Version 1 is a comprehensive trading indicator designed to provide a clear view of market momentum, money flow, and potential reversals in one subwindow. It combines multiple technical tools and visual cues to help traders identify high-probability reversal areas.
Features:
1. Chaikin Money Flow (CMF)
a. Measures buying and selling pressure over a period (default 20).
b. Positive CMF values are filled in green, negative in red.
c. Visualizes money flow for better context of market strength.
2. Volume Buy/Sell % (Optional)
a. Displays the proportion of buying versus selling volume per bar.
b. Green columns represent buying volume, red columns represent selling volume.
c. Can be enabled or disabled via the settings (default: off).
3. Stochastic Oscillator with Combined %K/%D Line
a. %K and %D lines combined into a single line for simplicity.
b. Green line indicates %K above %D (bullish), red line indicates %K below %D (bearish).
c. Upper/lower thresholds are marked at ±0.6.
d. Reversal zones are filled in aqua (buy zone) and fuchsia (sell zone).
4. Reversal Dots
a. Large dots indicate the end of a bullish or bearish reversal zone based on stochastic thresholds.
b. Smaller dots mark minor threshold crossings at ±0.6 for early detection of potential reversals.
c. Dot size is adjustable.
5. Ultimate Oscillator (Optional)
a. Measures short, medium, and long-term momentum.
b. Can be toggled on/off via the settings (default: off).
Customization Options:
a. Enable/disable Buy/Sell Volume % bars
b. Enable/disable Ultimate Oscillator
c. Adjust main reversal dot size
Adjust stochastic oscillator periods (K, D, smooth)
a. Fully compatible with Pine Script v5
Smart TP Manager - FREE Edition📘 Smart TP Manager - User Guide
🎯 Parameter Adaptation by Timeframe
IMPORTANT: Default parameters are optimized for M5 (5 minutes). If you trade on other timeframes, you MUST adapt the parameters for better results.
📊 Recommended Settings Table
M1 (1 minute) - Ultra Scalping
ATR SL Multiplier: 1.5 - 1.8
Number of TPs: 3 - 4
Base RR: 0.4 - 0.5
Confirmation Bars: 2
Cooldown: 3 - 5 bars
Breakeven: Enable after TP1
Profile: Very fast trades, immediate exits, tight SL
M5 (5 minutes) - Scalping ✅ DEFAULT
ATR SL Multiplier: 1.8 - 2.0
Number of TPs: 4 - 5
Base RR: 0.5 - 0.6
Confirmation Bars: 2 - 3
Cooldown: 5 - 8 bars
Breakeven: Enable after TP1 or TP2
Profile: Standard scalping, balance between speed and security
M15 (15 minutes) - Intraday
ATR SL Multiplier: 2.0 - 2.2
Number of TPs: 5 - 6
Base RR: 0.6 - 0.8
Confirmation Bars: 3
Cooldown: 8 - 10 bars
Breakeven: Enable after TP2
Profile: Intraday trading, 3-8 trades per day
H1 (1 hour) - Swing
ATR SL Multiplier: 2.2 - 2.5
Number of TPs: 5 - 6
Base RR: 0.8 - 1.0
Confirmation Bars: 3 - 4
Cooldown: 10 - 15 bars
Breakeven: Enable after TP2 or TP3
Profile: Swing trading, 1-3 trades per day
H4 (4 hours) - Position
ATR SL Multiplier: 2.5 - 3.0
Number of TPs: 6
Base RR: 1.0 - 1.2
Confirmation Bars: 4 - 5
Cooldown: 15 - 20 bars
Breakeven: Enable after TP3
Profile: Position trading, multi-day trades
🔍 Adaptation Logic
General Rule:
LOWER Timeframe → TIGHTER Parameters
HIGHER Timeframe → WIDER Parameters
Why Adapt?
1. ATR SL Multiplier
M1: Very volatile market, fast moves → Tight SL (1.5-1.8)
H4: Slow moves, breathing room needed → Wide SL (2.5-3.0)
2. Number of TPs
M1: Quick exits before reversal → 3-4 TPs
H4: Let profits run → 6 TPs
3. Base RR
M1: Close targets, quick exits → 0.4-0.5
H4: Ambitious targets, patience → 1.0-1.2
4. Confirmation Bars
M1: Fast entry, 2 candles enough
H4: Strong confirmation needed, 4-5 candles
5. Cooldown
M1: Multiple trades per hour possible → 3-5 bars
H4: Important spacing between trades → 15-20 bars
6. Breakeven
M1: Immediate protection after TP1
H4: Let trade breathe, BE after TP3
💡 Real Examples
Example 1: Gold M1 Scalping
Goal: 10-20 trades/day, ultra-fast exits
Recommended Parameters:
- ATR SL: 1.6
- TPs: 4
- Base RR: 0.5
- Confirmation: 2
- Cooldown: 5
- BE: ON after TP1
Expected Results:
- Winrate: 40-50%
- Net P/L: +3 to +6R per day
- SL: 10-15 pips
- TP1: 5-8 pips (quick exit)
Example 2: Gold M15 Day Trading
Goal: 3-6 trades/day, let it breathe
Recommended Parameters:
- ATR SL: 2.1
- TPs: 5
- Base RR: 0.7
- Confirmation: 3
- Cooldown: 10
- BE: ON after TP2
Expected Results:
- Winrate: 50-60%
- Net P/L: +5 to +10R per day
- SL: 20-30 pips
- TP1: 14-21 pips
Example 3: Gold H1 Swing Trading
Goal: 1-2 trades/day, maximum patience
Recommended Parameters:
- ATR SL: 2.4
- TPs: 6
- Base RR: 0.9
- Confirmation: 4
- Cooldown: 12
- BE: ON after TP2
Expected Results:
- Winrate: 55-65%
- Net P/L: +8 to +15R per week
- SL: 40-60 pips
- TP1: 36-54 pips
⚠️ Common Mistakes to Avoid
❌ MISTAKE #1: Using same parameters on all timeframes
M1 with ATR SL 2.5 → SL too wide, huge losses
H4 with ATR SL 1.5 → SL too tight, constant stop outs
❌ MISTAKE #2: Too many TPs on low timeframe
M1 with 6 TPs → Impossible to reach all TPs
❌ MISTAKE #3: Too long confirmation on M1
M1 with 5 confirmation bars → Misses all fast moves
❌ MISTAKE #4: Too short cooldown on H4
H4 with 3 bars cooldown → Overtrading, too many poor-quality trades
🎯 Testing Methodology
Step 1: Start with recommended values
Use the table above according to your timeframe
Step 2: Backtest on minimum 100 trades
Observe:
Winrate
Net P/L in R
Number of BE hits
Trade frequency
Step 3: Adjust based on results
If too many SL hits:
↑ Increase ATR SL Multiplier by +0.2
↑ Increase Confirmation Bars by +1
If not enough trades:
↓ Reduce Cooldown by -2
↓ Reduce Confirmation Bars by -1
If TPs never reached:
↓ Reduce Number of TPs by -1
↓ Reduce Base RR by -0.1
If too many BE but no real wins:
↑ Increase Base RR by +0.1
Disable BE temporarily
📈 Performance Tracking
Key indicators by timeframe:
TFTrades/DayMin WinrateNet P/L/DayAvg SL (pips)M110-2040%+3R10-15M55-1245%+4R15-20M153-850%+5R20-30H11-455%+3R40-60H40.5-260%+2R80-120
🚀 Final Advice
DO NOT USE THE SAME PARAMETERS ON DIFFERENT TIMEFRAMES!
Each timeframe has its own dynamics. Adapting parameters is not optional, it's MANDATORY for optimal results.
Different timeframe = Different parameters = Different results
Quick Reference Chart
M1 → AGGRESSIVE (tight SL, few TPs, quick BE)
M5 → BALANCED (default settings)
M15 → MODERATE (wider SL, more TPs)
H1 → PATIENT (wide SL, max TPs, late BE)
H4 → CONSERVATIVE (very wide SL, all TPs, very late BE)
📝 Best Practices
Always backtest on your specific timeframe before live trading
Start conservative - use higher ATR multipliers first
Track your stats - Wins, Losses, BE, Net P/L
Adjust gradually - change one parameter at a time
Respect your timeframe - don't force H4 parameters on M1
Use breakeven wisely - protect profits but don't choke trades
Monitor cooldown - too many trades = lower quality
🎓 Understanding the Strategy
EMA 9/21 Crossover
BUY: EMA9 crosses above EMA21
SELL: EMA9 crosses below EMA21
RSI Filter
Avoids overbought (>70) for longs
Avoids oversold (<30) for shorts
Confirmation System
Requires X consecutive candles meeting conditions
Reduces false signals
Take Profit Structure
Non-linear TP levels
TP1: 0.5R (default)
TP2: 1.0R
TP3: 1.5R
TP4: 2.0R
TP5: 2.5R
Risk Management
ATR-based stop loss (adapts to volatility)
Optional breakeven after specified TP
Cooldown prevents overtrading
🌟 Pro Tips
Gold (XAUUSD) specific: Use tighter parameters than forex pairs
NY Session: More volatility, tighter SL recommended
Asian Session: Lower volatility, consider skipping or wider SL
News events: Increase cooldown before/after major news
Trending markets: Increase Number of TPs
Ranging markets: Decrease Number of TPs, faster exits
Happy Trading! 🎯
Remember: Past performance does not guarantee future results. Always use proper risk management and never risk more than you can afford to lose.
Algorithm Predator - ProAlgorithm Predator - Pro: Advanced Multi-Agent Reinforcement Learning Trading System
Algorithm Predator - Pro combines four specialized market microstructure agents with a state-of-the-art reinforcement learning framework . Unlike traditional indicator mashups, this system implements genuine machine learning to automatically discover which detection strategies work best in current market conditions and adapts continuously without manual intervention.
Core Innovation: Rather than forcing traders to interpret conflicting signals, this system uses 15 different multi-armed bandit algorithms and a full reinforcement learning stack (Q-Learning, TD(λ) with eligibility traces, and Policy Gradient with REINFORCE) to learn optimal agent selection policies. The result is a self-improving system that gets smarter with every trade.
Target Users: Swing traders, day traders, and algorithmic traders seeking systematic signal generation with mathematical rigor. Suitable for stocks, forex, crypto, and futures on liquid instruments (>100k daily volume).
Why These Components Are Combined
The Fundamental Problem
No single indicator works consistently across all market regimes. What works in trending markets fails in ranging conditions. Traditional solutions force traders to manually switch indicators (slow, error-prone) or interpret all signals simultaneously (cognitive overload).
This system solves the problem through automated meta-learning: Deploy multiple specialized agents designed for specific market microstructure conditions, then use reinforcement learning to discover which agent (or combination) performs best in real-time.
Why These Specific Four Agents?
The four agents provide orthogonal failure mode coverage —each agent's weakness is another's strength:
Spoofing Detector - Optimal in consolidation/manipulation; fails in trending markets (hedged by Exhaustion Detector)
Exhaustion Detector - Optimal at trend climax; fails in range-bound markets (hedged by Liquidity Void)
Liquidity Void - Optimal pre-breakout compression; fails in established trends (hedged by Mean Reversion)
Mean Reversion - Optimal in low volatility; fails in strong trends (hedged by Spoofing Detector)
This creates complete market state coverage where at least one agent should perform well in any condition. The bandit system identifies which one without human intervention.
Why Reinforcement Learning vs. Simple Voting?
Traditional consensus systems have fatal flaws: equal weighting assumes all agents are equally reliable (false), static thresholds don't adapt, and no learning means past mistakes repeat indefinitely.
Reinforcement learning solves this through the exploration-exploitation tradeoff: Continuously test underused agents (exploration) while primarily relying on proven winners (exploitation). Over time, the system builds a probability distribution over agent quality reflecting actual market performance.
Mathematical Foundation: Multi-armed bandit problem from probability theory, where each agent is an "arm" with unknown reward distribution. The goal is to maximize cumulative reward while efficiently learning each arm's true quality.
The Four Trading Agents: Technical Explanation
Agent 1: 🎭 Spoofing Detector (Institutional Manipulation Detection)
Theoretical Basis: Market microstructure theory on order flow toxicity and information asymmetry. Based on research by Easley, López de Prado, and O'Hara on high-frequency trading manipulation.
What It Detects:
1. Iceberg Orders (Hidden Liquidity Absorption)
Method: Monitors volume spikes (>2.5× 20-period average) with minimal price movement (<0.3× ATR)
Formula: score += (close > open ? -2.5 : 2.5) when volume > vol_avg × 2.5 AND abs(close - open) / ATR < 0.3
Interpretation: Large volume without price movement indicates institutional absorption (buying) or distribution (selling) using hidden orders
Signal Logic: Contrarian—fade false breakouts caused by institutional manipulation
2. Spoofing Patterns (Fake Liquidity via Layering)
Method: Analyzes candlestick wick-to-body ratios during volume spikes
Formula: if upper_wick > body × 2 AND volume_spike: score += 2.0
Mechanism: Spoofing creates large wicks (orders pulled before execution) with volume evidence
Signal Logic: Wick direction indicates trapped participants; trade against the failed move
3. Post-Manipulation Reversals
Method: Tracks volume decay after manipulation events
Formula: if volume > vol_avg × 3 AND volume / volume < 0.3: score += (close > open ? -1.5 : 1.5)
Interpretation: Sharp volume drop after manipulation indicates exhaustion of manipulative orders
Why It Works: Institutional manipulation creates detectable microstructure anomalies. While retail traders see "mysterious reversals," this agent quantifies the order flow patterns causing them.
Parameter: i_spoof (sensitivity 0.5-2.0) - Controls detection threshold
Best Markets: Consolidations before breakouts, London/NY overlap windows, stocks with institutional ownership >70%
Agent 2: ⚡ Exhaustion Detector (Momentum Failure Analysis)
Theoretical Basis: Technical analysis divergence theory combined with VPIN reversals from market microstructure literature.
What It Detects:
1. Price-RSI Divergence (Momentum Deceleration)
Method: Compares 5-bar price ROC against RSI change
Formula: if price_roc > 5% AND rsi_current < rsi : score += 1.8
Mathematics: Second derivative detecting inflection points
Signal Logic: When price makes higher highs but momentum makes lower highs, expect mean reversion
2. Volume Exhaustion (Buying/Selling Climax)
Method: Identifies strong price moves (>5% ROC) with declining volume (<-20% volume ROC)
Formula: if price_roc > 5 AND vol_roc < -20: score += 2.5
Interpretation: Price extension without volume support indicates retail chasing while institutions exit
3. Momentum Deceleration (Acceleration Analysis)
Method: Compares recent 3-bar momentum to prior 3-bar momentum
Formula: deceleration = abs(mom1) < abs(mom2) × 0.5 where momentum significant (> ATR)
Signal Logic: When rate of price change decelerates significantly, anticipate directional shift
Why It Works: Momentum is lagging, but momentum divergence is leading. By comparing momentum's rate of change to price, this agent detects "weakening conviction" before reversals become obvious.
Parameter: i_momentum (sensitivity 0.5-2.0)
Best Markets: Strong trends reaching climax, parabolic moves, instruments with high retail participation
Agent 3: 💧 Liquidity Void Detector (Breakout Anticipation)
Theoretical Basis: Market liquidity theory and order book dynamics. Based on research into "liquidity holes" and volatility compression preceding expansion.
What It Detects:
1. Bollinger Band Squeeze (Volatility Compression)
Method: Monitors Bollinger Band width relative to 50-period average
Formula: bb_width = (upper_band - lower_band) / middle_band; triggers when < 0.6× average
Mathematical Foundation: Regression to the mean—low volatility precedes high volatility
Signal Logic: When volatility compresses AND cumulative delta shows directional bias, anticipate breakout
2. Volume Profile Gaps (Thin Liquidity Zones)
Method: Identifies sharp volume transitions indicating few limit orders
Formula: if volume < vol_avg × 0.5 AND volume < vol_avg × 0.5 AND volume > vol_avg × 1.5
Interpretation: Sudden volume drop after spike indicates price moved through order book to low-opposition area
Signal Logic: Price accelerates through low-liquidity zones
3. Stop Hunts (Liquidity Grabs Before Reversals)
Method: Detects new 20-bar highs/lows with immediate reversal and rejection wick
Formula: if new_high AND close < high - (high - low) × 0.6: score += 3.0
Mechanism: Market makers push price to trigger stop-loss clusters, then reverse
Signal Logic: Enter reversal after stop-hunt completes
Why It Works: Order book theory shows price moves fastest through zones with minimal liquidity. By identifying these zones before major moves, this agent provides early entry for high-reward breakouts.
Parameter: i_liquidity (sensitivity 0.5-2.0)
Best Markets: Range-bound pre-breakout setups, volatility compression zones, instruments prone to gap moves
Agent 4: 📊 Mean Reversion (Statistical Arbitrage Engine)
Theoretical Basis: Statistical arbitrage theory, Ornstein-Uhlenbeck mean-reverting processes, and pairs trading methodology applied to single instruments.
What It Detects:
1. Z-Score Extremes (Standard Deviation Analysis)
Method: Calculates price distance from 20-period and 50-period SMAs in standard deviation units
Formula: zscore_20 = (close - SMA20) / StdDev(50)
Statistical Interpretation: Z-score >2.0 means price is 2 standard deviations above mean (97.5th percentile)
Trigger Logic: if abs(zscore_20) > 2.0: score += zscore_20 > 0 ? -1.5 : 1.5 (fade extremes)
2. Ornstein-Uhlenbeck Process (Mean-Reverting Stochastic Model)
Method: Models price as mean-reverting stochastic process: dx = θ(μ - x)dt + σdW
Implementation: Calculates spread = close - SMA20, then z-score of spread vs. spread distribution
Formula: ou_signal = (spread - spread_mean) / spread_std
Interpretation: Measures "tension" pulling price back to equilibrium
3. Correlation Breakdown (Regime Change Detection)
Method: Compares 50-period price-volume correlation to 10-period correlation
Formula: corr_breakdown = abs(typical_corr - recent_corr) > 0.5
Enhancement: if corr_breakdown AND abs(zscore_20) > 1.0: score += zscore_20 > 0 ? -1.2 : 1.2
Why It Works: Mean reversion is the oldest quantitative strategy (1970s pairs trading at Morgan Stanley). While simple, it remains effective because markets exhibit periodic equilibrium-seeking behavior. This agent applies rigorous statistical testing to identify when mean reversion probability is highest.
Parameter: i_statarb (sensitivity 0.5-2.0)
Best Markets: Range-bound instruments, low-volatility periods (VIX <15), algo-dominated markets (forex majors, index futures)
Multi-Armed Bandit System: 15 Algorithms Explained
What Is a Multi-Armed Bandit Problem?
Origin: Named after slot machines ("one-armed bandits"). Imagine facing multiple slot machines, each with unknown payout rates. How do you maximize winnings?
Formal Definition: K arms (agents), each with unknown reward distribution with mean μᵢ. Goal: Maximize cumulative reward over T trials. Challenge: Balance exploration (trying uncertain arms to learn quality) vs. exploitation (using known-best arm for immediate reward).
Trading Application: Each agent is an "arm." After each trade, receive reward (P&L). Must decide which agent to trust for next signal.
Algorithm Categories
Bayesian Approaches (probabilistic, optimal for stationary environments):
Thompson Sampling
Bootstrapped Thompson Sampling
Discounted Thompson Sampling
Frequentist Approaches (confidence intervals, deterministic):
UCB1
UCB1-Tuned
KL-UCB
SW-UCB (Sliding Window)
D-UCB (Discounted)
Adversarial Approaches (robust to non-stationary environments):
EXP3-IX
Hedge
FPL-Gumbel
Reinforcement Learning Approaches (leverage learned state-action values):
Q-Values (from Q-Learning)
Policy Network (from Policy Gradient)
Simple Baseline:
Epsilon-Greedy
Softmax
Key Algorithm Details
Thompson Sampling (DEFAULT - RECOMMENDED)
Theoretical Foundation: Bayesian decision theory with conjugate priors. Published by Thompson (1933), rediscovered for bandits by Chapelle & Li (2011).
How It Works:
Model each agent's reward distribution as Beta(α, β) where α = wins, β = losses
Each step, sample from each agent's beta distribution: θᵢ ~ Beta(αᵢ, βᵢ)
Select agent with highest sample: argmaxᵢ θᵢ
Update winner's distribution after observing outcome
Mathematical Properties:
Optimality: Achieves logarithmic regret O(K log T) (proven optimal)
Bayesian: Maintains probability distribution over true arm means
Automatic Balance: High uncertainty → more exploration; high certainty → exploitation
⚠️ CRITICAL APPROXIMATION: This is a pseudo-random approximation of true Thompson Sampling. True implementation requires random number generation from beta distributions, which Pine Script doesn't provide. This version uses Box-Muller transform with market data (price/volume decimal digits) as entropy source. While not mathematically pure, it maintains core exploration-exploitation balance and learns agent preferences effectively.
When To Use: Best all-around choice. Handles non-stationary markets reasonably well, balances exploration naturally, highly sample-efficient.
UCB1 (Upper Confidence Bound)
Formula: UCB_i = reward_mean_i + sqrt(2 × ln(total_pulls) / pulls_i)
Interpretation: First term (exploitation) + second term (exploration bonus for less-tested arms)
Mathematical Properties:
Deterministic : Always selects same arm given same state
Regret Bound: O(K log T) — same optimality as Thompson Sampling
Interpretable: Can visualize confidence intervals
When To Use: Prefer deterministic behavior, want to visualize uncertainty, stable markets
EXP3-IX (Exponential Weights - Adversarial)
Theoretical Foundation: Adversarial bandit algorithm. Assumes environment may be actively hostile (worst-case analysis).
How It Works:
Maintain exponential weights: w_i = exp(η × cumulative_reward_i)
Select agent with probability proportional to weights: p_i = (1-γ)w_i/Σw_j + γ/K
After outcome, update with importance weighting: estimated_reward = observed_reward / p_i
Mathematical Properties:
Adversarial Regret: O(sqrt(TK log K)) even if environment is adversarial
No Assumptions: Doesn't assume stationary or stochastic reward distributions
Robust: Works even when optimal arm changes continuously
When To Use: Extreme non-stationarity, don't trust reward distribution assumptions, want robustness over efficiency
KL-UCB (Kullback-Leibler Upper Confidence Bound)
Theoretical Foundation: Uses KL-divergence instead of Hoeffding bounds. Tighter confidence intervals.
Formula (conceptual): Find largest q such that: n × KL(p||q) ≤ ln(t) + 3×ln(ln(t))
Mathematical Properties:
Tighter Bounds: KL-divergence adapts to reward distribution shape
Asymptotically Optimal: Better constant factors than UCB1
Computationally Intensive: Requires iterative binary search (15 iterations)
When To Use: Maximum sample efficiency needed, willing to pay computational cost, long-term trading (>500 bars)
Q-Values & Policy Network (RL-Based Selection)
Unique Feature: Instead of treating agents as black boxes with scalar rewards, these algorithms leverage the full RL state representation .
Q-Values Selection:
Uses learned Q-values: Q(state, agent_i) from Q-Learning
Selects agent via softmax over Q-values for current market state
Advantage: Selects based on state-conditional quality (which agent works best in THIS market state)
Policy Network Selection:
Uses neural network policy: π(agent | state, θ) from Policy Gradient
Direct policy over agents given market features
Advantage: Can learn non-linear relationships between market features and agent quality
When To Use: After 200+ RL updates (Q-Values) or 500+ updates (Policy Network) when models converged
Machine Learning & Reinforcement Learning Stack
Why Both Bandits AND Reinforcement Learning?
Critical Distinction:
Bandits treat agents as contextless black boxes: "Agent 2 has 60% win rate"
Reinforcement Learning adds state context: "Agent 2 has 60% win rate WHEN trend_score > 2 and RSI < 40"
Power of Combination: Bandits provide fast initial learning with minimal assumptions. RL provides state-dependent policies for superior long-term performance.
Component 1: Q-Learning (Value-Based RL)
Algorithm: Temporal Difference Learning with Bellman equation.
State Space: 54 discrete states formed from:
trend_state = {0: bearish, 1: neutral, 2: bullish} (3 values)
volatility_state = {0: low, 1: normal, 2: high} (3 values)
RSI_state = {0: oversold, 1: neutral, 2: overbought} (3 values)
volume_state = {0: low, 1: high} (2 values)
Total states: 3 × 3 × 3 × 2 = 54 states
Action Space: 5 actions (No trade, Agent 1, Agent 2, Agent 3, Agent 4)
Total state-action pairs: 54 × 5 = 270 Q-values
Bellman Equation:
Q(s,a) ← Q(s,a) + α ×
Parameters:
α (learning rate): 0.01-0.50, default 0.10 - Controls step size for updates
γ (discount factor): 0.80-0.99, default 0.95 - Values future rewards
ε (exploration): 0.01-0.30, default 0.10 - Probability of random action
Update Mechanism:
Position opens with state s, action a (selected agent)
Every bar position is open: Calculate floating P&L → scale to reward
Perform online TD update
When position closes: Perform terminal update with final reward
Gradient Clipping: TD errors clipped to ; Q-values clipped to for stability.
Why It Works: Q-Learning learns "quality" of each agent in each market state through trial and error. Over time, builds complete state-action value function enabling optimal state-dependent agent selection.
Component 2: TD(λ) Learning (Temporal Difference with Eligibility Traces)
Enhancement Over Basic Q-Learning: Credit assignment across multiple time steps.
The Problem TD(λ) Solves:
Position opens at t=0
Market moves favorably at t=3
Position closes at t=8
Question: Which earlier decisions contributed to success?
Basic Q-Learning: Only updates Q(s₈, a₈) ← reward
TD(λ): Updates ALL visited state-action pairs with decayed credit
Eligibility Trace Formula:
e(s,a) ← γ × λ × e(s,a) for all s,a (decay all traces)
e(s_current, a_current) ← 1 (reset current trace)
Q(s,a) ← Q(s,a) + α × TD_error × e(s,a) (update all with trace weight)
Lambda Parameter (λ): 0.5-0.99, default 0.90
λ=0: Pure 1-step TD (only immediate next state)
λ=1: Full Monte Carlo (entire episode)
λ=0.9: Balance (recommended)
Why Superior: Dramatically faster learning for multi-step tasks. Q-Learning requires many episodes to propagate rewards backwards; TD(λ) does it in one.
Component 3: Policy Gradient (REINFORCE with Baseline)
Paradigm Shift: Instead of learning value function Q(s,a), directly learn policy π(a|s).
Policy Network Architecture:
Input: 12 market features
Hidden: None (linear policy)
Output: 5 actions (softmax distribution)
Total parameters: 12 features × 5 actions + 5 biases = 65 parameters
Feature Set (12 Features):
Price Z-score (close - SMA20) / ATR
Volume ratio (volume / vol_avg - 1)
RSI deviation (RSI - 50) / 50
Bollinger width ratio
Trend score / 4 (normalized)
VWAP deviation
5-bar price ROC
5-bar volume ROC
Range/ATR ratio - 1
Price-volume correlation (20-period)
Volatility ratio (ATR / ATR_avg - 1)
EMA50 deviation
REINFORCE Update Rule:
θ ← θ + α × ∇log π(a|s) × advantage
where advantage = reward - baseline (variance reduction)
Why Baseline? Raw rewards have high variance. Subtracting baseline (running average) centers rewards around zero, reducing gradient variance by 50-70%.
Learning Rate: 0.001-0.100, default 0.010 (much lower than Q-Learning because policy gradients have high variance)
Why Policy Gradient?
Handles 12 continuous features directly (Q-Learning requires discretization)
Naturally maintains exploration through probability distribution
Can converge to stochastic optimal policy
Component 4: Ensemble Meta-Learner (Stacking)
Architecture: Level-1 meta-learner combines Level-0 base learners (Q-Learning, TD(λ), Policy Gradient).
Three Meta-Learning Algorithms:
1. Simple Average (Baseline)
Final_prediction = (Q_prediction + TD_prediction + Policy_prediction) / 3
2. Weighted Vote (Reward-Based)
weight_i ← 0.95 × weight_i + 0.05 × (reward_i + 1)
3. Adaptive Weighting (Gradient-Based) — RECOMMENDED
Loss Function: L = (y_true - ŷ_ensemble)²
Gradient: ∂L/∂weight_i = -2 × (y_true - ŷ_ensemble) × agent_contribution_i
Updates weights via gradient descent with clipping and normalization
Why It Works: Unlike simple averaging, meta-learner discovers which base learner is most reliable in current regime. If Policy Gradient excels in trending markets while Q-Learning excels in ranging, meta-learner learns these patterns and weights accordingly.
Feature Importance Tracking
Purpose: Identify which of 12 features contribute most to successful predictions.
Update Rule: importance_i ← 0.95 × importance_i + 0.05 × |feature_i × reward|
Use Cases:
Feature selection: Drop low-importance features
Market regime detection: Importance shifts reveal regime changes
Agent tuning: If VWAP deviation has high importance, consider boosting agents using VWAP
RL Position Tracking System
Critical Innovation: Proper reinforcement learning requires tracking which decisions led to outcomes.
State Tracking (When Signal Validates):
active_rl_state ← current_market_state (0-53)
active_rl_action ← selected_agent (1-4)
active_rl_entry ← entry_price
active_rl_direction ← 1 (long) or -1 (short)
active_rl_bar ← current_bar_index
Online Updates (Every Bar Position Open):
floating_pnl = (close - entry) / entry × direction
reward = floating_pnl × 10 (scale to meaningful range)
reward = clip(reward, -5.0, 5.0)
Update Q-Learning, TD(λ), and Policy Gradient
Terminal Update (Position Close):
Final Q-Learning update (no next Q-value, terminal state)
Update meta-learner with final result
Update agent memory
Clear position tracking
Exit Conditions:
Time-based: ≥3 bars held (minimum hold period)
Stop-loss: 1.5% adverse move
Take-profit: 2.0% favorable move
Market Microstructure Filters
Why Microstructure Matters
Traditional technical analysis assumes fair, efficient markets. Reality: Markets have friction, manipulation, and information asymmetry. Microstructure filters detect when market structure indicates adverse conditions.
Filter 1: VPIN (Volume-Synchronized Probability of Informed Trading)
Theoretical Foundation: Easley, López de Prado, & O'Hara (2012). "Flow Toxicity and Liquidity in a High-Frequency World."
What It Measures: Probability that current order flow is "toxic" (informed traders with private information).
Calculation:
Classify volume as buy or sell (close > close = buy volume)
Calculate imbalance over 20 bars: VPIN = |Σ buy_volume - Σ sell_volume| / Σ total_volume
Compare to moving average: toxic = VPIN > VPIN_MA(20) × sensitivity
Interpretation:
VPIN < 0.3: Normal flow (uninformed retail)
VPIN 0.3-0.4: Elevated (smart money active)
VPIN > 0.4: Toxic flow (informed institutions dominant)
Filter Logic:
Block LONG when: VPIN toxic AND price rising (don't buy into institutional distribution)
Block SHORT when: VPIN toxic AND price falling (don't sell into institutional accumulation)
Adaptive Threshold: If VPIN toxic frequently, relax threshold; if rarely toxic, tighten threshold. Bounded .
Filter 2: Toxicity (Kyle's Lambda Approximation)
Theoretical Foundation: Kyle (1985). "Continuous Auctions and Insider Trading."
What It Measures: Price impact per unit volume — market depth and informed trading.
Calculation:
price_impact = (close - close ) / sqrt(Σ volume over 10 bars)
impact_zscore = (price_impact - impact_mean) / impact_std
toxicity = abs(impact_zscore)
Interpretation:
Low toxicity (<1.0): Deep liquid market, large orders absorbed easily
High toxicity (>2.0): Thin market or informed trading
Filter Logic: Block ALL SIGNALS when toxicity > threshold. Most dangerous when price breaks from VWAP with high toxicity.
Filter 3: Regime Filter (Counter-Trend Protection)
Purpose: Prevent counter-trend trades during strong trends.
Trend Scoring:
trend_score = 0
trend_score += close > EMA8 ? +1 : -1
trend_score += EMA8 > EMA21 ? +1 : -1
trend_score += EMA21 > EMA50 ? +1 : -1
trend_score += close > EMA200 ? +1 : -1
Range:
Regime Classification:
Strong Bull: trend_score ≥ +3 → Block all SHORT signals
Strong Bear: trend_score ≤ -3 → Block all LONG signals
Neutral: -2 ≤ trend_score ≤ +2 → Allow both directions
Filter 4: Liquidity Boost (Signal Enhancer)
Unique: Unlike other filters (which block), this amplifies signals during low liquidity.
Logic: if volume < vol_avg × 0.7: agent_scores × 1.2
Why It Works: Low liquidity often precedes explosive moves (breakouts). By increasing agent sensitivity during compression, system catches pre-breakout signals earlier.
Technical Implementation & Approximations
⚠️ Critical Approximations Required by Pine Script
1. Thompson Sampling: Pseudo-Random Beta Distribution
Academic Standard: True random sampling from beta distributions using cryptographic RNG
This Implementation: Box-Muller transform for normal distribution using market data (price/volume decimal digits) as entropy source, then scale to beta distribution mean/variance
Impact: Not cryptographically random, may have subtle biases in specific price ranges, but maintains correct mean and approximate variance. Sufficient for bandit agent selection.
2. VPIN: Simplified Volume Classification
Academic Standard: Lee-Ready algorithm or exchange-provided aggressor flags with tick-by-tick data
This Implementation: Bar-based classification: if close > close : buy_volume += volume
Impact: 10-15% precision loss. Works well in directional markets, misclassifies in choppy conditions. Still captures order flow imbalance signal.
3. Policy Gradient: Simplified Per-Action Updates
Academic Standard: Full softmax gradient updating all actions (selected action UP, others DOWN proportionally)
This Implementation: Only updates selected action's weights
Impact: Valid approximation for small action spaces (5 actions). Slower convergence than full softmax but still learns optimal policy.
4. Kyle's Lambda: Simplified Price Impact
Academic Standard: Regression over multiple time scales with signed order flow
This Implementation: price_impact = Δprice_10 / sqrt(Σvolume_10); z_score calculation
Impact: 15-20% precision loss. No proper signed order flow. Still detects informed trading signals at extremes (>2σ).
5. Other Simplifications:
Hawkes Process: Fixed exponential decay (0.9) not MLE-optimized
Entropy: Ratio approximation not true Shannon entropy H(X) = -Σ p(x)·log₂(p(x))
Feature Engineering: 12 features vs. potential 100+ with polynomial interactions
RL Hybrid Updates: Both online and terminal (non-standard but empirically effective)
Overall Precision Loss Estimate: 10-15% compared to academic implementations with institutional data feeds.
Practical Trade-off: For retail trading with OHLCV data, these approximations provide 90%+ of the edge while maintaining full transparency, zero latency, no external dependencies, and runs on any TradingView plan.
How to Use: Practical Guide
Initial Setup (5 Minutes)
Select Trading Mode: Start with "Balanced" for most users
Enable ML/RL System: Toggle to TRUE, select "Full Stack" ML Mode
Bandit Configuration: Algorithm: "Thompson Sampling", Mode: "Switch" or "Blend"
Microstructure Filters: Enable all four filters, enable "Adaptive Microstructure Thresholds"
Visual Settings: Enable dashboard (Top Right), enable all chart visuals
Learning Phase (First 50-100 Signals)
What To Monitor:
Agent Performance Table: Watch win rates develop (target >55%)
Bandit Weights: Should diverge from uniform (0.25 each) after 20-30 signals
RL Core Metrics: "RL Updates" should increase when position open
Filter Status: "Blocked" count indicates filter activity
Optimization Tips:
Too few signals: Lower min_confidence to 0.25, increase agent sensitivities to 1.1-1.2
Too many signals: Raise min_confidence to 0.35-0.40, decrease agent sensitivities to 0.8-0.9
One agent dominates (>70%): Consider "Lock Agent" feature
Signal Interpretation
Dashboard Signal Status:
⚪ WAITING FOR SIGNAL: No agent signaling
⏳ ANALYZING...: Agent signaling but not confirmed
🟡 CONFIRMING 2/3: Building confirmation (2 of 3 bars)
🟢 LONG ACTIVE : Validated long entry
🔴 SHORT ACTIVE : Validated short entry
Kill Zone Boxes: Entry price (triangle marker), Take Profit (Entry + 2.5× ATR), Stop Loss (Entry - 1.5× ATR). Risk:Reward = 1:1.67
Risk Management
Position Sizing:
Risk per trade = 1-2% of capital
Position size = (Capital × Risk%) / (Entry - StopLoss)
Stop-Loss Placement:
Initial: Entry ± 1.5× ATR (shown in kill zone)
Trailing: After 1:1 R:R achieved, move stop to breakeven
Take-Profit Strategy:
TP1 (2.5× ATR): Take 50% off
TP2 (Runner): Trail stop at 1× ATR or use opposite signal as exit
Memory Persistence
Why Save Memory: Every chart reload resets the system. Saving learned parameters preserves weeks of learning.
When To Save: After 200+ signals when agent weights stabilize
What To Save: From Memory Export panel, copy all alpha/beta/weight values and adaptive thresholds
How To Restore: Enable "Restore From Saved State", input all values into corresponding fields
What Makes This Original
Innovation 1: Genuine Multi-Armed Bandit Framework
This implements 15 mathematically rigorous bandit algorithms from academic literature (Thompson Sampling from Chapelle & Li 2011, UCB family from Auer et al. 2002, EXP3 from Auer et al. 2002, KL-UCB from Garivier & Cappé 2011). Each algorithm maintains proper state, updates according to proven theory, and converges to optimal behavior. This is real learning, not superficial parameter changes.
Innovation 2: Full Reinforcement Learning Stack
Beyond bandits learning which agent works best globally, RL learns which agent works best in each market state. After 500+ positions, system builds 54-state × 5-action value function (270 learned parameters) capturing context-dependent agent quality.
Innovation 3: Market Microstructure Integration
Combines retail technical analysis with institutional-grade microstructure metrics: VPIN from Easley, López de Prado, O'Hara (2012), Kyle's Lambda from Kyle (1985), Hawkes Processes from Hawkes (1971). These detect informed trading, manipulation, and liquidity dynamics invisible to technical analysis.
Innovation 4: Adaptive Threshold System
Dynamic quantile-based thresholds: Maintains histogram of each agent's score distribution (24 bins, exponentially decayed), calculates 80th percentile threshold from histogram. Agent triggers only when score exceeds its own learned quantile. Proper non-parametric density estimation automatically adapts to instrument volatility, agent behavior shifts, and market regime changes.
Innovation 5: Episodic Memory with Transfer Learning
Dual-layer architecture: Short-term memory (last 20 trades, fast adaptation) + Long-term memory (condensed episodes, historical patterns). Transfer mechanism consolidates knowledge when STM reaches threshold. Mimics hippocampus → neocortex consolidation in human memory.
Limitations & Disclaimers
General Limitations
No Predictive Guarantee: Pattern recognition ≠ prediction. Past performance ≠ future results.
Learning Period Required: Minimum 50-100 bars for reliable statistics. Initial performance may be suboptimal.
Overfitting Risk: System learns patterns in historical data. May not generalize to unprecedented conditions.
Approximation Limitations: See technical implementation section (10-15% precision loss vs. academic standards)
Single-Instrument Limitation: No multi-asset correlation, sector context, or VIX integration.
Forward-Looking Bias Disclaimer
CRITICAL TRANSPARENCY: The RL system uses an 8-bar forward-looking window for reward calculation.
What This Means: System learns from rewards incorporating future price information (bars 101-108 relative to entry at bar 100).
Why Acceptable:
✅ Signals do NOT look ahead: Entry decisions use only data ≤ entry bar
✅ Learning only: Forward data used for optimization, not signal generation
✅ Real-time mirrors backtest: In live trading, system learns identically
⚠️ Implication: Dashboard "Agent Win%" reflects this 8-bar evaluation. Real-time performance may differ slightly if positions held longer, slippage/fees not captured, or market microstructure changes.
Risk Warnings
No Guarantee of Profit: All trading involves risk of loss
System Failures: Bugs possible despite extensive testing
Market Conditions: Optimized for liquid markets (>100k daily volume). Performance degrades in illiquid instruments, major news events, flash crashes
Broker-Specific Issues: Execution slippage, commission/fees, overnight financing costs
Appropriate Use
This Indicator Is:
✅ Entry trigger system
✅ Risk management framework (stop/target)
✅ Adaptive agent selection engine
✅ Learning system that improves over time
This Indicator Is NOT:
❌ Complete trading strategy (requires position sizing, portfolio management)
❌ Replacement for fundamental analysis
❌ Guaranteed profit generator
❌ Suitable for complete beginners without training
Recommended Complementary Analysis: Market context (support/resistance), volume profile, fundamental catalysts, correlation with related instruments, broader market regime
Recommended Settings by Instrument
Stocks (Large Cap, >$1B):
Mode: Balanced | ML/RL: Enabled, Full Stack | Bandit: Thompson Sampling, Switch
Agent Sensitivity: Spoofing 1.0-1.2, Exhaustion 0.9-1.1, Liquidity 0.8-1.0, StatArb 1.1-1.3
Microstructure: All enabled, VPIN 1.2, Toxicity 1.5 | Timeframe: 15min-1H
Forex Majors (EURUSD, GBPUSD):
Mode: Balanced to Conservative | ML/RL: Enabled, Full Stack | Bandit: Thompson Sampling, Blend
Agent Sensitivity: Spoofing 0.8-1.0, Exhaustion 0.9-1.1, Liquidity 0.7-0.9, StatArb 1.2-1.5
Microstructure: All enabled, VPIN 1.0-1.1, Toxicity 1.3-1.5 | Timeframe: 5min-30min
Crypto (BTC, ETH):
Mode: Aggressive to Balanced | ML/RL: Enabled, Full Stack | Bandit: Thompson Sampling OR EXP3-IX
Agent Sensitivity: Spoofing 1.2-1.5, Exhaustion 1.1-1.3, Liquidity 1.2-1.5, StatArb 0.7-0.9
Microstructure: All enabled, VPIN 1.4-1.6, Toxicity 1.8-2.2 | Timeframe: 15min-4H
Futures (ES, NQ, CL):
Mode: Balanced | ML/RL: Enabled, Full Stack | Bandit: UCB1 or Thompson Sampling
Agent Sensitivity: All 1.0-1.2 (balanced)
Microstructure: All enabled, VPIN 1.1-1.3, Toxicity 1.4-1.6 | Timeframe: 5min-30min
Conclusion
Algorithm Predator - Pro synthesizes academic research from market microstructure theory, reinforcement learning, and multi-armed bandit algorithms. Unlike typical indicator mashups, this system implements 15 mathematically rigorous bandit algorithms, deploys a complete RL stack (Q-Learning, TD(λ), Policy Gradient), integrates institutional microstructure metrics (VPIN, Kyle's Lambda), adapts continuously through dual-layer memory and meta-learning, and provides full transparency on approximations and limitations.
The system is designed for serious algorithmic traders who understand that no indicator is perfect, but through proper machine learning, we can build systems that improve over time and adapt to changing markets without manual intervention.
Use responsibly. Risk disclosure applies. Past performance ≠ future results.
Taking you to school. — Dskyz, Trade with insight. Trade with anticipation.
Multitimeframe Stochastic RSIIndicator is Combining 4 different timeframe Stochastic RSI and show buy signal when all of them are oversold and sell signal when all of them are overbought.
Default settings are set up for 15 minute timeframe:
K1 - 15M (period = 14)
K2 - 30M (period = 28)
K3 - 1H (period = 56)
K4 - 2H (period = 112)
It indicates top and bottoms of given period.
Its good to use as a confirmation indicator.
Feel free to comment and use it.
Greetings!
SP - MACD with DivergenceIdentifies Bullish and Bearish Divergences on any time frame.
Using with a combination of candlestick and a trend bias based on long term trend of the underlying can pic reversals quiet effectively.
Hybrid MFI The Hybrid MFI (Money Flow Index) indicator is a sophisticated momentum oscillator designed for Pine Script v5 that combines two fundamentally different approaches to analyzing market momentum. At its core, this indicator merges price-based momentum analysis with the traditional volume-weighted Money Flow Index methodology, creating a comprehensive tool that gives traders dual perspectives on market momentum in a single indicator pane. The hybrid approach allows traders to see both pure price momentum and volume-confirmed momentum simultaneously, providing a more complete picture of market dynamics than either method alone could offer.






















