Range Breakout Statistics [Honestcowboy]⯁ Overview
The Range Breakout Statistics uses a very simple system to detect ranges/consolidating markets. The principle is simple, it looks for areas where the slope of a moving average is flat compared to past values. If the moving average is flat for X amount of bars that's a range and it will draw a box.
The statistics part of the script is a bit more complicated. The aim of this script is to expand analysis of trading signals in a different way than a regular backtest. It also highlights the polyline tool, one of my favorite drawing tools on the tradingview platform.
⯁ Statistics Methods
The script has 2 different modes of analyzing a trading signals strength/robustness. It will do that for 2 signals native to the script.
Upper breakout: first price breakout at top of box, before max bars (100 bars by default)
Lower breakout: first price breakout at bottom of box, before max bars
The analysis methods themselves are straightforward and it should be possible for tradingview community to expand this type of analysis to other trading signals. This script is a demo for this analysis, yet some might still find the native signals helpful in their trading, that's why the script includes alerts for the 2 native signals. I've also added a setting to disable any data gathering, which makes script run faster if you want to automate it.
For both of the analysis methods it uses the same data, just with different calculations and drawing methods. The data set is all past price action reactions to the signals saved in a matrix. Below a chart for explaining this visually.
⯁ Method 1: Averages Projection
The idea behind this is that just showing all price action that happened after signal does not give actionable insights. It's more a spaghetti jumble mess of price action lines. So instead the script averages the data out using 3 different approaches, all selectable in the settings menu.
Geometric Average: useful as it accurately reflects compound returns over time, smoothing out the impact of large gains or losses. Accounts for volatility drift.
Arithmetic Average: a standard average calculation, can be misleading in trading due to volatility drift. It is the most basic form of averaging so I included it.
Median: useful as any big volatility huge moves after a signal does not really impact the mean as it's just the middle value of all values.
These averages are the 2 lines you will find in the middle of the projection. Having a clear difference between a lower break average and upper break average price reaction can signal significance of the trading signal instead of pure chaos.
Outside of this I also included calculations for the maximum and minimum values in the dataset. This is useful for seeing price reactions range to the signal, showing extreme losses or wins are possible. For this range I also included 2 matrices of highs and lows data. This makes it possible to draw a band between the range based on closing price and the one using high/low data.
Below is a visualisation of how the averages data is shown on chart.
⯁ Method 2: Equity Simulation
This method will feel closer to home for traders as it more closely resembles a backtest. It does not include any commissions however and also is just a visualisation of price reaction to a signal. This method will simulate what would happen if you would buy at the breakout point and hold the trade for X amount of bars. With 0 being sell at same bar close. To test robustness I've given the option to visualise Equity simulation not just for 1 simulation but a bunch of simulations.
On default settings it will draw the simulations for 0 bars holding all the way to 10 bars holding. The idea behind it is to check how stable the effect is, to have further confirmation of the significance of the signal. If price simulation line moves up on average for 0 bars all the way to 10 bars holding time that means the signal is steady.
Below is a visualisation of the Equity Simulation.
⯁ Signal filtering
For the boxes themselves where breakouts come from I've included a simple filter based on the size of the box in ATR or %. This will filter out all the boxes that are larger top to bottom than the ATR or % value you setup.
⯁ Coloring of Script
The script includes 5 color themes. There are no color settings or other visual settings in the script, the script themes are simple and always have colors that work well together. Equity simulation uses a gradient based on lightness to color the different lines so it's easier to differentiate them while still upper breaks having a different color than lower breaks.
This script is not created to be used in conjunction with other scripts, it will force you into a background color that matches the theme. It's purpose is a research tool for systematic trading, to analyse signals in more depth.
Metaverse color theme:
⯁ Conclusion
I hope this script will help traders get a deeper understanding of how different assets react to their assets. It should be possible to convert this script into other signals if you know how to code on the platform. It is my intention to make more publications that include this type of analysis. It is especially useful when dealing with signals that do not happen often enough, so a regular backtest is not enough to test their significance.
Educational
SuperTrend AI + PVSRA Full DashboardOPERATIONAL MANUAL: SuperTrend AI + PVSRA (4H Timeframe)
1. CORE STRATEGY OVERVIEW
The 4H timeframe is the "Institutional Standard." This strategy combines K-Means AI Clustering for trend detection with PVSRA (Price, Volume, Spread, Range Analysis) to identify bank maneuvers.
The goal is to enter trades only when AI trend, Institutional Volume, and Moving Average momentum align perfectly.
2. OPTIMAL 4H CONFIGURATION
AI Performance Memory: 15 to 20 (Provides trend stability against 4H noise).
Factor Range: 1.5 - 5.0 (Allows AI to scale during massive BTC/Crypto cycles).
PVSRA Climax Factor: 2.7 (The filter for significant institutional intervention).
SMA 200 (Institutional): Always active; serves as the ultimate "Bull/Bear" boundary.
3. ENTRY PROTOCOLS: "SUPER CONFLUENCE"
Entries are strictly executed upon the appearance of the SUPER CONFLUENCE label.
A. LONG SETUP (BUY)
AI Trend: The AI Trailing Stop line must be Teal (Bullish).
PVSRA Volume: A Green (Climax) or Blue (Rising) candle must be present.
The Trigger: A "SUPER CONFLUENCE BUY" tag appears (signaling a SMA 20 / AI Line crossover).
Confirmation: Higher probability if the Dashboard shows "Trend 200: ABOVE".
B. SHORT SETUP (SELL)
AI Trend: The AI Trailing Stop line must be Magenta/Red (Bearish).
PVSRA Volume: A Purple (Climax) or Orange (Rising) candle must be present.
The Trigger: A "SUPER CONFLUENCE SELL" tag appears.
Confirmation: Higher probability if the Dashboard shows "Trend 200: BELOW".
4. RISK & TRADE MANAGEMENT
ACTION 4H TIME-BASED RULE
Stop Loss Place SL behind the most recent PVSRA Climax candle wick or the AI Line.
Take Profit 1 Exit 50% at the nearest S/R Level (Red/Blue rectangles) or 1:1.5 RR.
Trailing Stop Trail the Dynamic SMA 20. Exit if the SMA 20 changes color against you.
Exit Signal Immediate exit if a Climax volume of the opposite color appears at a key level
for Me the best settings but You experiment and find yours;
ATR lenght AI :10
Factor range min 2 max 5
Step 1
Perfor.Mem.10
Source : Best
Volume Period 10
Climax 2.5
Multiplier Rising 1.5
Thank you all and happy trading
Gaps-Trendlines-CHOCH-BOS By @crypto_alphabitBINANCE:BTCUSDT
This indicator includes .....
1) Fair value gaps ...
* Bullish gaps
* Bearish gaps
* Automatically removed when the gaps filled
* Gaps color can be changed from setting
2) Recent Trend lines
* Higher trend lines ( from high to high)
* Lower trend lines ( from low to low )
* Higher trend lines breakout ( Bullish Breakout)
* Lower trend lines breakout ( bearish Breakout)
* Coloring breakout candle
* Colors can be changed from setting
* Swing lookback can be changed from setting
* Alert for Bullish Breakout
* Alert for Bearish Breakout
3) COCH & BOS
* Bullish Change of character
* Bearish change of character
* Bullish break of structure
* Bearish break of structure
* Swing lookback can be changed from setting
* Keeping specific number of last drawings
* keeping and removing exact ( CHOCH or BOS) can be managed from setting
* Colors can be changed from setting
* Alert for Bullish CHOCH
* Alert for Bearish CHOCH
* Alert for Bullish BOS
* Alert for Bearish BOS
Thank you for reading .... by @Crypto_alphabit
SuperTrend AI + PVSRA Full DashboardI tried to combine various indicators already created in a single version that can also guarantee a certain customization on colors, intensity of tables, etc. etc. The functioning, the operation is similar to the previous ones, I won't go into detail, at most take a look at the previous versions.
1. The "AI" Component: Multi-SuperTrend Clustering
Instead of using a single SuperTrend with a fixed multiplier, this script:
Simultaneously runs multiple SuperTrends with different sensitivities (multipliers).
Evaluates Performance: It tracks which multiplier would have been most profitable in recent bars.
K-Means Clustering: It uses an AI algorithm to group these multipliers into "Best," "Average," and "Worst" clusters.
Adaptive Trailing Stop: It automatically selects the "Best" multiplier to plot the AI Trailing Stop line on your chart, making it more responsive to changing market volatility than a standard indicator.
2. PVSRA Logic (Institutional Volumes)
PVSRA stands for Price Volume Support Resistance Analysis. The script re-colors candles based on volume intensity:
Climax Bull (Bright Green): Extremely high volume on a bullish candle. Usually indicates institutional buying or a trend climax.
Climax Bear (Magenta/Purple): Extremely high volume on a bearish candle. Usually indicates institutional selling or a panic bottom.
Rising (Grey/Silver): Above-average volume, showing increasing interest.
3. The "Super Confluence" Signal
This is the "Golden Signal" of the script. It triggers a BUY or SELL label only when several conditions align:
AI Trend Switch: The AI Trailing Stop flips direction.
SMA 20 Cross: The AI line crosses the 20-period Simple Moving Average.
Volume Confirmation: A PVSRA Climax or Rising volume must occur on that specific bar.
Directional Alignment: The candle color must match the trend direction.
4. Summary Dashboard (Top Right)
The dashboard provides a "Quick Glance" at the market structure:
AI Trend: Shows if the machine learning model is currently Bullish or Bearish.
PVSRA Vol: Identifies the current volume signature (Normal vs. Climax).
SMA 20/50: Shows medium-term momentum (Bullish if 20 > 50).
Trend 200: Shows the macro trend. ABOVE means long-term bullish; BELOW means long-term bearish.
How to Trade with This Script
Signal Strategy
"SUPER CONFLUENCE BUY" Look for entries. High probability if Trend 200 is "ABOVE".
"SUPER CONFLUENCE SELL" Look for shorts. High probability if Trend 200 is "BELOW".
Magenta/Green Candles Caution: These are "Stop Hunts" or "Institutional Entries." Do not
trade against these candles without a clear reversal pattern.
Technical Tip
The variable target_f is the "AI-optimized multiplier." If you see this value changing frequently in the dashboard, it means the market is volatile, and the AI is struggling to find a stable trend. If it stays consistent, the trend is likely solid.
Thanks everyone and happy trading
Adaptive For LoopThe Adaptive For Loop is a new advanced trend following tool that can avoid false signals while keeping a high speed.
Benefits
- Good speed
- Low noise
- High Performance on INDEX:BTCUSD
- Plotting for clear visualization of trend and values.
The Idea
Before I tried using a For Loop on a singular piece of source - but every source was noisy in different parts and was not really that good.
So I got an idea: How about I make a for loop on all of them (open, high, low, close) and filter them to get the best out of all worlds?
How it works
Calculate the For Loop for open, high, low, close -> a For Loop compares the current value to past values and scores it accordingly.
After calculating them, it picks the one with the highest absolute value. This means only the for loop with the highest strength gets applied. This filters noise and provides users with high speed even in the environments that do not support it.
Enjoy Gs!
Heikin Ashi SMA 9 / 20 / 50 (MTF + Selectable Source)This is simple Heikin ashi value three moving average as 9 / 20 / 50 for clear trend identification . use it wisely with other confirmation .
EMA + PDH/PDL 2 Days [Scalping-Algo]🎯 Overview
A clean, focused scalping indicator designed for 2-minute and 4-minute stock charts. Combines trend-following EMAs with key daily support/resistance zones to identify high-probability scalp entries.
🛠️ What's Included
ComponentDescription🟡 EMA 13Fast momentum line🟣 EMA 48Medium trend filter🔴 EMA 200Major trend direction🔵 PDH/PDLPrevious day high & low zones🟠 PDH-2/PDL-22 days ago high & low zones
⏰ Session Filter
Only displays levels during regular trading hours (9:30 AM - 4:00 PM EST) to keep your chart clean during pre/post market.
📊 How to Use for Scalping
✅ Long Setup (2m/4m chart)
Price above EMA 200 (bullish bias)
Price pulls back to PDH/PDL zone or EMA 48
EMA 13 crosses above EMA 48
Enter on bounce from zone
Target: next resistance zone or 1:2 R/R
❌ Short Setup (2m/4m chart)
Price below EMA 200 (bearish bias)
Price rallies into PDH/PDL zone or EMA 48
EMA 13 crosses below EMA 48
Enter on rejection from zone
Target: next support zone or 1:2 R/R
💡 Pro Tips
TipWhy🔥 Trade the first hourMost volume & volatility🎯 Zone confluenceBest setups when PDH/PDL aligns with EMAs⚡ Quick exitsScalping = small gains, don't overstay🚫 Avoid chopSkip trades when price is stuck between zones📉 Respect EMA 200Don't long below it, don't short above it
🔵 Zone Colors Explained
Blue zones → Yesterday's high/low (stronger levels)
Orange zones → 2 days ago high/low (secondary levels)
Zone thickness → 20 ticks buffer for natural price noise
⚙️ Best Settings
TimeframeBest For2 minuteQuick scalps, 5-15 cent targets4 minuteSlightly larger moves, less noise
📌 Recommended Pairs
Works best on liquid stocks with tight spreads:
SPY, QQQ, AAPL, TSLA, AMD, NVDA, META, AMZN
⚠️ Risk Management
RuleSuggestion🛑 Stop lossBelow/above the zone (tight)🎯 Take profit1:2 or 1:3 risk/reward minimum📏 Position sizeMax 1-2% account risk per trade
🚀 Quick Start
Add indicator to 2m or 4m chart
Wait for price to reach a colored zone
Confirm trend direction with EMA 200
Look for EMA 13/48 alignment
Enter with tight stop, scale out at targets
KCP ATR + EMA Bands [Dr. K. C. Prakash]📊 KCP ATR + EMA Bands
KCP ATR + EMA Bands is a trend-responsive volatility channel indicator that combines the Exponential Moving Average (EMA) with Average True Range (ATR) to identify trend direction, dynamic support & resistance, trade zones, and extreme price conditions.
It is designed for intraday, swing, and positional trading, especially in indices, futures, and high-liquidity stocks.
🔧 How the Indicator Works
1️⃣ EMA – Trend Anchor
The EMA (default: 21) acts as the core trend line:
Price above EMA → bullish bias
Price below EMA → bearish bias
2️⃣ ATR – Volatility Engine
The ATR measures real-time volatility and expands or contracts the bands automatically:
High volatility → wider bands
Low volatility → tighter bands
This makes the indicator adaptive, unlike fixed-width channels.
3️⃣ Inner Bands – Trade Zones
Constructed using ATR × 1.0
Represent high-probability pullback and continuation zones
Useful for:
Pullback entries
Trend continuation trades
Mean-reversion setups within trend
4️⃣ Outer Bands – Extreme Zones
Constructed using ATR × 2.0
Represent price extremes
Ideal for:
Profit booking
Reversal watch zones
Stop-loss reference levels
🎨 Visual Design (Professional)
🟢 Green bands → bullish zones & support
🔴 Red bands → bearish zones & resistance
⚪ Gray EMA → neutral trend reference
Clean fills help identify bullish and bearish pressure zones without clutter.
📈 Trading Applications
✔ Trend Trading
Buy on pullbacks near lower inner band when price is above EMA
Sell on pullbacks near upper inner band when price is below EMA
✔ Breakout Trading
Strong closes beyond inner bands indicate momentum expansion
Breaks beyond outer bands signal exhaustion or strong continuation
✔ Risk Management
Inner bands → trailing stop reference
Outer bands → hard stop or target zones
⏱️ Best Timeframes
5m / 15m → Intraday trading
30m / 1H → Swing trading
Daily → Positional trading
🏆 Why This Indicator Stands Out
✔ Combines trend + volatility in one tool
✔ Adaptive to market conditions
✔ Reduces noise compared to fixed bands
✔ Clear visual guidance for entries, exits & risk
✔ Works across asset classes
⚠️ Important Note
This indicator performs best in trending or expanding volatility markets.
Always confirm trades with price action, volume, or higher-timeframe bias.
KCP RSI + EMA Trend [Dr. K. C. Prakash]KCP RSI + EMA Trend
A professional, low-noise momentum indicator built on Volume-Weighted RSI and EMA trend confirmation, designed to filter false signals and capture high-probability trend moves.
Key Highlights (in simple terms):
Volume-Weighted RSI (VWRSI): Gives more importance to high-volume price moves, reducing weak signals.
EMA-14 on RSI: Confirms momentum direction and avoids premature entries.
HTF RSI Filter (Auto): Aligns trades with higher-timeframe trend (5m→15m, 15m→1H).
Strong Anti-False Filters: Uses RSI slope, range detection, and volume strength.
Clear Zones: Only 20 / 80 extreme levels for clean overbought–oversold structure.
Signals:
BUY: RSI crosses above 50 with volume + HTF trend confirmation
SELL: RSI crosses below 50 with volume + HTF trend confirmation
Best Use:
✔ Intraday & scalping (5m / 15m)
✔ Trend-following entries
✔ Avoiding sideways market traps
Ideal for: Traders who want clean, disciplined signals without over-trading.
KCP MACD Pro [Dr. K. C. Prakash]📊 KCP MACD Pro
KCP MACD Pro is a clean, low-noise momentum indicator designed for clear trend and momentum analysis without clutter. Unlike the classical MACD, this version is built without EMA, using Simple Moving Averages (SMA) to provide smoother, more stable signals, making it ideal for training, classroom use, and disciplined trading.
🔹 Core Concept
The indicator measures momentum strength and direction by calculating the difference between:
a Fast SMA and a Slow SMA (MACD line), and
a Signal SMA applied to the MACD line.
The result is a MACD-style oscillator that reacts less aggressively than EMA-based MACD, helping traders focus on structure and trend quality rather than short-term noise.
🔹 Components Explained
MACD Line (SMA-based):
Shows the underlying momentum by comparing short-term and long-term price averages.
Signal Line (SMA):
Smooths the MACD line to highlight momentum shifts.
Histogram:
Displays the distance between the MACD and Signal lines, visually representing momentum strength.
Zero Line:
Acts as a trend equilibrium level:
Above zero → bullish momentum bias
Below zero → bearish momentum bias
🔹 How to Use
Trend Identification:
Stay aligned with the market bias using the zero line.
Momentum Analysis:
Expanding histogram bars indicate strengthening momentum; contracting bars suggest weakening momentum.
Manual Trade Decisions:
Designed intentionally without buy/sell arrows, encouraging traders to combine it with price action, support–resistance, or market structure.
Volume SMA 9 / 20 / 50This is real time volume average lines having option to select period of volume lines . it not only provides volume with respect to price action but also we can find out real picture of price action pressure. use it with ADX and MACD wisely . only volume spike is not confirmation some times fake breakout , so wait for confirmation and participate at breakout confirmation.
Micro Futures Risk Calculator (Minimal)risk calculator based off of stop distance. to keep risk consistent for consistent growth
Trap longs - Hamza Naveed// This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
//@version=5
indicator("Trap Longs - Hamza Naveed", max_labels_count = 500, overlay = false, format = format.volume)
g1 = '📊 Net Positions '
g2 = '📈 Moving Averages (VWMA/EMA) '
g3 = '⚙️ Additional Settings '
g4 = '🎚️ Profile '
g5 = '🖥️ Statistics '
g6 = '⚖️ Divergences'
// User inputs - General settings
dtype = input.string('Net Positions', 'Type', options = )
disp = input.string('Candles', 'Display as', options = )
cumu = input.string('Full Data', 'Cumulation', options = )
denom = input.string('Quote Currency', 'Quoted in', options = )
// User inputs - Data Source Settings
binance = input.bool(true, 'Binance USDT.P', inline = 'src')
binance2 = input.bool(true, 'Binance USD.P', inline = 'src')
binance3 = input.bool(true, 'Binance BUSD.P', inline = 'src2')
bitmex = input.bool(true, 'BitMEX USD.P', inline = 'src2')
bitmex2 = input.bool(true, 'BitMEX USDT.P ', inline = 'src3')
kraken = input.bool(true, 'Kraken USD.P', inline = 'src3')
// User inputs - Net Positions
showL = input.bool(true, 'NET LONGS ►', group = g1, inline='l')
showS = input.bool(false, 'NET SHORTS ►', group = g1, inline='s')
showD = input.bool(false, 'NET DELTA ►', group = g1, inline='d')
showR = input.bool(false, 'NET RATIO ►', group = g1, inline='r')
pcolL = input.color(#a5d6a7, '', group = g1, inline = 'l')
ncolL = input.color(#f77c80, '', group = g1, inline = 'l')
lcolL = input.color(#a5d6a7, '━', group = g1, inline = 'l')
pcolS = input.color(#a5d6a7, '', group = g1, inline = 's')
ncolS = input.color(#f77c80, '', group = g1, inline = 's')
lcolS = input.color(#faa1a4, '━', group = g1, inline = 's')
pcolD = input.color(#a5d6a7, '', group = g1, inline = 'd')
ncolD = input.color(#f77c80, '', group = g1, inline = 'd')
lcolD = input.color(#90bff9, '━', group = g1, inline = 'd')
pcolR = input.color(#a5d6a7, '', group = g1, inline = 'r')
ncolR = input.color(#f77c80, '', group = g1, inline = 'r')
lcolR = input.color(#f9d690, '━', group = g1, inline = 'r')
// User inputs - Net Positions EMAs
mat = input.string('VWMA', 'Type', options= , group=g2)
emaL = input.bool(false, 'LONGS ', group=g2, inline='emal')
emaS = input.bool(false, 'SHORTS ', group=g2, inline='emas')
emaD = input.bool(false, 'DELTA ',group=g2, inline='emad')
emaR = input.bool(false, 'RATIO ',group=g2, inline='emar')
emaLl = input.int(100, '', group=g2, inline='emal')
emaSl = input.int(100, '', group=g2, inline='emas')
emaDl = input.int(100, '', group=g2, inline='emad')
emaRl = input.int(100, '', group=g2, inline='emar')
emaLc = input.color(color.rgb(165, 214, 167, 60), '', group=g2, inline='emal')
emaSc = input.color(color.rgb(250, 161, 164, 60), '', group=g2, inline='emas')
emaDc = input.color(color.rgb(144, 191, 249, 60), '', group=g2, inline='emad')
emaRc = input.color(color.rgb(249, 214, 144, 60), '', group=g2, inline='emar')
// User inputs - Additional settings
volhm = input.bool(false, 'Volume HM', group=g3, inline='vol')
volc2 = input.color(color.rgb(49, 121, 245),'', group=g3, inline = 'vol')
offs = input.int (10, 'Label Offset', group=g3)
length = input.int (14, 'Position RSI Length', group=g3)
vlbl = input.bool(true, 'Value Labels', group=g3, inline='lv')
nlbl = input.bool(true, 'Data Labels', group=g3, inline='lv')
wick = input.bool(false, 'Show Candle Wicks', group=g3)
// User inputs - Profile settings
prof = input.bool (false, 'Generate a profile', group=g4)
profsrc = input.string('Net Longs', 'Profile Data', options = , group=g4)
vapct = input.float (70, 'Value Area %', minval = 5, maxval = 95, group = g4)
ori = input.string("Left", 'Position', options = , group = g4)
profSize = input.int (2, 'Node Size', minval = 1, group = g4)
rows = input.int (40, 'Rows', minval = 6, maxval = 500, step = 25, group = g4) - 1
vancol = input.color (color.new(color.blue, 75), 'Node Colors ', group = g4, inline = 'nc')
nvancol = input.color (color.new(color.gray, 75), '━', group = g4, inline = 'nc')
poc = input.bool (false, 'POC', group = g4, inline = 'POC'),
poccol = input.color (color.new(color.red, 50), ' ', group = g4, inline = "POC")
val = input.bool (false, 'VA', group = g4, inline = "VA")
vafill = input.color (color.new(color.blue, 95), ' ', group = g4, inline = 'VA')
// User inputs - Statistics
stats = input.bool(false, 'Show Stats', group = g5)
chg_b = input.int(50, 'Bars Back', group = g5)
tablevpos = input.string('Horizontal', 'Orientation', options= , group = g5)
tablepos = input.string('Bottom Center', 'Position', options= , group = g5)
stat_oi = input.bool(true, 'OI ━', group = g5, inline = 'oi')
stat_nl = input.bool(true, 'NL ━', group = g5, inline = 'nl')
stat_ns = input.bool(true, 'NS ━', group = g5, inline = 'ns')
stat_nd = input.bool(true, 'ND ━', group = g5, inline = 'nd')
stat_oi_c = input.bool(true, 'OI Change ━', group = g5, inline = 'oi')
stat_nl_c = input.bool(true, 'NL Change ━', group = g5, inline = 'nl')
stat_ns_c = input.bool(true, 'NS Change ━', group = g5, inline = 'ns')
stat_nd_c = input.bool(true, 'ND Change ━', group = g5, inline = 'nd')
stat_oi_r = input.bool(true, 'OI RSI', group = g5, inline = 'oi')
stat_nl_r = input.bool(true, 'NL RSI', group = g5, inline = 'nl')
stat_ns_r = input.bool(true, 'NS RSI', group = g5, inline = 'ns')
stat_nd_r = input.bool(true, 'ND RSI', group = g5, inline = 'nd')
// User inputs - Divergence Finder
showdiv = input.bool(false, 'Divergence finder', group = g6)
divsrc = input.string('Net Longs', 'Source', options = , group=g6)
pivotDistance = input.int(5, 'Maximum Distance', minval=0, group=g6)
leftPivot = input.int(8, 'Lookback Bars Left', minval=1, group=g6)
rightPivot = input.int(8, 'Lookback Bars Right', minval=1, group=g6)
pHH_npLH = input.bool(true, 'Price HH + Data LH', group = g6, inline='div1')
pLH_npHH = input.bool(true, 'Price LH + Data HH', group = g6, inline='div2')
pLL_npHL = input.bool(true, 'Price LL + Data HL ', group = g6, inline='div3')
pHL_npLL = input.bool(true, 'Price HL + Data LL ', group = g6, inline='div4')
pHH_npLHcol = input.color(color.red, '', group = g6, inline='div1')
pLH_npHHcol = input.color(color.red, '', group = g6, inline='div2')
pLL_npHLcol = input.color(color.green, '', group = g6, inline='div3')
pHL_npLLcol = input.color(color.green, '', group = g6, inline='div4')
// Getting OI data
mex = syminfo.basecurrency=='BTC' ? 'XBT' : string(syminfo.basecurrency)
= request.security('BINANCE' + ":" + string(syminfo.basecurrency) + 'USDT.P_OI', timeframe.period, [close-close , close], ignore_invalid_symbol = true)
= request.security('BINANCE' + ":" + string(syminfo.basecurrency) + 'USD.P_OI', timeframe.period, [close-close , close], ignore_invalid_symbol = true)
= request.security('BINANCE' + ":" + string(syminfo.basecurrency) + 'BUSD.P_OI', timeframe.period, [close-close , close], ignore_invalid_symbol = true)
= request.security('BITMEX' + ":" + mex + 'USD.P_OI', timeframe.period, [close-close , close], ignore_invalid_symbol = true)
= request.security('BITMEX' + ":" + mex + 'USDT.P_OI', timeframe.period, [close-close , close], ignore_invalid_symbol = true)
= request.security('KRAKEN' + ":" + string(syminfo.basecurrency) + 'USD.P_OI', timeframe.period, [close-close , close], ignore_invalid_symbol = true)
deltaOI = (binance ? nz(oid1,0) : 0) + (binance2 ? nz(oid2,0)/close : 0) + (binance3 ? nz(oid3,0) : 0) + (bitmex ? nz(oid4,0)/close : 0) + (bitmex2 ? nz(oid5,0)/close : 0) + (kraken ? nz(oid6,0)/close : 0)
OI = (binance ? nz(oi1,0) : 0) + (binance2 ? nz(oi2,0)/close : 0) + (binance3 ? nz(oi3,0) : 0) + (bitmex ? nz(oi4,0)/close : 0) + (bitmex2 ? nz(oi5,0)/close : 0) + (kraken ? nz(oi6,0)/close : 0)
// Conditions for positions entering and exiting
priceUP = close>open
priceDOWN = close0
oiDOWN = deltaOI<0
newlongs = oiUP and priceUP
rektlongs = oiDOWN and priceDOWN
newshorts = oiUP and priceDOWN
rektshorts = oiDOWN and priceUP
// Visible range
vrc = cumu=='Visible Range' ? time > chart.left_visible_bar_time and time <= chart.right_visible_bar_time : true
// Cumulation of positions entering and exiting
longs_entering = ta.cum(newlongs and vrc ? (denom=='Base Currency' ? deltaOI : deltaOI * close) : 0)
longs_exiting = ta.cum(rektlongs and vrc ? (denom=='Base Currency' ? deltaOI : deltaOI * close) : 0)
shorts_entering = ta.cum(newshorts and vrc ? (denom=='Base Currency' ? deltaOI : deltaOI * close) : 0)
shorts_exiting = ta.cum(rektshorts and vrc ? (denom=='Base Currency' ? deltaOI : deltaOI * close) : 0)
// Output data
net_longs = longs_entering - math.abs(longs_exiting)
net_shorts = shorts_entering - math.abs(shorts_exiting)
net_delta = net_longs - net_shorts
net_ratio = net_longs / net_shorts
// Calculating Relative Strength
longs_strength = ta.rsi(net_longs, length)
shorts_strength = ta.rsi(net_shorts, length)
delta_strength = ta.rsi(net_delta, length)
ratio_strength = ta.rsi(net_ratio, length)
oi_strength = ta.rsi(OI, length)
// Calculating candle OHLC
src = dtype=='Net Positions' ? net_longs : longs_strength
OpenL = wick ? ta.sma(src , 2) : src
HighL = ta.highest(src, 1)
LowL = ta.lowest(src, 1)
CloseL = wick ? ta.sma(src, 2) : src
src2 = dtype=='Net Positions' ? net_shorts : shorts_strength
OpenS = wick ? ta.sma(src2 , 2) : src2
HighS = ta.highest(src2, 1)
LowS = ta.lowest(src2, 1)
CloseS = wick ? ta.sma(src2, 2) : src2
src3 = dtype=='Net Positions' ? net_delta : delta_strength
OpenD = wick ? ta.sma(src3 , 2) : src3
HighD = ta.highest(src3, 1)
LowD = ta.lowest(src3, 1)
CloseD = wick ? ta.sma(src3, 2) : src3
src4 = dtype=='Net Positions' ? net_ratio : ratio_strength
OpenR = wick ? ta.sma(src4 , 2) : src4
HighR = ta.highest(src4, 1)
LowR = ta.lowest(src4, 1)
CloseR = wick ? ta.sma(src4, 2) : src4
// Calculating EMAs
Lema = mat=='EMA' ? ta.ema(src, emaLl) : ta.vwma(src, emaLl)
Sema = mat=='EMA' ? ta.ema(src2, emaSl) : ta.vwma(src2, emaSl)
Dema = mat=='EMA' ? ta.ema(src3, emaDl) : ta.vwma(src3, emaDl)
Rema = mat=='EMA' ? ta.ema(src4, emaRl) : ta.vwma(src4, emaRl)
// Conditions
lcondL = showL and (disp=='Line' or disp=='Columns'), ccondL = showL and disp=='Candles'
lcondS = showS and (disp=='Line' or disp=='Columns'), ccondS = showS and disp=='Candles'
lcondD = showD and (disp=='Line' or disp=='Columns'), ccondD = showD and disp=='Candles'
lcondR = showR and (disp=='Line' or disp=='Columns'), ccondR = showR and disp=='Candles'
// Plotting Lines
plot(lcondL ? src : na, title="Net Longs", color=disp=='Line' ? lcolL : (net_longs >0 ? pcolL : ncolL), linewidth=1, style = disp=='Line' ? plot.style_line : disp=='Columns' ? plot.style_columns : na, editable = false)
plot(lcondS ? src2 : na, title="Net Shorts", color=disp=='Line' ? lcolS : (net_shorts >0 ? pcolS : ncolS), linewidth=1, style = disp=='Line' ? plot.style_line : disp=='Columns' ? plot.style_columns : na, editable = false)
plot(lcondD ? src3 : na, title="Net Shorts", color=disp=='Line' ? lcolD : (net_delta >0 ? pcolD : ncolD), linewidth=1, style = disp=='Line' ? plot.style_line : disp=='Columns' ? plot.style_columns : na, editable = false)
plot(lcondR ? src4 : na, title="Net Ratio", color=disp=='Line' ? lcolR : (net_ratio >0 ? pcolR : ncolR), linewidth=1, style = disp=='Line' ? plot.style_line : disp=='Columns' ? plot.style_columns : na, editable = false)
// Plotting Candles
plotcandle(ccondL ? OpenL : na, ccondL ? HighL : na, ccondL ? LowL : na, ccondL ? CloseL : na, "Longs", CloseL>OpenL ? pcolL : ncolL, CloseL>OpenL ? pcolL : ncolL, false, bordercolor = CloseL>OpenL ? pcolL : ncolL)
plotcandle(ccondS ? OpenS : na, ccondS ? HighS : na, ccondS ? LowS : na, ccondS ? CloseS : na, "Shorts", CloseS>OpenS ? pcolS : ncolS, CloseS>OpenS ? pcolS : ncolS, false, bordercolor = CloseS>OpenS ? pcolS : ncolS)
plotcandle(ccondD ? OpenD : na, ccondD ? HighD : na, ccondD ? LowD : na, ccondD ? CloseD : na, "Delta", CloseD>OpenD ? pcolD : ncolD, CloseD>OpenD ? pcolD : ncolD, false, bordercolor = CloseD>OpenD ? pcolD : ncolD)
plotcandle(ccondR ? OpenR : na, ccondR ? HighR : na, ccondR ? LowR : na, ccondR ? CloseR : na, "Ratio", CloseR>OpenR ? pcolR : ncolR, CloseR>OpenR ? pcolR : ncolR, false, bordercolor = CloseR>OpenR ? pcolR : ncolR)
// Plotting EMAs
plot(emaL ? Lema : na, color=emaLc, editable = false)
plot(emaS ? Sema : na, color=emaSc, editable = false)
plot(emaD ? Dema : na, color=emaDc, editable = false)
plot(emaR ? Rema : na, color=emaRc, editable = false)
// Plotting Relative Strength
plot(dtype=='Position RSI' ? 100 : na, color=color.rgb(120, 123, 134, 90), title = 'RSI 100')
plot(dtype=='Position RSI' ? 70 : na, color=color.rgb(120, 123, 134, 72), title = 'RSI 70')
plot(dtype=='Position RSI' ? 50 : na, color=color.rgb(120, 123, 134, 90), title = 'RSI 50')
plot(dtype=='Position RSI' ? 30 : na, color=color.rgb(120, 123, 134, 72), title = 'RSI 30')
plot(dtype=='Position RSI' ? 0 : na, color=color.rgb(120, 123, 134, 90), title = 'RSI 0')
// Volume Heatmap
vol = volume
volmax = ta.highest(volume, 50)
col = color.from_gradient(volume, 0, volmax, chart.bg_color, volc2)
plotshape(time>chart.left_visible_bar_time and volhm, style=shape.square, size=size.normal,location = location.bottom, color=col, editable = false)
// Labels
if vlbl and disp=='Candles'
vLlabel = showL ? label.new(bar_index, CloseL>OpenL ? HighL : LowL, newlongs or rektlongs ? str.tostring(deltaOI, format.volume) : na, size = size.auto, color=color.rgb(255, 255, 255, 100), textcolor = chart.fg_color, style = CloseL>OpenL ? label.style_label_down : label.style_label_up) : na
vSlabel = showS ? label.new(bar_index, CloseS>OpenS ? HighS : LowS, newshorts or rektshorts ? str.tostring(deltaOI, format.volume) : na, size = size.auto, color=color.rgb(255, 255, 255, 100), textcolor = chart.fg_color, style = CloseS>OpenS ? label.style_label_down : label.style_label_up) : na
vDlabel = showD ? label.new(bar_index, CloseD>OpenD ? HighD : LowD, str.tostring(deltaOI, format.volume), size = size.auto, color=color.rgb(255, 255, 255, 100), textcolor = chart.fg_color, style = CloseD>OpenD ? label.style_label_down : label.style_label_up) : na
vRlabel = showR ? label.new(bar_index, CloseR>OpenR ? HighR : LowR, str.tostring(deltaOI, format.volume), size = size.auto, color=color.rgb(255, 255, 255, 100), textcolor = chart.fg_color, style = CloseR>OpenR ? label.style_label_down : label.style_label_up) : na
if nlbl and disp!='Columns'
Llabel = showL ? label.new(bar_index+offs, src, 'NET LONGS', size = size.tiny, color=lcolL, textcolor = color.black, style = label.style_label_left) : na
Slabel = showS ? label.new(bar_index+offs, src2, 'NET SHORTS', size = size.tiny, color=lcolS, textcolor = color.black, style = label.style_label_left) : na
Dlabel = showD ? label.new(bar_index+offs, src3, 'NET DELTA', size = size.tiny, color=lcolD, textcolor = color.black, style = label.style_label_left) : na
Rlabel = showR ? label.new(bar_index+offs, src4, 'NET RATIO', size = size.tiny, color=lcolR, textcolor = color.black, style = label.style_label_left) : na
label.delete(Llabel )
label.delete(Slabel )
label.delete(Dlabel )
label.delete(Rlabel )
// Generating a profile - Code from @KioseffTrading's "Profile Any Indicator" script (used with their permission)
srcp = profsrc=='Net Longs' ? src : profsrc=='Net Shorts' ? src2 : profsrc=='Net Delta' ? src3 : src4
var int timeArray = array.new_int()
var float dist = array.new_float()
var int x2 = array.new_int(rows + 1, 5)
var vh = matrix.new(1, 1)
array.unshift(timeArray, math.round(time))
if prof and time >= chart.left_visible_bar_time and time <= chart.right_visible_bar_time
matrix.add_col(vh)
matrix.set(vh, 0, matrix.columns(vh) - 1, srcp)
if prof and barstate.islast
= switch ori
"Left" =>
=>
calc = (matrix.max(vh) - matrix.min(vh)) / (rows + 1)
for i = 0 to rows
array.push(dist, matrix.min(vh) + (i * calc))
for i = 1 to matrix.columns(vh) - 1
for x = 0 to array.size(dist) - 1
if matrix.get(vh, 0, i) >= matrix.get(vh, 0, i - 1)
if array.get(dist, x) >= matrix.get(vh, 0, i - 1) and array.get(dist, x) <= matrix.get(vh, 0, i)
array.set(x2, x, array.get(x2, x) + profSize)
else
if array.get(dist, x) >= matrix.get(vh, 0, i) and array.get(dist, x) <= matrix.get(vh, 0, i - 1)
array.set(x2, x, array.get(x2, x) + profSize)
boc = array.new_box()
for i = 1 to rows
right = array.get(timeArray, n + array.get(x2, i))
if ori == "Left"
switch math.sign(n - array.get(x2, i))
-1 => right := chart.right_visible_bar_time
=> right := array.get(timeArray, n - array.get(x2, i))
array.push(boc, box.new(pos, array.get(dist, i - 1),
right, array.get(dist, i), xloc = xloc.bar_time, border_color =
nvancol, bgcolor = nvancol
))
if i == rows
array.push(boc, box.new(pos, array.get(dist, array.size(dist) - 1),
right, array.get(dist, array.size(dist) - 1) + calc, xloc = xloc.bar_time, border_color =
nvancol, bgcolor = nvancol
))
array.shift(x2), nx = array.indexof(x2, array.max(x2))
nz = nx - 1, nz2 = 0, nz3 = 0, nz4 = 0
for i = 0 to array.size(x2) - 1
if nz > -1 and nx <= array.size(x2) - 1
switch array.get(x2, nx) >= array.get(x2, nz)
true => nz2 += array.get(x2, nx), nx += 1
=> nz2 += array.get(x2, nz), nz -= 1
else if nz <= -1
nz2 += array.get(x2, nx), nx += 1
else if nx >= array.size(x2)
nz2 += array.get(x2, nz), nz -= 1
if nz2 >= array.sum(x2) * (vapct / 100)
nz3 := nx <= array.size(x2) - 1 ? nx : array.size(x2) - 1, nz4 := nz <= -1 ? 0 : nz
break
for i = nz3 to nz4
box.set_border_color(array.get(boc, i), vancol)
box.set_bgcolor(array.get(boc, i), vancol)
if poc
var pocL = line(na)
y = math.avg(box.get_top(array.get(boc, array.indexof(x2, array.max(x2)))), box.get_bottom(array.get(boc, array.indexof(x2, array.max(x2)))))
if na(pocL)
pocL := line.new(chart.left_visible_bar_time, y, chart.right_visible_bar_time, y, xloc = xloc.bar_time, color = poccol, width = 1)
else
line.set_xy1(pocL, chart.left_visible_bar_time, y)
line.set_xy2(pocL, chart.right_visible_bar_time, y)
if val
var vaup = line(na), var vadn = line(na)
ydn = box.get_bottom(array.get(boc, nz3)), yup = box.get_top(array.get(boc, nz4))
if na(vaup)
vadn := line.new(chart.left_visible_bar_time, ydn, chart.right_visible_bar_time, ydn, xloc = xloc.bar_time, color = vancol, width = 1)
vaup := line.new(chart.left_visible_bar_time, yup, chart.right_visible_bar_time, yup, xloc = xloc.bar_time, color = vancol, width = 1)
else
line.set_xy1(vadn, chart.left_visible_bar_time, ydn), line.set_xy2(vadn, chart.right_visible_bar_time, ydn)
line.set_xy1(vaup, chart.left_visible_bar_time, yup), line.set_xy2(vaup, chart.right_visible_bar_time, yup)
linefill.new(vadn, vaup, vafill)
//Generating tables for Stats
switchpos(tablepos) =>
switch tablepos
'Top Left' => position.top_left
'Top Center' => position.top_center
'Top Right' => position.top_right
'Bottom Left' => position.bottom_left
'Bottom Center' => position.bottom_center
'Bottom right' => position.bottom_right
dataTable = table.new(switchpos(tablepos), columns=15, rows=15, bgcolor=color.rgb(120, 123, 134, 56))
fill_rows(cond, txt, c, r) =>
if cond
table.cell(table_id=dataTable, column = tablevpos=='Horizontal' ? c : 0, row = tablevpos=='Horizontal' ? 0 : r, text = txt, height=0, text_color=color.white, text_halign=text.align_center, text_valign= text.align_center)
if barstate.islast and stats and dtype!='Position RSI'
txt = ' •𝗢𝗜: ' + (denom=='Quote Currency' ? '$' : '') + str.tostring(denom=='Base Currency' ? OI : OI*close, format = format.volume) + ' ' + (denom=='Base Currency' ? str.tostring(string(syminfo.basecurrency)) : '')
txt2 = ' •𝗡𝗟: ' + (denom=='Quote Currency' ? '$' : '') + str.tostring(net_longs, format = format.volume) + ' ' + (denom=='Base Currency' ? str.tostring(string(syminfo.basecurrency)) : '')
txt3 = ' •𝗡𝗦: ' + (denom=='Quote Currency' ? '$' : '') + str.tostring(net_shorts, format = format.volume) + ' ' + (denom=='Base Currency' ? str.tostring(string(syminfo.basecurrency)) : '')
txt4 = ' •𝗡𝗗: ' + (denom=='Quote Currency' ? '$' : '') + str.tostring(net_delta, format = format.volume) + ' ' + (denom=='Base Currency' ? str.tostring(string(syminfo.basecurrency)) : '')
txt5 = ' •𝗢𝗜𝗖: ' + (denom=='Quote Currency' ? '$' : '') + str.tostring(denom=='Base Currency' ? OI-OI : (OI-OI ) * close, format = format.volume) + ' ' + (denom=='Base Currency' ? str.tostring(string(syminfo.basecurrency)) : '')
txt6 = ' •𝗡𝗟𝗖: ' + (denom=='Quote Currency' ? '$' : '') + str.tostring(net_longs - net_longs , format = format.volume) + ' ' + (denom=='Base Currency' ? str.tostring(string(syminfo.basecurrency)) : '')
txt7 = ' •𝗡𝗦𝗖: ' + (denom=='Quote Currency' ? '$' : '') + str.tostring(net_shorts - net_shorts , format = format.volume) + ' ' + (denom=='Base Currency' ? str.tostring(string(syminfo.basecurrency)) : '')
txt8 = ' •𝗡𝗗𝗖: ' + (denom=='Quote Currency' ? '$' : '') + str.tostring(net_delta - net_delta , format = format.volume) + ' ' + (denom=='Base Currency' ? str.tostring(string(syminfo.basecurrency)) : '')
txt9 = ' •𝗢𝗜 𝗥𝗦𝗜: ' + str.tostring(math.round(oi_strength,1))
txt10 = ' •𝗡𝗟 𝗥𝗦𝗜: ' + str.tostring(math.round(longs_strength,1))
txt11 = ' •𝗡𝗦 𝗥𝗦𝗜: ' + str.tostring(math.round(shorts_strength, 1))
txt12 = ' •𝗡𝗗 𝗥𝗦𝗜: ' + str.tostring(math.round(delta_strength, 1))
fill_rows(stat_oi, txt, 0, 0)
fill_rows(stat_nl, txt2, 1, 1)
fill_rows(stat_ns, txt3, 2, 2)
fill_rows(stat_nd, txt4, 3, 3)
fill_rows(stat_oi_c, txt5, 4, 4)
fill_rows(stat_nl_c, txt6, 5, 5)
fill_rows(stat_ns_c, txt7, 6, 6)
fill_rows(stat_nd_c, txt8, 7, 7)
fill_rows(stat_oi_r, txt9, 8, 8)
fill_rows(stat_nl_r, txt10, 9, 9)
fill_rows(stat_ns_r, txt11, 10, 10)
fill_rows(stat_nd_r, txt12, 11, 11)
// Divergence Finder
switchdivsrc(divsrc) =>
switch divsrc
'Net Longs' => src
'Net Shorts' => src2
'Net Delta' => src3
'Net Ratio' => src4
np = switchdivsrc(divsrc)
var priceHigh = array.new_float(0), var priceLow = array.new_float(0)
var priceHighIndex = array.new_int (0), var priceLowIndex = array.new_int (0)
var npHigh = array.new_float(0), var npLow = array.new_float(0)
var npHighIndex = array.new_int (0), var npLowIndex = array.new_int (0)
var priceHighTrend = 0, var priceLowTrend = 0
var npHighTrend = 0, var npLowTrend = 0
bool closeRecentHighs = false, bool closeOldHighs = false
bool closeHighs = false, bool closeRecentLows = false
bool closeOldLows = false, bool closeLows = false
curPriceHigh = ta.pivothigh(close, leftPivot, rightPivot)
curPriceLow = ta.pivotlow (close, leftPivot, rightPivot)
curnpHigh = ta.pivothigh(np, leftPivot, rightPivot)
curnpLow = ta.pivotlow (np, leftPivot, rightPivot)
if not na(curPriceHigh)
array.push(priceHigh, curPriceHigh)
array.push(priceHighIndex, bar_index-rightPivot)
if not na(curPriceLow)
array.push(priceLow, curPriceLow)
array.push(priceLowIndex, bar_index-rightPivot)
if not na(curnpHigh)
array.push(npHigh, curnpHigh)
array.push(npHighIndex, bar_index-rightPivot)
if not na(curnpLow)
array.push(npLow, curnpLow)
array.push(npLowIndex, bar_index-rightPivot)
if showdiv
if array.size(priceHigh) >= 2 and not na(curPriceHigh)
if array.get(priceHigh, array.size(priceHigh)-1) >= array.get(priceHigh, array.size(priceHigh)-2)
priceHighTrend := 1
else
priceHighTrend := -1
if array.size(priceLow) >= 2 and not na(curPriceLow)
if array.get(priceLow, array.size(priceLow)-1) >= array.get(priceLow, array.size(priceLow)-2)
priceLowTrend := 1
else
priceLowTrend := -1
if array.size(npHigh) >= 2 and not na(curnpHigh)
if array.get(npHigh, array.size(npHigh)-1) >= array.get(npHigh, array.size(npHigh)-2)
npHighTrend := 1
else
npHighTrend := -1
if array.size(npLow) >= 2 and not na(curnpLow)
if array.get(npLow, array.size(npLow)-1) >= array.get(npLow, array.size(npLow)-2)
npLowTrend := 1
else
npLowTrend := -1
if array.size(priceHighIndex) >= 2 and array.size(npHighIndex) >=2
closeRecentHighs := math.abs(array.get(priceHighIndex, array.size(priceHighIndex)-1) - array.get(npHighIndex, array.size(npHighIndex)-1)) <= pivotDistance
closeOldHighs := math.abs(array.get(priceHighIndex, array.size(priceHighIndex)-2) - array.get(npHighIndex, array.size(npHighIndex)-2)) <= pivotDistance
closeHighs := closeRecentHighs and closeOldHighs
if array.size(priceLowIndex) >= 2 and array.size(npLowIndex) >=2
closeRecentLows := math.abs(array.get(priceLowIndex, array.size(priceLowIndex)-1) - array.get(npLowIndex, array.size(npLowIndex)-1)) <= pivotDistance
closeOldLows := math.abs(array.get(priceLowIndex, array.size(priceLowIndex)-2) - array.get(npLowIndex, array.size(npLowIndex)-2)) <= pivotDistance
closeLows := closeRecentLows and closeOldLows
bool uptrendExhuastion = closeHighs and priceHighTrend > 0 and npHighTrend < 0 and (not na(curnpHigh) or not na(curPriceHigh))
bool uptrendAbsorption = closeHighs and priceHighTrend < 0 and npHighTrend > 0 and (not na(curnpHigh) or not na(curPriceHigh))
bool downtrendExhuastion = closeLows and priceLowTrend < 0 and npLowTrend > 0 and (not na(curnpLow) or not na(curPriceLow))
bool downtrendAbsorption = closeLows and priceLowTrend > 0 and npLowTrend < 0 and (not na(curnpLow) or not na(curPriceLow))
drawDiv(time1, price1, time2, price2, type) =>
dcol = type == 'Uptrend Exhuastion' ? pHH_npLHcol : type == 'Uptrend Absorption' ? pLH_npHHcol : type == 'Downtrend Exhaustion' ? pLL_npHLcol : type == 'Downtrend Absorption' ? pHL_npLLcol : na
line.new(x1=time1, y1=price1, x2=time2, y2=price2, color=dcol, width=1)
if uptrendAbsorption or uptrendExhuastion and showdiv
highTime1 = array.get(npHighIndex, array.size(npHighIndex)-1)
highPrice1 = array.get(npHigh, array.size(npHigh)-1)
highTime2 = array.get(npHighIndex, array.size(npHighIndex)-2)
highPrice2 = array.get(npHigh, array.size(npHigh)-2)
if uptrendExhuastion and pHH_npLH
drawDiv(highTime1, highPrice1, highTime2, highPrice2, 'Uptrend Exhuastion')
if uptrendAbsorption and pLH_npHH
drawDiv(highTime1, highPrice1, highTime2, highPrice2, 'Uptrend Absorption')
if downtrendAbsorption or downtrendExhuastion and showdiv
lowTime1 = array.get(npLowIndex, array.size(npLowIndex)-1)
lowPrice1 = array.get(npLow, array.size(npLow)-1)
lowTime2 = array.get(npLowIndex, array.size(npLowIndex)-2)
lowPrice2 = array.get(npLow, array.size(npLow)-2)
if downtrendExhuastion and pLL_npHL
drawDiv(lowTime1, lowPrice1, lowTime2, lowPrice2, 'Downtrend Exhuastion')
if downtrendAbsorption and pHL_npLL
drawDiv(lowTime1, lowPrice1, lowTime2, lowPrice2, 'Downtrend Absorption')
TDPOWERSYS vs Market-Cap Weighted Peersfor QIC - UnCut Diamonds team..
to compare one company vs its peers bundled as basket.
editable..
SMA Cross + Adaptive Q MA + AMA Channel
📘 OPERATIONAL MANUAL: Adaptive Trend & SR Breakout SystemThis system combines non-parametric regression, volatility channels, and automated price action structures to identify high-probability entries.
1. Core IndicatorsAdaptive Q (KAMA): The primary trend line.
Green = Bullish;
Red = Bearish.
AMA Channel: An ATR-based envelope ($1.5 \times ATR$) that defines the "Value Area".
SMA 50 Filter: Global trend filter. Trade Long only above; Short only below.
SR Zones: Automatic boxes marking historical Support
(Blue/Green) and Resistance (Red).Shutterstock
2. Entry Rules
🟢 LONG SETUP:Price is above SMA 50.Large Lime Triangle appears (Channel Cross).Adaptive Q line is Green.Best entry: Price bounces off a Support Box.
🔴 SHORT SETUP:Price is below SMA 50.Large Red Triangle appears (Channel Cross).Adaptive Q line is Red.Best entry: Price rejects a Resistance Box.
3. Risk Management
Stop Loss: Set at $1.5 \times ATR$ or behind the nearest SR Box.
Take Profit: Target the next opposite SR Zone or exit if the Adaptive Q changes color.
4. LegendLarge Triangles: High-conviction volatility signals.
Small Triangles: Standard SMA Cross (early warning).
Red/Green Boxes: Supply and Demand zones for structural confirmation.
Aggro-15min Pro V4.2 [SMA200 + Vortex] (v6 Ready)🚀 Aggro-15min Pro
Aggro-15min Pro is a professional-grade algorithmic strategy optimized for the 15-minute timeframe. It combines structural trend analysis with aggressive momentum tracking to capture high-probability swings while filtering out market noise.
🛠️ How the Strategy Works
1. Structural Trend (The "Guardrail")
200 SMA: The strategy identifies the primary market direction. It only buys above the 200 SMA and only sells below it, ensuring you stay on the side of institutional flow.
2. Execution Trigger (The "Signal")
EMA Cross (9/50): A crossover of the 9-period Fast EMA and 50-period Slow EMA triggers the entry, identifying a confirmed shift in medium-term momentum.
3. Momentum Engine (The "Vortex")
Vortex Indicator (VI): Validates the "thrust" behind the move.
Dynamic Exit: Includes a "Vortex Reverse" logic that closes trades early if the directional energy fades, preserving capital before a full reversal occurs.
4. Risk & Volatility
ADX Filter: Prevents entries during low-volatility "sideways" periods.
ATR Risk Management: Uses the Average True Range to set dynamic Stop Loss and Take Profit levels that adapt to current market volatility.
-
-
# 📂 STRATEGY PACKAGE: AGGRO-15MIN PRO
**Version:** 4.2 (Pine Script v6 Ready)
**Asset Class:** Crypto, Forex, Indices
**Timeframe:** 15 Minutes
---
## 📘 1. OPERATIONS MANUAL (English)
### 🟢 Strategy Overview
Aggro-15min Pro is a momentum-based trend-following system. It uses a "Triple-Filter" logic to ensure that trades are only taken when long-term trend, medium-term momentum, and short-term volatility are perfectly aligned.
### 🟢 Technical Indicators Setup
* **Structural Filter:** 200-period Simple Moving Average (SMA).
* **Trigger Engine:** 9-period & 50-period Exponential Moving Averages (EMA).
* **Momentum Engine:** 14-period Vortex Indicator (VI).
* **Strength Filter:** 14-period Average Directional Index (ADX).
* **Volatility/Exits:** 14-period Average True Range (ATR).
### 🟢 Entry Checklist
#### LONG Position:
1. **Trend:** Price is **ABOVE** the 200 SMA.
2. **Trigger:** 9 EMA crosses **ABOVE** the 50 EMA.
3. **Vortex:** VIP (Positive) is **ABOVE** VIM (Negative).
4. **Strength:** ADX is **ABOVE** 20.
#### SHORT Position:
1. **Trend:** Price is **BELOW** the 200 SMA.
2. **Trigger:** 9 EMA crosses **BELOW** the 50 EMA.
3. **Vortex:** VIM (Negative) is **ABOVE** VIP (Positive).
4. **Strength:** ADX is **ABOVE** 20.
### 🟢 Exit Management
* **Take Profit (TP):** $3.0 \times ATR$ (Risk/Reward 1:2).
* **Stop Loss (SL):** $1.5 \times ATR$.
* **Dynamic Exit:** If the Vortex lines cross in the opposite direction (e.g., VIM > VIP during a Long), the strategy closes the position immediately to lock in profits or minimize loss.
---
Price Compression Scanner (Chartink Logic)Breakout above range high → BUY
🔹 Breakdown below range low → SELL
🔹 Best with volume expansion
🔹 Works well for swing trades & momentum breakouts
Highs
Highest High of last 10 days (ending 1 day agos) < Highest High of previous 10 days
Highest High of last 10 days < Highest High of earlier 10 days
➡️ Lower highs (falling resistance)
Lows
3. Lowest Low of last 10 days > Lowest Low of previous 10 days
4. Lowest Low of last 10 days > Lowest Low of earlier 10 days
Closed Source Strategy TesterAllows you to test an indicator that is closed source (you don't have access to the code). You will need to understand the exposed data elements of the indicator you are testing. This strategy is only looking for a buy, sell, exit long, or exit short to be signals that change from 0 to 1. The stop loss/take profit, if used, are expected to be price values.
I encourage you to copy this code and modify it to your needs for specific indicators.
RSI PVSRA PRO Edition# 📑 MASTER OPERATING MANUAL: Full Institutional Ecosystem (v3.0)
**Integrated Suite:** PVSRA Dashboard + SR Boxes + Order Spikes + CVD-100 + RSI PRO
---
## 1. SYSTEM HIERARCHY
This ecosystem provides a 360-degree view of the market, eliminating subjective interpretation:
1. **Bias (Dashboard):** Global market direction (Sentiment).
2. **Context (SR Boxes):** Institutional supply and demand zones (The "Where").
3. **Internal Force (CVD-100):** Aggressive money flow (The "Fuel").
4. **Momentum & Divergence (RSI PRO):** Speedometer and early-warning system for reversals.
---
## 2. COMPONENT DICTIONARY
### **A. RSI PRO (Divergences & Confluence)**
* **Bullish Divergence (Green Label):** Price makes a Lower Low, but RSI makes a Higher Low. Indicates hidden institutional accumulation.
* **Bearish Divergence (Red Label):** Price makes a Higher High, but RSI makes a Lower High. Indicates institutional distribution (unloading).
* **Safety Thresholds:** * *Safe Buy Zone (< 65):* Prevents buying into overextended markets.
* *Safe Sell Zone (> 35):* Prevents selling at absolute bottoms.
### **B. CVD-100 (Aggressive Pressure)**
* **Above 80:** Buyer exhaustion. **Below 20:** Seller exhaustion.
* **Slope:** A Lime color indicates buyers are hitting the Ask; Red indicates sellers are hitting the Bid.
### **C. PVSRA & Spikes (The Trigger)**
* **Climax Candles (Green/Magenta):** Marks the peak of professional activity.
* **Triangles (▲/▼):** Statistical confirmation of a massive order execution.
---
## 3. INTEGRATED TRADING STRATEGIES
### **Strategy A: The "Golden Pocket" Reversal (High Accuracy)**
1. **Zone:** Price enters a **Teal SR Box** (Support).
2. **Momentum:** **RSI PRO** displays a **Bullish Divergence** (Green Label).
3. **Volume:** A **Magenta Climax Candle** (PVSRA) appears.
4. **Flow:** **CVD-100** crosses above the 20 level.
5. **Trigger:** A **Buy Spike (▲)** or a **Diamond (◆)** appears.
* *Target:* Next Red Box or Dashed Recovery Line.
### **Strategy B: Momentum Breakout (Trend Following)**
1. **Bias:** Dashboard shows "STRONG BUY" + Price above SMA 200.
2. **RSI Filter:** RSI is below 65 (not yet in extreme overbought territory).
3. **Action:** Price breaks through a **Red SR Box** (Resistance) with force.
4. **Confirmation:** **CVD-100** is Lime (Buying pressure) + **RSI SMA** points upward.
* *Entry:* Close of the breakout candle.
---
## 4. ULTIMATE CONFLUENCE CHECKLIST (MANDATORY)
| Priority | Indicator | Trade Requirement |
| :--- | :--- | :--- |
| **1. Bias** | Dashboard | Must be "STRONG" in the trade direction |
| **2. Context**| SR Boxes | Price must be near a Box (Teal/Red) |
| **3. Momentum**| RSI PRO | Presence of Divergence OR RSI within thresholds (65/35) |
| **4. Internal** | CVD-100 | Slope must be aligned with the trade direction |
| **5. Trigger** | Spike Det. | Presence of Triangle (▲/▼) or Diamond (◆) |
---
## 5. RECOMMENDED TECHNICAL SETTINGS
| Indicator | Parameter | Suggested Value |
| :--- | :--- | :--- |
| **RSI PRO** | Length | 14 |
| **RSI PRO** | Confluence | 65 (Max Buy) / 35 (Min Sell) |
| **CVD-100** | Normalization| 50 (Stochastic Mode) |
| **PVSRA** | Climax Factor | 2.7 |
---
## 6. PRO TIPS & RISK MANAGEMENT
* ⚠️ **The Divergence Rule:** An RSI divergence occurring inside an **SR Box** is 3x more powerful than a divergence in a vacuum.
* ⚠️ **RSI + CVD Synergy:** If the RSI shows a bullish divergence AND the CVD-100 is rising from the 20 level, you have identified a massive institutional "floor."
* ⚠️ **Smoothing MA:** If the yellow RSI line is flat, the market is ranging. Wait for a clear slope before acting.
---
*Document created for Quantitative Trading Operations*
CVD Normalizzato (0-100)# 📑 MASTER OPERATING MANUAL: Institutional Order Flow Ecosystem (v2.0)
**Integrated Suite:** PVSRA Dashboard PRO + SR High Volume Boxes + Massive Order Spike Detector + CVD-100
---
## 1. SYSTEM HIERARCHY
This trading ecosystem is designed to decode "Smart Money" footprints. It filters retail noise to identify where institutional participants are placing massive orders.
1. **Bias (Dashboard):** Determines the overall market direction (Sentiment).
2. **Context (SR Boxes):** Identifies the price "Battlefields" (Supply & Demand).
3. **Internal Force (CVD-100):** Reveals aggressive buying/selling pressure (Market Delta).
4. **Trigger (PVSRA & Spikes):** Signals the exact moment of execution.
---
## 2. COMPONENT DICTIONARY
### A. CVD-100 (The Internal Engine)
*Reveals the aggressive pressure of buyers/sellers.*
- **Values > 80:** Aggressive buyers are dominant (Extreme Overbought).
- **Values < 20:** Aggressive sellers are dominant (Extreme Oversold).
- **Green Slope:** Aggressive buyers are increasing pressure.
- **Red Slope:** Aggressive sellers are increasing pressure.
### B. PVSRA Candles (Market Climax)
- 🟢 **Bright Green:** Bull Climax (Highest institutional activity).
- 🟣 **Magenta:** Bear Climax (Panic selling or Institutional offloading).
- 🔵 **Blue/Red:** Rising volume (Professional participation).
### C. SR Boxes & Spikes (The Execution Zones)
- **Teal/Red Boxes:** Areas where significant volume was stored.
- **Triangles (▲/▼):** "Massive Order Spike". Confirms statistical anomaly.
- **Diamonds (◆):** Confirms a level (Box) is successfully holding the price.
---
## 3. INTEGRATED STRATEGIES
### **Strategy A: Institutional Trend Follower**
- **Bias:** Dashboard shows "STRONG BUY" + Price is above SMA 200.
- **Setup:** Price breaks above a **Red Box** (Resistance).
- **Confirmation:** **CVD-100** is sloping up (Green) and a **Massive Buy Spike** (▲) appears.
- **Entry:** On the close of the breakout candle.
### **Strategy B: The Climax Reversal (The Sniper)**
- **Bias:** Price reaches a **Teal Box** (Support) after an extended drop.
- **Setup:** **CVD-100** is below 20 (Deep Oversold/Exhaustion).
- **Trigger:** A **Magenta Climax Candle** (PVSRA) appears, followed immediately by a **Green Diamond (◆)**.
- **Entry:** Long when price breaks the high of the Climax candle.
---
## 4. THE ULTIMATE CONFLUENCE CHECKLIST
| Priority | Confirmation | Indicator Tool |
| :--- | :--- | :--- |
| **1. Bias** | Is the Dashboard "STRONG" in the trade direction? | PVSRA Dashboard |
| **2. Level** | Is the price at/inside a Teal or Red Box? | SR Boxes |
| **3. Volume** | Is the candle Climax or Rising color? | PVSRA Candles |
| **4. Delta** | Is CVD-100 aligned with your direction? | CVD-100 |
| **5. Trigger**| Has a Triangle (Spike) or Diamond (Hold) appeared? | Spike Detector |
---
## 5. TECHNICAL CONFIGURATION
| Setting | Value | Goal |
| :--- | :--- | :--- |
| **PVSRA Climax Factor** | 2.7 | Filter for institutional impact only. |
| **Spike Multiplier** | 4.0 | Isolate statistical extreme volume. |
| **CVD Normalization** | 50 (Stoch) | Standardize delta for clear overbought/sold. |
| **SMA Bias** | 200 | Institutional trend filter. |
---
## 6. PRO TIPS & RISK NOTES
- ⚠️ **Divergence:** If Price makes a new high but **CVD-100** makes a lower high, the trend is exhausted. Prepare for a reversal.
- ⚠️ **News Filter:** High-impact news causes "Spikes" but invalidates "Boxes". Wait 15 mins for the market to stabilize.
- ⚠️ **Absorption:** A Climax candle with a tiny body inside a Box is "Absorption". Institutions are soaking up orders. Wait for the box breakout.
---
*Created for: Professional Trading Operations*






















