QQQ Bullish Order Block - July 2, 2025//@version=6
indicator("QQQ Bullish Order Block - July 2, 2025", overlay=true)
// Define the OB candle manually (July 2, 2025)
ob_date = timestamp("2025-07-02T00:00:00")
// Conditions: Bullish order block from last bearish candle before rally
is_ob_candle = time == ob_date
// Get OB candle open and close
ob_open = request.security(syminfo.tickerid, "D", open, lookahead=barmerge.lookahead_on)
ob_close = request.security(syminfo.tickerid, "D", close, lookahead=barmerge.lookahead_on)
// Use min/max to draw OB zone correctly (in case of red candle)
ob_high = math.max(ob_open, ob_close)
ob_low = math.min(ob_open, ob_close)
// Only show zone if price is at or above it (optional filter)
show_zone = close >= ob_high
// Draw the OB zone as a filled box
if is_ob_candle and show_zone
var box ob_box = box.new(left = bar_index, right = bar_index + 30, top = ob_high, bottom = ob_low,
border_color = color.green, bgcolor = color.new(color.green, 85))
box.set_extend(ob_box, extend = extend.right)
Indicators and strategies
Current Price Horizonal LineDisplays a horizonal line across the chart of the current price.
For some reason the screenshot does not capture the indicator horizonal line.
Adjustable Percentage Range Moving Average - Add'l LinesThe Adjustable Percentage Range Moving Average (APRMA), originally developed by @ReallyWendy, is a versatile PineScript indicator designed for traders and market analysts to analyze market volatility and identify trends dynamically. Building on the original concept, this updated version plots a central moving average (MA) with four customizable percentage-based range bands around it. Users can select the MA type (SMA, EMA, HMA, RMA, SWMA, TMA, WMA, VWMA), timeframe, and length, tailoring the indicator to their trading style. Each range band (upper and lower) is calculated as a percentage offset from the MA, with adjustable colors and transparency settings for enhanced visual clarity. Extension lines project the latest values forward, with customizable styles (solid, dashed, dotted). The indicator includes toggleable display options for the MA and each range pair, making it an effective tool for identifying price ranges, support/resistance levels, and trend dynamics.
Credit to @ReallyWendy for the foundational concept.
Position Sizing Based on 42-Day Volatility (30 Holdings)30 stocks portfolio sizing based on 2x leverage. Vol targeting.
Session Prep (RTH only, UTC-4)corrected Session Prep (RTH only, UTC-4) now its working properly. hope it helps! :)
EUR/USD Multi-Layer Statistical Regression StrategyStrategy Overview
This advanced EUR/USD trading system employs a triple-layer linear regression framework with statistical validation and ensemble weighting. It combines short, medium, and long-term regression analyses to generate high-confidence directional signals while enforcing strict risk controls.
Core Components
Multi-Layer Regression Engine:
Parallel regression analysis across 3 customizable timeframes (short/medium/long)
Projects future price values using prediction horizons
Statistical significance filters (R-squared, correlation, slope thresholds)
Signal Validation System:
Lookback validation tests historical prediction accuracy
Ensemble weighting of layer signals (adjustable influence per timeframe)
Confidence scoring combining statistical strength, layer agreement, and validation accuracy
Risk Management:
Position sizing scaled by signal confidence (1%-100% of equity)
Daily loss circuit breaker (halts trading at user-defined threshold)
Forex-tailored execution (pip slippage, percentage-based commissions)
Visual Intelligence:
Real-time regression line plots (3 layered colors)
Projection markers for short-term forecasts
Background coloring for market bias indication
Comprehensive statistics dashboard (R-squared metrics, validation scores, P&L)
Key Parameters
Category Settings
Regression Short/Med/Long lengths (20/50/100 bars)
Statistics Min R² (0.65), Correlation (0.7), Slope (0.0001)
Validation 30-bar lookback, 10-bar projection
Risk Controls 50% position size, 12% daily loss limit, 75% confidence threshold
Trading Logic
Entries require:
Ensemble score > |0.5|
Confidence > threshold
Short & medium-term significance
Active daily loss limit not breached
Exits triggered by:
Opposite high-confidence signals
Daily loss limit violation (emergency exit)
The strategy blends quantitative finance techniques with practical trading safeguards, featuring a self-optimizing design where signal quality directly impacts position sizing. The visual dashboard provides real-time feedback on model performance and market conditions.
Internal Pivot Pattern [LuxAlgo]The Internal Pivot Pattern indicator is a novel method allowing traders to detect pivots without excessive delay on the chart timeframe, by using the lower timeframe data from a candle.
It features custom colors for candles and zigzag lines to help identify trends. A dashboard showing the accuracy of the pattern is also included.
🔶 USAGE
We define a pivot as the occurrence where the middle candle over a specific interval (for example, the most recent 21 bars) is the highest (pivot high) or the lowest (pivot low). This method commonly allows for identifying swing highs/lows on a trader's chart; however, this pattern can only be identified after a specific number of bars has been formed, rendering this pattern useless for real-time detection of swing highs/lows.
This indicator uses a different approach, removing the need to wait for candles to form on the user chart; instead, we check the lower timeframe data of the current candle and evaluate for the presence of a pivot given the internal data, effectively providing pivot confirmation at the candle close.
An internal pivot low pattern is indicative of a potential uptrend, while an internal pivot high is indicative of a potential downtrend.
Candles are colored based on the last internal pivot detected, with blue candle colors indicating that the most recent internal pivot is a pivot low, indicating an uptrend, while an orange candle color indicates that the most recent internal pivot is a pivot high, indicating a downtrend.
🔹 Timeframes
The timeframe setting allows controlling the amount of lower timeframe data to consider for the internal pivot detection. This setting must be lower than the user's chart timeframe.
Using a timeframe significantly lower than the user chart timeframe will evaluate a larger amount of data for the pivot detection, making it less frequent, while using a timeframe closer to the chart timeframe can make the internal pivot detection more frequent, and more prone to false positives.
🔹 Accuracy Dashboard
The Accuracy Dashboard allows evaluating how accurate the detected patterns are as a percentage, with a pattern being judged accurate if subsequent patterns are detected higher or lower than a previous one.
For example, an internal pivot low is judged accurate if the following internal pivot is higher than it, indicating that higher highs have been made.
This dashboard can be useful to determine the timeframe setting to maximize the respective internal pivot accuracy.
🔶 SETTINGS
Timeframe: Timeframe for detecting internal swings
Accuracy Dashboard: Enable or disable the Accuracy Dashboard.
🔹 Style
Internal Pivot High: Color of the dot displayed upon the detection of an internal pivot high
Internal Pivot Low: Color of the dot displayed upon the detection of an internal pivot low
Zig-Zag: Color of the zig-zag segments connecting each internal pivot
Candles: Enable candle coloring, with control over the color of the candles highlighting the detected trend
Trading Report Generator from CSVMany people use the Trading Panel. Unfortunately, it doesn't have a Performance Report. However, TradingView has strategies, and they have a Performance Report :-D
What if we combine the first and second? It's easy!
This script is a special strategy that parses transactions in csv format from Paper Trading (and it will also work for other brokers) and “plays” them. As a result, we get a Performance Report for a specific instrument based on our real trades in Paper or another broker.
How to use it :
First, we need to get a CSV file with transactions. To do this, go to the Trading Panel and connect the desired broker. Select the History tab, then the Filled sub-tab, and configure the columns there, leaving only: Side, Qty, Fill Price, Closing Time. After that, open the Export data dialog, select History, and click Export. Open the downloaded CSV file in a regular text editor (Notepad or similar). It will contain a text like this:
Symbol,Side,Qty,Fill Price,Closing Time
FX:EURUSD,Buy,1000,1.0938700000000001,2023-04-05 14:29:23
COINBASE:ETHUSD,Sell,1,1332.05,2023-01-11 17:41:33
CME_MINI:ESH2023,Sell,1,3961.75,2023-01-11 17:30:40
CME_MINI:ESH2023,Buy,1,3956.75,2023-01-11 17:08:53
Next select all the text (Ctrl+A) and copy it to the clipboard.
Now apply the "Trading Report Generator from CSV" strategy to the chart with the desired symbol and TF, open the settings/input dialog, paste the contents of the clipboard into the single text input field of the strategy, and click Ok.
That's it.
In the Strategy Tester, we see a detailed Performance Report based on our real transactions.
P.S. The CSV file may contain transactions for different instruments, for example, you may have transactions for CRYPTO:BTCUSD and NASDAQ:AAPL. To view the report is based on CRYPTO:BTCUSD trades, simply change the symbol on the chart to CRYPTO:BTCUSD. To view the report is based on NASDAQ:AAPL trades, simply change the symbol on the chart to NASDAQ:AAPL. No changes to the strategy are required.
How it works :
At the beginning of the calculation, we parse the csv once, create trade objects (Trade) and sort them in chronological order. Next, on each bar, we check whether we have trades for the time period of the next bar. If there are, we place a limit order for each trade, with limit price == Fill Price of the trade. Here, we assume that if the trade is real, its execution price will be within the bar range, and the Pine strategy engine will execute this order at the specified limit price.
Position Sizing Based on 42-Day Volatility (20 Holdings)200% position sizing for 20 holdings. Just go up 100% until all spots are taken may be less then 20 stocks.
Position Sizing Based on 42-Day Volatility (20 Holdings, 1x Cap)Position sizing based on 20 stocks with 1x cap. Fully invested no leverage.
Premarket High/Low LabelThis is the premarket high low label that will persist through current trading session. hope it helps :)
Inversed_FractalsLibrary "Inversed_Fractals"
The library is searching the FVG
find_bull_fractal(provided_fractals, low_1, time_2, bar_closed, high_1, FRACTALS_PIVOT, low_2, close_1)
Parameters:
provided_fractals (array type from maksym_hayovets/POITypes/9)
low_1 (float)
time_2 (int)
bar_closed (bool)
high_1 (float)
FRACTALS_PIVOT (int)
low_2 (float)
close_1 (float)
find_bear_fractal(provided_fractals, low_1, time_2, bar_closed, high_1, FRACTALS_PIVOT, high_2, close_1)
Parameters:
provided_fractals (array type from maksym_hayovets/POITypes/9)
low_1 (float)
time_2 (int)
bar_closed (bool)
high_1 (float)
FRACTALS_PIVOT (int)
high_2 (float)
close_1 (float)
FractalsLibrary "Fractals"
The library is searching the FVG
find_bull_fractal(provided_fractals, low_1, time_1, bar_closed, high_1, FRACTALS_PIVOT)
Parameters:
provided_fractals (array type from maksym_hayovets/POITypes/6)
low_1 (float)
time_1 (int)
bar_closed (bool)
high_1 (float)
FRACTALS_PIVOT (int)
find_bear_fractal(provided_fractals, low_1, time_1, bar_closed, high_1, FRACTALS_PIVOT)
Parameters:
provided_fractals (array type from maksym_hayovets/POITypes/6)
low_1 (float)
time_1 (int)
bar_closed (bool)
high_1 (float)
FRACTALS_PIVOT (int)
Morning Break OutThis indicator visualizes a classic morning breakout setup for the DAX and other European markets. The first hour often sets the tone for the trading day — this tool helps you identify that visually and react accordingly.
🔍 How It Works:
Box Range Calculation:
The high and low between 09:00 and 10:00 define the top and bottom of the box.
Color Logic:
Green: Price breaks above the box after 10:00 → bullish breakout
Red: Price breaks below the box after 10:00 → bearish breakout
Gray: No breakout → neutral phase
📈 Use Cases:
Identify breakout setups visually
Ideal for intraday traders and momentum strategies
Combine with volume or trend filters
⚙️ Notes:
Recommended for timeframes 1-minute and above
Uses the chart’s local timezone (e.g. CET/CEST for XETRA/DAX)
Works on all instruments with data before 09:00 — perfect for DAX, EuroStoxx, futures, FX, CFDs, etc.
Momentum DivergenceOverview
The Momentum Divergence Oscillator is a valuable tool designed for traders who are familiar with basic charting but want to deepen their market insights. This indicator combines a momentum calculation with divergence detection, presenting the data in an intuitive way with a blue momentum line and colored divergence signals ("Bull" and "Bear"). It’s perfect for refining entry and exit points across various timeframes, especially for scalping or swing trading strategies.
Understanding the Concepts
What is Momentum?
Momentum measures the speed and strength of a price movement by comparing the current closing price to a previous close over a set period. In this indicator, it’s calculated as the difference between the current close and the close from a user-defined number of bars ago (default: 10). A rising momentum line indicates accelerating upward momentum, while a falling line suggests slowing momentum or a potential reversal. This helps you gauge whether a trend is gaining power or losing steam, making it a key indicator for spotting overbought or oversold conditions.
What is a Divergence?
A divergence occurs when the price action and the momentum indicator move in opposite directions, often signaling a potential trend reversal. The Momentum Divergence Oscillator highlights two types:
Bullish Divergence: When the price forms a lower low (indicating weakness), but the momentum shows a higher low (suggesting underlying strength). This can foreshadow an upward reversal.
Bearish Divergence: When the price reaches a higher high (showing strength), but the momentum records a lower high (indicating fading momentum). This may hint at an impending downward turn.
How the Indicator Works
The indicator plots a momentum line in a separate pane below your chart, giving you a clear view of price momentum over time. It also scans for divergences using adjustable lookback periods (default: 5 bars left and right) and a range window (default: 5-60 bars) to ensure relevance. When a divergence is detected, it’s visually highlighted, and you can customize the sensitivity through input settings like the momentum length and pivot lookback. Alerts are included to notify you of new divergence signals in real-time, saving you from constant monitoring.
How to Apply It
Identifying Opportunities: Use bullish divergences ("Bull") as a cue to consider long positions, especially when confirmed by support levels or a moving average crossover. Bearish divergences ("Bear") can signal short opportunities, particularly near resistance zones.
Combining with Other Tools: Pair this oscillator with indicators like the Relative Strength Index (RSI) or volume analysis to filter out false signals and increase confidence in your trades. For example, a bullish divergence with rising volume can be a stronger buy signal.
Timeframe Flexibility: Test it on shorter timeframes (e.g., 5-minute charts) for quick scalping trades or longer ones (e.g., 1-hour or 4-hour charts) for swing trading, adjusting the momentum length to suit the market’s pace.
Alert Setup: Enable the built-in alerts to get notified when a divergence forms, allowing you to react promptly without staring at the screen all day.
Strategy Example
Spot a bullish divergence on a 15-minute chart where the price hits a lower low, but the momentum rises.
Confirm with a break above a 20-period EMA and increasing volume.
Enter a long position with a stop-loss below the recent low and a take-profit near the next resistance level.
Customization Tips
Adjust the "Momentum Length" (default: 10) to make the oscillator more or less sensitive—shorter lengths react faster, while longer ones smooth out noise.
Tweak the "Pivot Lookback" settings to widen or narrow the divergence detection range based on your trading style.
Use the "Range Upper/Lower" inputs to focus on divergences within a specific timeframe that matches your strategy.
Important Considerations
b]This indicator is a technical analysis tool, not a guaranteed trading system. Always pair it with a solid strategy and strict risk management, such as setting stop-losses.
In strong trending markets, divergences can sometimes produce false signals. Consider adding a trend filter (e.g., ADX below 25) to avoid whipsaws.
Experiment with the settings on a demo account or backtest to find what works best for your preferred markets and timeframes.
Inversed_OBLibrary "Inversed_OB"
The library is searching the OB
find_bull_ob(provided_OBs, low_1, high_1, settings_left_time, bar_closed, requested_low, WATCH_FROM_CANDLE_INDEX, WATCH_BACK_FROM_CANDLE_INDEX, PIVOT_EXTREMUM, GAP_REQUIREMENT, requested_open_1, requested_close_1, requested_open_2, requested_close_2, requested_open_3, requested_close_3, requested_open_4, requested_close_4, requested_open_5, requested_close_5, requested_open_6, requested_close_6, requested_open_7, requested_close_7, requested_open_8, requested_close_8, requested_open_9, requested_close_9, requested_open_10, requested_close_10, requested_open_11, requested_close_11, requested_open_12, requested_close_12, requested_open_13, requested_close_13, requested_open_14, requested_close_14, requested_open_15, requested_close_15)
Parameters:
provided_OBs (array type from maksym_hayovets/POITypes/9)
low_1 (float)
high_1 (float)
settings_left_time (int)
bar_closed (bool)
requested_low (float)
WATCH_FROM_CANDLE_INDEX (int)
WATCH_BACK_FROM_CANDLE_INDEX (int)
PIVOT_EXTREMUM (int)
GAP_REQUIREMENT (float)
requested_open_1 (float)
requested_close_1 (float)
requested_open_2 (float)
requested_close_2 (float)
requested_open_3 (float)
requested_close_3 (float)
requested_open_4 (float)
requested_close_4 (float)
requested_open_5 (float)
requested_close_5 (float)
requested_open_6 (float)
requested_close_6 (float)
requested_open_7 (float)
requested_close_7 (float)
requested_open_8 (float)
requested_close_8 (float)
requested_open_9 (float)
requested_close_9 (float)
requested_open_10 (float)
requested_close_10 (float)
requested_open_11 (float)
requested_close_11 (float)
requested_open_12 (float)
requested_close_12 (float)
requested_open_13 (float)
requested_close_13 (float)
requested_open_14 (float)
requested_close_14 (float)
requested_open_15 (float)
requested_close_15 (float)
find_bear_ob(provided_OBs, low_1, high_1, settings_left_time, bar_closed, requested_high, WATCH_FROM_CANDLE_INDEX, WATCH_BACK_FROM_CANDLE_INDEX, PIVOT_EXTREMUM, GAP_REQUIREMENT, requested_open_1, requested_close_1, requested_open_2, requested_close_2, requested_open_3, requested_close_3, requested_open_4, requested_close_4, requested_open_5, requested_close_5, requested_open_6, requested_close_6, requested_open_7, requested_close_7, requested_open_8, requested_close_8, requested_open_9, requested_close_9, requested_open_10, requested_close_10, requested_open_11, requested_close_11, requested_open_12, requested_close_12, requested_open_13, requested_close_13, requested_open_14, requested_close_14, requested_open_15, requested_close_15)
Parameters:
provided_OBs (array type from maksym_hayovets/POITypes/9)
low_1 (float)
high_1 (float)
settings_left_time (int)
bar_closed (bool)
requested_high (float)
WATCH_FROM_CANDLE_INDEX (int)
WATCH_BACK_FROM_CANDLE_INDEX (int)
PIVOT_EXTREMUM (int)
GAP_REQUIREMENT (float)
requested_open_1 (float)
requested_close_1 (float)
requested_open_2 (float)
requested_close_2 (float)
requested_open_3 (float)
requested_close_3 (float)
requested_open_4 (float)
requested_close_4 (float)
requested_open_5 (float)
requested_close_5 (float)
requested_open_6 (float)
requested_close_6 (float)
requested_open_7 (float)
requested_close_7 (float)
requested_open_8 (float)
requested_close_8 (float)
requested_open_9 (float)
requested_close_9 (float)
requested_open_10 (float)
requested_close_10 (float)
requested_open_11 (float)
requested_close_11 (float)
requested_open_12 (float)
requested_close_12 (float)
requested_open_13 (float)
requested_close_13 (float)
requested_open_14 (float)
requested_close_14 (float)
requested_open_15 (float)
requested_close_15 (float)
NQ Phantom Scalper Pro# 👻 NQ Phantom Scalper Pro
**Advanced VWAP Mean Reversion Strategy with Volume Confirmation**
## 🎯 Strategy Overview
The NQ Phantom Scalper Pro is a sophisticated mean reversion strategy designed specifically for Nasdaq 100 (NQ) futures scalping. This strategy combines Volume Weighted Average Price (VWAP) bands with intelligent volume spike detection to identify high-probability reversal opportunities during optimal market hours.
## 🔧 Key Features
### VWAP Band System
- **Dynamic VWAP Bands**: Automatically adjusting standard deviation bands based on intraday volatility
- **Multiple Band Levels**: Configurable Band #1 (entry trigger) and Band #2 (profit target reference)
- **Flexible Anchoring**: Choose from Session, Week, Month, Quarter, or Year-based VWAP calculations
### Volume Intelligence
- **Volume Spike Detection**: Only triggers entries when volume exceeds SMA by configurable multiplier
- **Relative Volume Display**: Real-time volume strength indicator in info panel
- **Optional Volume Filter**: Can be disabled for testing alternative setups
### Advanced Time Management
- **12-Hour Format**: User-friendly time inputs (9 AM - 4 PM default)
- **Lunch Filter**: Automatically avoids low-liquidity lunch period (12-2 PM)
- **Visual Time Zones**: Color-coded background for active/inactive periods
- **Market Hours Focus**: Optimized for peak NQ trading sessions
### Smart Risk Management
- **ATR-Based Stops**: Volatility-adjusted stop losses using Average True Range
- **Dual Exit Strategy**: VWAP mean reversion + fixed profit targets
- **Adjustable Risk-Reward**: Configurable target ratio to opposite VWAP band
- **Position Sizing**: Percentage-based equity allocation
### Optional Trend Filter
- **EMA Trend Alignment**: Optional trend filter to avoid counter-trend trades
- **Configurable Period**: Adjustable EMA length for trend determination
- **Toggle Functionality**: Enable/disable based on market conditions
## 📊 How It Works
### Entry Logic
**Long Entries**: Triggered when price touches lower VWAP band + volume spike during active hours
**Short Entries**: Triggered when price touches upper VWAP band + volume spike during active hours
### Exit Strategy
1. **VWAP Mean Reversion**: Early exit when price returns to VWAP center line
2. **Profit Target**: Fixed target based on percentage to opposite VWAP band
3. **Stop Loss**: ATR-based protective stop
### Visual Elements
- **VWAP Center Line**: Blue line showing volume-weighted fair value
- **Green Bands**: Entry trigger levels (Band #1)
- **Red Bands**: Extended levels for target reference (Band #2)
- **Orange EMA**: Trend filter line (when enabled)
- **Background Colors**: Yellow (lunch), Gray (after hours), Clear (active trading)
- **Info Panel**: Real-time metrics display
## ⚙️ Recommended Settings
### Timeframes
- **Primary**: 1-5 minute charts for scalping
- **Validation**: Test on 15-minute for swing applications
### Market Conditions
- **Best Performance**: Ranging/choppy markets with good volume
- **Trend Markets**: Enable trend filter to avoid counter-trend trades
- **High Volatility**: Increase ATR multiplier for stops
### Session Optimization
- **Pre-Market**: Generally avoided (low volume)
- **Morning Session**: 9:30 AM - 12:00 PM (high activity)
- **Lunch Period**: 12:00 PM - 2:00 PM (filtered by default)
- **Afternoon Session**: 2:00 PM - 4:00 PM (good volume)
- **After Hours**: Generally avoided (wide spreads)
## ⚠️ Risk Disclaimer
This strategy is for educational purposes only and does not constitute financial advice. Past performance does not guarantee future results. Trading futures involves substantial risk of loss and is not suitable for all investors. Users should:
- Thoroughly backtest on historical data
- Start with small position sizes
- Understand the risks of leveraged trading
- Consider transaction costs and slippage
- Never risk more than you can afford to lose
## 📈 Performance Tips
1. **Volume Threshold**: Adjust volume multiplier based on average NQ volume patterns
2. **Band Sensitivity**: Modify band multipliers for different volatility regimes
3. **Time Filters**: Customize trading hours based on your timezone and preferences
4. **Trend Alignment**: Use trend filter during strong directional markets
5. **Risk Management**: Always maintain consistent position sizing and risk parameters
**Version**: 6.0 Compatible
**Asset**: Optimized for NASDAQ 100 Futures (NQ)
**Style**: Mean Reversion Scalping
**Frequency**: High-Frequency Trading Ready
MERV: Market Entropy & Rhythm Visualizer [BullByte]The MERV (Market Entropy & Rhythm Visualizer) indicator analyzes market conditions by measuring entropy (randomness vs. trend), tradeability (volatility/momentum), and cyclical rhythm. It provides traders with an easy-to-read dashboard and oscillator to understand when markets are structured or choppy, and when trading conditions are optimal.
Purpose of the Indicator
MERV’s goal is to help traders identify different market regimes. It quantifies how structured or random recent price action is (entropy), how strong and volatile the movement is (tradeability), and whether a repeating cycle exists. By visualizing these together, MERV highlights trending vs. choppy environments and flags when conditions are favorable for entering trades. For example, a low entropy value means prices are following a clear trend line, whereas high entropy indicates a lot of noise or sideways action. The indicator’s combination of measures is original: it fuses statistical trend-fit (entropy), volatility trends (ATR and slope), and cycle analysis to give a comprehensive view of market behavior.
Why a Trader Should Use It
Traders often need to know when a market trend is reliable vs. when it is just noise. MERV helps in several ways: it shows when the market has a strong direction (low entropy, high tradeability) and when it’s ranging (high entropy). This can prevent entering trend-following strategies during choppy periods, or help catch breakouts early. The “Optimal Regime” marker (a star) highlights moments when entropy is very low and tradeability is very high, typically the best conditions for trend trades. By using MERV, a trader gains an empirical “go/no-go” signal based on price history, rather than guessing from price alone. It’s also adaptable: you can apply it to stocks, forex, crypto, etc., on any timeframe. For example, during a bullish phase of a stock, MERV will turn green (Trending Mode) and often show a star, signaling good follow-through. If the market later grinds sideways, MERV will shift to magenta (Choppy Mode), warning you that trend-following is now risky.
Why These Components Were Chosen
Market Entropy (via R²) : This measures how well recent prices fit a straight line. We compute a linear regression on the last len_entropy bars and calculate R². Entropy = 1 - R², so entropy is low when prices follow a trend (R² near 1) and high when price action is erratic (R² near 0). This single number captures trend strength vs noise.
Tradeability (ATR + Slope) : We combine two familiar measures: the Average True Range (ATR) (normalized by price) and the absolute slope of the regression line (scaled by ATR). Together they reflect how active and directional the market is. A high ATR or strong slope means big moves, making a trend more “tradeable.” We take a simple average of the normalized ATR and slope to get tradeability_raw. Then we convert it to a percentile rank over the lookback window so it’s stable between 0 and 1.
Percentile Ranks : To make entropy and tradeability values easy to interpret, we convert each to a 0–100 rank based on the past len_entropy periods. This turns raw metrics into a consistent scale. (For example, an entropy rank of 90 means current entropy is higher than 90% of recent values.) We then divide by 100 to plot them on a 0–1 scale.
Market Mode (Regime) : Based on those ranks, MERV classifies the market:
Trending (Green) : Low entropy rank (<40%) and high tradeability rank (>60%). This means the market is structurally trending with high activity.
Choppy (Magenta) : High entropy rank (>60%) and low tradeability rank (<40%). This is a mostly random, low-momentum market.
Neutral (Cyan) : All other cases. This covers mixed regimes not strongly trending or choppy.
The mode is shown as a colored bar at the bottom: green for trending, magenta for choppy, cyan for neutral.
Optimal Regime Signal : Separately, we mark an “optimal” condition when entropy_norm < 0.3 and tradeability > 0.7 (both normalized 0–1). When this is true, a ★ star appears on the bottom line. This star is colored white when truly optimal, gold when only tradeability is high (but entropy not quite low enough), and black when neither condition holds. This gives a quick visual cue for very favorable conditions.
What Makes MERV Stand Out
Holistic View : Unlike a single-oscillator, MERV combines trend, volatility, and cycle analysis in one tool. This multi-faceted approach is unique.
Visual Dashboard : The fixed on-chart dashboard (shown at your chosen corner) summarizes all metrics in bar/gauge form. Even a non-technical user can glance at it: more “█” blocks = a higher value, colors match the plots. This is more intuitive than raw numbers.
Adaptive Thresholds : Using percentile ranks means MERV auto-adjusts to each market’s character, rather than requiring fixed thresholds.
Cycle Insight : The rhythm plot adds information rarely found in indicators – it shows if there’s a repeating cycle (and its period in bars) and how strong it is. This can hint at natural bounce or reversal intervals.
Modern Look : The neon color scheme and glow effects make the lines easy to distinguish (blue/pink for entropy, green/orange for tradeability, etc.) and the filled area between them highlights when one dominates the other.
Recommended Timeframes
MERV can be applied to any timeframe, but it will be more reliable on higher timeframes. The default len_entropy = 50 and len_rhythm = 30 mean we use 30–50 bars of history, so on a daily chart that’s ~2–3 months of data; on a 1-hour chart it’s about 2–3 days. In practice:
Swing/Position traders might prefer Daily or 4H charts, where the calculations smooth out small noise. Entropy and cycles are more meaningful on longer trends.
Day trader s could use 15m or 1H charts if they adjust the inputs (e.g. shorter windows). This provides more sensitivity to intraday cycles.
Scalpers might find MERV too “slow” unless input lengths are set very low.
In summary, the indicator works anywhere, but the defaults are tuned for capturing medium-term trends. Users can adjust len_entropy and len_rhythm to match their chart’s volatility. The dashboard position can also be moved (top-left, bottom-right, etc.) so it doesn’t cover important chart areas.
How the Scoring/Logic Works (Step-by-Step)
Compute Entropy : A linear regression line is fit to the last len_entropy closes. We compute R² (goodness of fit). Entropy = 1 – R². So a strong straight-line trend gives low entropy; a flat/noisy set of points gives high entropy.
Compute Tradeability : We get ATR over len_entropy bars, normalize it by price (so it’s a fraction of price). We also calculate the regression slope (difference between the predicted close and last close). We scale |slope| by ATR to get a dimensionless measure. We average these (ATR% and slope%) to get tradeability_raw. This represents how big and directional price moves are.
Convert to Percentiles : Each new entropy and tradeability value is inserted into a rolling array of the last 50 values. We then compute the percentile rank of the current value in that array (0–100%) using a simple loop. This tells us where the current bar stands relative to history. We then divide by 100 to plot on .
Determine Modes and Signal : Based on these normalized metrics: if entropy < 0.4 and tradeability > 0.6 (40% and 60% thresholds), we set mode = Trending (1). If entropy > 0.6 and tradeability < 0.4, mode = Choppy (-1). Otherwise mode = Neutral (0). Separately, if entropy_norm < 0.3 and tradeability > 0.7, we set an optimal flag. These conditions trigger the colored mode bars and the star line.
Rhythm Detection : Every bar, if we have enough data, we take the last len_rhythm closes and compute the mean and standard deviation. Then for lags from 5 up to len_rhythm, we calculate a normalized autocorrelation coefficient. We track the lag that gives the maximum correlation (best match). This “best lag” divided by len_rhythm is plotted (a value between 0 and 1). Its color changes with the correlation strength. We also smooth the best correlation value over 5 bars to plot as “Cycle Strength” (also 0 to 1). This shows if there is a consistent cycle length in recent price action.
Heatmap (Optional) : The background color behind the oscillator panel can change with entropy. If “Neon Rainbow” style is on, low entropy is blue and high entropy is pink (via a custom color function), otherwise a classic green-to-red gradient can be used. This visually reinforces the entropy value.
Volume Regime (Dashboard Only) : We compute vol_norm = volume / sma(volume, len_entropy). If this is above 1.5, it’s considered high volume (neon orange); below 0.7 is low (blue); otherwise normal (green). The dashboard shows this as a bar gauge and percentage. This is for context only.
Oscillator Plot – How to Read It
The main panel (oscillator) has multiple colored lines on a 0–1 vertical scale, with horizontal markers at 0.2 (Low), 0.5 (Mid), and 0.8 (High). Here’s each element:
Entropy Line (Blue→Pink) : This line (and its glow) shows normalized entropy (0 = very low, 1 = very high). It is blue/green when entropy is low (strong trend) and pink/purple when entropy is high (choppy). A value near 0.0 (below 0.2 line) indicates a very well-defined trend. A value near 1.0 (above 0.8 line) means the market is very random. Watch for it dipping near 0: that suggests a strong trend has formed.
Tradeability Line (Green→Yellow) : This represents normalized tradeability. It is colored bright green when tradeability is low, transitioning to yellow as tradeability increases. Higher values (approaching 1) mean big moves and strong slopes. Typically in a market rally or crash, this line will rise. A crossing above ~0.7 often coincides with good trend strength.
Filled Area (Orange Shade) : The orange-ish fill between the entropy and tradeability lines highlights when one dominates the other. If the area is large, the two metrics diverge; if small, they are similar. This is mostly aesthetic but can catch the eye when the lines cross over or remain close.
Rhythm (Cycle) Line : This is plotted as (best_lag / len_rhythm). It indicates the relative period of the strongest cycle. For example, a value of 0.5 means the strongest cycle was about half the window length. The line’s color (green, orange, or pink) reflects how strong that cycle is (green = strong). If no clear cycle is found, this line may be flat or near zero.
Cycle Strength Line : Plotted on the same scale, this shows the autocorrelation strength (0–1). A high value (e.g. above 0.7, shown in green) means the cycle is very pronounced. Low values (pink) mean any cycle is weak and unreliable.
Mode Bars (Bottom) : Below the main oscillator, thick colored bars appear: a green bar means Trending Mode, magenta means Choppy Mode, and cyan means Neutral. These bars all have a fixed height (–0.1) and make it very easy to see the current regime.
Optimal Regime Line (Bottom) : Just below the mode bars is a thick horizontal line at –0.18. Its color indicates regime quality: White (★) means “Optimal Regime” (very low entropy and high tradeability). Gold (★) means not quite optimal (high tradeability but entropy not low enough). Black means neither condition. This star line quickly tells you when conditions are ideal (white star) or simply good (gold star).
Horizontal Guides : The dotted lines at 0.2 (Low), 0.5 (Mid), and 0.8 (High) serve as reference lines. For example, an entropy or tradeability reading above 0.8 is “High,” and below 0.2 is “Low,” as labeled on the chart. These help you gauge values at a glance.
Dashboard (Fixed Corner Panel)
MERV also includes a compact table (dashboard) that can be positioned in any corner. It summarizes key values each bar. Here is how to read its rows:
Entropy : Shows a bar of blocks (█ and ░). More █ blocks = higher entropy. It also gives a percentage (rounded). A full bar (10 blocks) with a high % means very chaotic market. The text is colored similarly (blue-green for low, pink for high).
Rhythm : Shows the best cycle period in bars (e.g. “15 bars”). If no calculation yet, it shows “n/a.” The text color matches the rhythm line.
Cycle Strength : Gives the cycle correlation as a percentage (smoothed, as shown on chart). Higher % (green) means a strong cycle.
Tradeability : Displays a 10-block gauge for tradeability. More blocks = more tradeable market. It also shows “gauge” text colored green→yellow accordingly.
Market Mode : Simply shows “Trending”, “Choppy”, or “Neutral” (cyan text) to match the mode bar color.
Volume Regime : Similar to tradeability, shows blocks for current volume vs. average. Above-average volume gives orange blocks, below-average gives blue blocks. A % value indicates current volume relative to average. This row helps see if volume is abnormally high or low.
Optimal Status (Large Row) : In bold, either “★ Optimal Regime” (white text) if the star condition is met, “★ High Tradeability” (gold text) if tradeability alone is high, or “— Not Optimal” (gray text) otherwise. This large row catches your eye when conditions are ripe.
In short, the dashboard turns the numeric state into an easy read: filled bars, colors, and text let you see current conditions without reading the plot. For instance, five blue blocks under Entropy and “25%” tells you entropy is low (good), and a row showing “Trending” in green confirms a trend state.
Real-Life Example
Example : Consider a daily chart of a trending stock (e.g. “AAPL, 1D”). During a strong uptrend, recent prices fit a clear upward line, so Entropy would be low (blue line near bottom, perhaps below the 0.2 line). Volatility and slope are high, so Tradeability is high (green-yellow line near top). In the dashboard, Entropy might show only 1–2 blocks (e.g. 10%) and Tradeability nearly full (e.g. 90%). The Market Mode bar turns green (Trending), and you might see a white ★ on the optimal line if conditions are very good. The Volume row might light orange if volume is above average during the rally. In contrast, imagine the same stock later in a tight range: Entropy will rise (pink line up, more blocks in dashboard), Tradeability falls (fewer blocks), and the Mode bar turns magenta (Choppy). No star appears in that case.
Consolidated Use Case : Suppose on XYZ stock the dashboard reads “Entropy: █░░░░░░░░ 20%”, “Tradeability: ██████████ 80%”, Mode = Trending (green), and “★ Optimal Regime.” This tells the trader that the market is in a strong, low-noise trend, and it might be a good time to follow the trend (with appropriate risk controls). If instead it reads “Entropy: ████████░░ 80%”, “Tradeability: ███▒▒▒▒▒▒ 30%”, Mode = Choppy (magenta), the trader knows the market is random and low-momentum—likely best to sit out until conditions improve.
Example: How It Looks in Action
Screenshot 1: Trending Market with High Tradeability (SOLUSD, 30m)
What it means:
The market is in a clear, strong trend with excellent conditions for trading. Both trend-following and active strategies are favored, supported by high tradeability and strong volume.
Screenshot 2: Optimal Regime, Strong Trend (ETHUSD, 1h)
What it means:
This is an ideal environment for trend trading. The market is highly organized, tradeability is excellent, and volume supports the move. This is when the indicator signals the highest probability for success.
Screenshot 3: Choppy Market with High Volume (BTC Perpetual, 5m)
What it means:
The market is highly random and choppy, despite a surge in volume. This is a high-risk, low-reward environment, avoid trend strategies, and be cautious even with mean-reversion or scalping.
Settings and Inputs
The script is fully open-source; here are key inputs the user can adjust:
Entropy Window (len_entropy) : Number of bars used for entropy and tradeability (default 50). Larger = smoother, more lag; smaller = more sensitivity.
Rhythm Window (len_rhythm ): Bars used for cycle detection (default 30). This limits the longest cycle we detect.
Dashboard Position : Choose any corner (Top Right default) so it doesn’t cover chart action.
Show Heatmap : Toggles the entropy background coloring on/off.
Heatmap Style : “Neon Rainbow” (colorful) or “Classic” (green→red).
Show Mode Bar : Turn the bottom mode bar on/off.
Show Dashboard : Turn the fixed table panel on/off.
Each setting has a tooltip explaining its effect. In the description we will mention typical settings (e.g. default window sizes) and that the user can move the dashboard corner as desired.
Oscillator Interpretation (Recap)
Lines : Blue/Pink = Entropy (low=trend, high=chop); Green/Yellow = Tradeability (low=quiet, high=volatile).
Fill : Orange tinted area between them (for visual emphasis).
Bars : Green=Trending, Magenta=Choppy, Cyan=Neutral (at bottom).
Star Line : White star = ideal conditions, Gold = good but not ideal.
Horizontal Guides : 0.2 and 0.8 lines mark low/high thresholds for each metric.
Using the chart, a coder or trader can see exactly what each output represents and make decisions accordingly.
Disclaimer
This indicator is provided as-is for educational and analytical purposes only. It does not guarantee any particular trading outcome. Past market patterns may not repeat in the future. Users should apply their own judgment and risk management; do not rely solely on this tool for trading decisions. Remember, TradingView scripts are tools for market analysis, not personalized financial advice. We encourage users to test and combine MERV with other analysis and to trade responsibly.
-BullByte
1 Hour HA Venkat Sir CommoditiesHere’s a clear and professional description you can use for your TradingView script:
---
### **Script Name:**
**1 Hour HA Venkat Sir Commodities**
### **Description:**
This indicator is designed for identifying potential **buy and sell signals** in commodity markets using **Heikin Ashi candlestick patterns** combined with a **Relative Strength Index (RSI) filter**. It works on the **1-hour timeframe** and aims to capture early trend reversals or momentum shifts.
### **Key Features:**
* ✅ **Heikin Ashi Pattern Detection:**
Detects the following reversal candlestick patterns on calculated Heikin Ashi candles:
* **Bullish Engulfing**
* **Bullish Harami**
* **Bearish Engulfing**
* **Bearish Harami**
* ✅ **RSI Confirmation Filter:**
Adds an extra layer of confirmation using the standard 14-period RSI on regular price candles:
* **Buy signals** trigger only when RSI < 40 (oversold zone).
* **Sell signals** trigger only when RSI > 60 (overbought zone).
* ✅ **Visual Signals:**
* **Green upward triangles** below candles for buy signals.
* **Red downward triangles** above candles for sell signals.
* ✅ **Alert Conditions:**
Built-in alerts to notify users when valid buy or sell conditions are met.
### **Usage Tip:**
Best used on commodities charts set to the **1-hour timeframe**. Ensure you're not using Heikin Ashi chart mode, as the script calculates its own Heikin Ashi values for accuracy and consistency.
---
Let me know if you’d like a shorter version or want this translated into Hindi or another language.
Inversed_RJLibrary "Inversed_RJ"
The library is searching the FVG
find_bull_rj(provided_RJs, low_1, high_1, time_3, bar_closed, close_1, close_2, open_2, low_2, WICK_MULTIPLIER_SIZE, PIVOT_EXTREMUM, LIQ_INSIDE_RJ)
Parameters:
provided_RJs (array type from maksym_hayovets/POITypes/9)
low_1 (float)
high_1 (float)
time_3 (int)
bar_closed (bool)
close_1 (float)
close_2 (float)
open_2 (float)
low_2 (float)
WICK_MULTIPLIER_SIZE (float)
PIVOT_EXTREMUM (int)
LIQ_INSIDE_RJ (float)
find_bear_rj(provided_RJs, low_1, high_1, time_3, bar_closed, close_1, close_2, open_2, high_2, WICK_MULTIPLIER_SIZE, PIVOT_EXTREMUM, LIQ_INSIDE_RJ)
Parameters:
provided_RJs (array type from maksym_hayovets/POITypes/9)
low_1 (float)
high_1 (float)
time_3 (int)
bar_closed (bool)
close_1 (float)
close_2 (float)
open_2 (float)
high_2 (float)
WICK_MULTIPLIER_SIZE (float)
PIVOT_EXTREMUM (int)
LIQ_INSIDE_RJ (float)
Safety TradeSafety Trade Free, Green - the lowest correction on bullmarket, Red the highest raise on bear market.
2% Averaging Buy-Sell Strategy📘 Strategy Description: 2% Averaging Buy-Sell Strategy
This strategy is designed to simulate an averaging-down and scaling-out approach based on percentage-based price movements.
Entry Logic (Buy):
Initial buy of 1 lot is triggered at the start of the strategy.
Every time the price drops by 2% from the last executed buy level, the strategy adds 2 more lots.
Exit Logic (Sell):
When the price rises 2% from the last buy level, the strategy sells 2 lots.
Selling continues in batches of 2 lots as long as the upward movement continues and lots are available.
Core Idea:
This is a dynamic averaging system that increases exposure during drawdowns and reduces it during rallies, aiming to capture mean reversion or trend reversals.
Customizable Inputs:
Initial lot size
Additional lot size
Percentage threshold (default 2%)
⚠️ Note: This strategy is for simulation/backtesting purposes. It does not account for slippage, fees, or real-world order execution conditions.