Liquidity Matrix: Price Power ZonesLiquidity Mapping for Real Context — How I Use the Liquidity Matrix
When analyzing price, I don’t rely on indicators to generate signals — I use tools that help me read the tape more clearly.
Liquidity Matrix is one of those tools I’ve developed to do just that.
It’s not a signal generator. It’s a contextual layer that helps identify where liquidity has been absorbed or rejected — zones where large orders have interacted with price, often leading to key reactions.
________________________________________
What It Shows
1. High Volume + Rejection Wicks
It highlights candles where volume significantly exceeds the average, and price exhibits a large upper or lower wick — these are typically signs of absorption, stop runs, or institutional defense.
2. L+ / L- Labels
• L+ = possible supply zone or stop run from above
• L- = potential demand zone or liquidity sweep from below
These aren’t static levels — they decay over time. The script accounts for this by fading the zone’s visual impact gradually.
3. Volume Curve (Bottom Fill)
A normalized volume curve (based on timeframe) gives a quick glance at volume pressure building up or fading out — especially helpful in low-volume consolidations.
________________________________________
How I Use It in Practice
On the higher timeframes, it helps me identify where larger players have likely interacted with price. I’ll mark those zones manually and look for reactions when price revisits them.
On the intra-day charts, I use it to time entries around sweep zones. When price taps a recent L- and shows absorption on the order book or tape, that’s often a clean entry with tight invalidation.
I also use it to filter out trades — if a breakout is happening directly into an L+ zone with low volume follow-through, I stand aside.
This tool doesn’t replace market structure or execution models — it simply adds another layer of visibility that aligns with how real liquidity moves through the market.
________________________________________
Script: Liquidity Matrix
By: Maaz
Framework: Volume, Wicks, and Time-Decaying Zones
Let me know if you have questions or want to integrate it into your playbook.
Statistics
Prop Firm Business SimulatorThe prop firm business simulator is exactly what it sounds like. It's a plug and play tool to test out any tradingview strategy and simulate hypothetical performance on CFD Prop Firms.
Now what is a modern day CFD Prop Firm?
These companies sell simulated trading challenges for a challenge fee. If you complete the challenge you get access to simulated capital and you get a portion of the profits you make on those accounts payed out.
I've included some popular firms in the code as presets so it's easy to simulate them. Take into account that this info will likely be out of date soon as these prices and challenge conditions change.
Also, this tool will never be able to 100% simulate prop firm conditions and all their rules. All I aim to do with this tool is provide estimations.
Now why is this tool helpful?
Most traders on here want to turn their passion into their full-time career, prop firms have lately been the buzz in the trading community and market themselves as a faster way to reach that goal.
While this all sounds great on paper, it is sometimes hard to estimate how much money you will have to burn on challenge fees and set realistic monthly payout expectations for yourself and your trading. This is where this tool comes in.
I've specifically developed this for traders that want to treat prop firms as a business. And as a business you want to know your monthly costs and income depending on the trading strategy and prop firm challenge you are using.
How to use this tool
It's quite simple you remove the top part of the script and replace it with your own strategy. Make sure it's written in same version of pinescript before you do that.
//--$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$--//--------------------------------------------------------------------------------------------------------------------------$$$$$$
//--$$$$$--Strategy-- --$$$$$$--// ******************************************************************************************************************************
//--$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$--//--------------------------------------------------------------------------------------------------------------------------$$$$$$
length = input.int(20, minval=1, group="Keltner Channel Breakout")
mult = input(2.0, "Multiplier", group="Keltner Channel Breakout")
src = input(close, title="Source", group="Keltner Channel Breakout")
exp = input(true, "Use Exponential MA", display = display.data_window, group="Keltner Channel Breakout")
BandsStyle = input.string("Average True Range", options = , title="Bands Style", display = display.data_window, group="Keltner Channel Breakout")
atrlength = input(10, "ATR Length", display = display.data_window, group="Keltner Channel Breakout")
esma(source, length)=>
s = ta.sma(source, length)
e = ta.ema(source, length)
exp ? e : s
ma = esma(src, length)
rangema = BandsStyle == "True Range" ? ta.tr(true) : BandsStyle == "Average True Range" ? ta.atr(atrlength) : ta.rma(high - low, length)
upper = ma + rangema * mult
lower = ma - rangema * mult
//--Graphical Display--// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-$$$$$$
u = plot(upper, color=#2962FF, title="Upper", force_overlay=true)
plot(ma, color=#2962FF, title="Basis", force_overlay=true)
l = plot(lower, color=#2962FF, title="Lower", force_overlay=true)
fill(u, l, color=color.rgb(33, 150, 243, 95), title="Background")
//--Risk Management--// *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-$$$$$$
riskPerTradePerc = input.float(1, title="Risk per trade (%)", group="Keltner Channel Breakout")
le = high>upper ? false : true
se = lowlower
strategy.entry('PivRevLE', strategy.long, comment = 'PivRevLE', stop = upper, qty=riskToLots)
if se and upper>lower
strategy.entry('PivRevSE', strategy.short, comment = 'PivRevSE', stop = lower, qty=riskToLots)
The tool will then use the strategy equity of your own strategy and use this to simulat prop firms. Since these CFD prop firms work with different phases and payouts the indicator will simulate the gains until target or max drawdown / daily drawdown limit gets reached. If it reaches target it will go to the next phase and keep on doing that until it fails a challenge.
If in one of the phases there is a reward for completing, like a payout, refund, extra it will add this to the gains.
If you fail the challenge by reaching max drawdown or daily drawdown limit it will substract the challenge fee from the gains.
These gains are then visualised in the calendar so you can get an idea of yearly / monthly gains of the backtest. Remember, it is just a backtest so no guarantees of future income.
The bottom pane (non-overlay) is visualising the performance of the backtest during the phases. This way u can check if it is realistic. For instance if it only takes 1 bar on chart to reach target you are probably risking more than the firm wants you to risk. Also, it becomes much less clear if daily drawdown got hit in those high risk strategies, the results will be less accurate.
The daily drawdown limit get's reset every time there is a new dayofweek on chart.
If you set your prop firm preset setting to "'custom" the settings below that are applied as your prop firm settings. Otherwise it will use one of the template by default it's FTMO 100K.
The strategy I'm using as an example in this script is a simple Keltner Channel breakout strategy. I'm using a 0.05% commission per trade as that is what I found most common on crypto exchanges and it's close to the commissions+spread you get on a cfd prop firm. I'm targeting a 1% risk per trade in the backtest to try and stay within prop firm boundaries of max 1% risk per trade.
Lastly, the original yearly and monthly performance table was developed by Quantnomad and I've build ontop of that code. Here's a link to the original publication:
That's everything for now, hope this indicator helps people visualise the potential of prop firms better or to understand that they are not a good fit for their current financial situation.
订单流轨迹自动交易脚本《订单流交易》一书系统性地介绍了订单流(Order Flow)这一市场分析方法,强调通过分析市场中每一价位的主动买卖单量,捕捉供需力量的变化,从而预判价格趋势的延续或反转。以下是核心内容提炼:
1. 订单流的核心概念
订单流定义:通过实时追踪每个价位的主动买单和卖单成交量,揭示市场供需力量的动态平衡。与传统K线图(仅显示开盘、收盘、最高、最低价)不同,订单流深入价格内部,展示买卖双方的博弈细节。
关键指标:
Delta:单根K线内主动买单总量减去主动卖单总量的差值,反映多空力量强弱。
POC(成交量最大价位):K线内部成交量最大的价格点,揭示多空争夺的核心区域。
失衡现象:当某一价位的主动买单量显著高于卖单(需求失衡)或反之(供应失衡),阈值通常设为3:1。
堆积失衡:连续多个价位出现供需失衡,形成支撑/阻力带。
2. 订单流的优势
实时性:直接反映市场当下行为,而非滞后指标(如MACD、RSI)。
识别主力动向:通过大单、微单、被套交易者等信号,捕捉机构或主力资金的痕迹。
大单:顶部/底部成交量显著高于相邻价位,表明主力介入。
微单:顶部/底部成交量骤减,显示趋势末端力量衰竭。
被套交易者:趋势末端大量反向成交,导致价格反转(如顶部放量却无法突破)。
3. 订单流的分析方法
价格与成交量结合:
健康上涨:伴随主动买单递增,Delta为正且放大。
弱势反转:顶部出现需求失衡但价格回落,或底部供应失衡却未创新低。
关键价位的应用:
支撑/阻力:通过前日高低点、VWAP(成交量加权平均价)、月线级别高低点等判断。
突破与回踩:价格突破关键位后回踩确认,结合订单流验证有效性。
4. 交易策略与实战应用
高胜率信号:
顶部/底部微单:趋势末端成交量萎缩,预示反转(如顶部主动买单骤减)。
失衡堆积:连续失衡形成支撑/阻力带,回踩时入场。
吸收与主动出击:价格在区间内震荡(吸收)后突破,伴随成交量放大。
资金管理与心理:
止损设置:基于失衡区间或关键价位,控制单笔亏损(如1-2跳)。
空仓纪律:无明确信号时保持观望,避免过度交易。
5. 与传统技术的对比
K线图的局限:无法展示价格内部成交细节,仅依赖形态(如十字星、吞噬)易被误导。
订单流的独特性:通过微观成交数据,识别市场情绪(如恐慌性抛售或贪婪追涨),避免“看图说话”的滞后性。
6. 适用场景与市场
高流动性市场:期货、股指、外汇等,需足够成交量支撑订单流分析。
日内与波段交易:短周期(如15分钟)捕捉供需突变,长周期验证趋势强度。
总结
订单流的核心在于通过实时成交数据,理解市场参与者的行为逻辑,从而在趋势启动初期或反转前捕捉机会。它并非预测工具,而是通过供需力量对比,为交易决策提供客观依据。结合严格的资金管理和心理纪律,订单流能显著提升交易的胜率与盈亏比。
**"Order Flow Trading"** systematically introduces the market analysis method of **Order Flow**, emphasizing the capture of supply-demand dynamics by analyzing active buy/sell volumes at each price level to anticipate trend continuations or reversals. Below is a distilled summary of the core concepts:
---
### **1. Core Concepts of Order Flow**
- **Definition**:
Order Flow tracks real-time active buy/sell volumes at each price level, revealing the dynamic balance between supply and demand. Unlike traditional candlestick charts (which only show open, close, high, and low prices), Order Flow dives into price internals, exposing the battle between buyers and sellers.
- **Key Metrics**:
- **Delta**: The difference between total active buy volume and sell volume within a single candlestick, reflecting bullish/bearish strength.
- **POC (Point of Control)**: The price level with the highest volume in a candlestick, indicating the focal point of buyer-seller conflict.
- **Imbalance**: Occurs when buy volume significantly exceeds sell volume (**demand imbalance**, threshold ~3:1) or vice versa (**supply imbalance**).
- **Cumulative Imbalance**: Consecutive price levels with imbalances, forming support/resistance zones.
---
### **2. Advantages of Order Flow**
- **Real-Time Insight**: Reflects immediate market behavior, unlike lagging indicators (e.g., MACD, RSI).
- **Identifying Institutional Activity**: Detects "smart money" footprints through signals like:
- **Large Orders**: Unusually high volume at tops/bottoms, signaling institutional participation.
- **Micro Orders**: Abrupt volume drops at trend extremes, indicating exhaustion.
- **Trapped Traders**: Reversals triggered by countertrend volume surges (e.g., failed breakouts with high sell volume).
---
### **3. Analytical Techniques**
- **Price-Volume Integration**:
- **Healthy Rally**: Rising buy volume with expanding positive Delta.
- **Weak Reversal**: Demand imbalance at tops with price rejection, or supply imbalance at bottoms without new lows.
- **Key Price Levels**:
- **Support/Resistance**: Identified via prior highs/lows, VWAP (Volume-Weighted Average Price), or monthly levels.
- **Breakout & Retest**: Validate breakouts using Order Flow after price retests key levels.
---
### **4. Trading Strategies & Execution**
- **High-Probability Signals**:
- **Micro Orders at Extremes**: Volume drying up at tops/bottoms signals reversals.
- **Cumulative Imbalance Zones**: Enter on pullbacks to stacked imbalance areas.
- **Absorption & Breakouts**: Post-consolidation breakouts with volume expansion.
- **Risk & Psychology**:
- **Stop Loss**: Set 1-2 ticks outside imbalance zones or key levels.
- **Flat Discipline**: Avoid overtrading; act only on clear signals.
---
### **5. Order Flow vs. Traditional Analysis**
- **Candlestick Limitations**: Reliance on patterns (e.g., doji, engulfing) often leads to false signals due to missing internal price data.
- **Order Flow Edge**: Leverages granular trade data to detect market sentiment (e.g., panic selling or FOMO buying), avoiding lagging "chart storytelling."
---
### **6. Applicable Markets & Timeframes**
- **High-Liquidity Markets**: Futures, indices, forex (sufficient volume for Order Flow analysis).
- **Timeframes**:
- **Intraday/Swing**: Short-term (e.g., 15min) for sudden supply-demand shifts.
- **Long-Term**: Validate trend strength on higher timeframes (e.g., daily).
---
### **Summary**
Order Flow focuses on interpreting real-time transactional data to decode market participant behavior, capturing opportunities at trend inception or reversal points. It is not a predictive tool but a framework for objective decision-making through supply-demand analysis. Combined with strict risk management and psychological discipline, Order Flow enhances trade accuracy and profit potential.
Average pips in a time range ( pbalbisFX )This indicator show how much pips the price moved in a especific period of time.
MG Universal model🚀 Summary🚀
The MG univerasal model is a composite of various items such as RSI, price Z-Score, Sharpe Ratio, Sortino Ratio, Omega Ratio, etc
Each component is normalized and then equally wheighted out to perform a global metric.
At the end, an Exponential Moving Average is added on the global metric.
You can easily find a description of each component on the internet, for the Crosby Ratio, it's a metric that comes from bitcoinmagazinepro.com.
✨ Key Features ✨
🗡 Smoothed Global Metric
Using a Moving average to smooth out the whole aggregated metric.
🗡 Bands Zone at extreme levels
Automatically displaying bands at top and bottom levels of the oscillator.
🗡 Normalizing components
Each component is normalized.
🗡 DataTable
Optional DataTable is available to check the score for each components and their related Z-Score.
📊 How I use it 📊
When catching up with 0 line (midline), crossing it :
if it goes above 0.2:
get out when it crosses 0.2 again
else:
get out when it crosses 0 again
That's the way I use it, may be there is a better way, FAFO :)
❓ Seeing a bug or an issue ❓
Feel free to DM me if you see a component that seems badly calculated.
I will be happy to fix it.
❗❗ Disclaimer ❗❗
This is a single indicator, even though it's aggregating many, do not use it as a standalone.
Past performance is not indicative of future results.
Always backtest, check, and align parameters before live trading.
volatilityThis indicator indicates whether volatility is sufficient for trading. It works on time frames from 1 minute to 2 hours. The redder the indicator, the less volatility there is, and the greener the indicator, the more volatility there is.
CVD (Cumulative Volume Delta)
Cumulative Volume Delta
Use a moving average with three different
I thought about determining the volatility and direction of the price of the stock price and finding a place to break through.
I made some Mistake coz I'm new corder
I'm reposting this simple script due to house rule violation. (Whatever can haha) 😁
I'm erasing all the comments in my native language that I had in my script... I thought it would make the User uncomfortable, so I locked the code, and I thought maybe that's the problem
Anyway, I'm sorry 😅
Intraday Long Stoploss DistanceWhile working on intraday 1-minute charts i found it distracting to calculate the stoploss distance from the current price so i created an overlay indicator that plots the values of the last 15 minute and 30 minutes low for safe SL placement so you can get a rough idea of Risk management and lot size to use.
Still in early phases. Few more updates coming soon .stay updated.
*Not a financial advice.
CandlestickUtilitiesThis library provides essential functions for candlestick chart analysis and pattern recognition in Pine Script®.
It includes:
• Candle structure analysis (bodies, shadows, lengths)
• Trend detection using EMAs
• Common candlestick pattern recognition
This library is under construction.
Designed to support strategy development and improve signal accuracy for traders.
Created by @xprophetx — under MPL-2.0 license.
[Kpt-Ahab] PnL-calculatorThe PnL-Cal shows how much you’re up or down in your own currency, based on the current exchange rate.
Let’s say your home currency is EUR.
On October 10, 2022, you bought 10 Tesla stocks at $219 apiece.
Back then, with an exchange rate of 0.9701, you spent €2,257.40.
If you sold the 10 Tesla shares on April 17, 2025 for $241.37 each, that’s around a 10% gain in USD.
But if you converted the USD back to EUR on the same day at an exchange rate of 1.1398, you’d actually end up with an overall loss of about 6.2%.
Right now, only a single entry point is supported.
If you bought shares on different days with different exchange rates, you’ll unfortunately have to enter an average for now.
For viewing on a phone, the table can be simplified.
Institutional MACD (Z-Score Edition) [VolumeVigilante]📈 Institutional MACD (Z-Score Edition) — Professional-Grade Momentum Signal
This is not your average MACD .
The Institutional MACD (Z-Score Edition) is a statistically enhanced momentum tool, purpose-built for serious traders and breakout hunters . By applying Z-Score normalization to the classic MACD structure, this indicator uncovers statistically significant momentum shifts , enabling cleaner reads on price extremes, trend continuation, and potential reversals.
💡 Why It Matters
The classic MACD is powerful — but raw momentum values can be noisy and relative , especially on volatile assets like BTC/USD . By transforming the MACD line, signal line, and histogram into Z-scores , we anchor these signals in statistical context . This makes the Institutional MACD:
✔️ Timeframe-agnostic and asset-normalized
✔️ Ideal for spotting true breakouts , not false flags
✔️ A reliable tool for detecting momentum divergence and exhaustion
🧪 Key Features
✅ Full Z-Score normalization (MACD, Signal, Histogram)
✅ Highlighted ±Z threshold bands for overbought/oversold zones
✅ Customizable histogram coloring for visual momentum shifts
✅ Built-in alerts for zero-crosses and Z-threshold breaks
✅ Clean overlay with optional display toggles
🔁 Strategy Tip: Mean Reversion Signals with Statistical Confidence
This indicator isn't just for spotting breakouts — it also shines as a mean reversion tool , thanks to its Z-Score normalization .
When the Z-Score histogram crosses beyond ±2, it marks a statistically significant deviation from the mean — often signaling that momentum is overstretched and the asset may be due for a pullback or reversal .
📌 How to use it:
Z > +2 → Price action is in overbought territory. Watch for exhaustion or short setups.
Z < -2 → Momentum is deeply oversold. Look for reversal confirmation or long opportunities.
These zones often precede snap-back moves , especially in range-bound or corrective markets .
🎯 Combine Z-Score extremes with:
Candlestick confirmation
Support/resistance zones
Volume or price divergence
Other mean reversion tools (e.g., RSI, Bollinger Bands)
Unlike the raw MACD, this version delivers statistical thresholds , not guesswork — helping traders make decisions rooted in probability, not emotion.
📢 Trade Smart. Trade Vigilantly.
Published by VolumeVigilante
Vietnamese Stocks: Multi-Ticker Fibonacci AlertThis Pine Script™ indicator is designed specifically for traders monitoring the Vietnamese stock market (HOSE, HNX). Its primary goal is to automate the tracking of Fibonacci retracement levels across a large list of stocks, alerting you when prices breach key support zones.
Core Functionality:
The script calculates Fibonacci retracement levels (23.6%, 38.2%, 50%, 61.8%, 78.6%) for up to 40 tickers simultaneously. The calculation is based on the highest high and lowest low identified since a user-defined Start Time. This allows you to anchor the Fibonacci analysis to a specific market event, trend start, or time period relevant to your strategy.
What it Does For You:
Automated Watchlist Scanning: Instead of drawing Fib levels on dozens of charts, select one of the two pre-configured watchlists (up to 40 symbols each, customizable in settings) populated with popular Vietnamese stocks.
Time-Based Fibonacci: Define a Start Time in the settings. The script uses this date to find the subsequent highest high and lowest low for each symbol in your chosen watchlist, forming the basis for the Fib calculation.
Intelligent Alerts: Get notified via TradingView's alerts when the candle closing price of any stock in your active watchlist falls below the critical 38.2%, 50%, 61.8%, or 78.6% levels relative to its own high/low range since the start time. Alerts are consolidated for efficiency.
Visual Aids:
- Plots the same time-based Fibonacci levels directly on your current chart symbol for quick reference.
- Includes an optional on-chart table showing which monitored stocks are currently below key Fib levels (enable "Show Debug Info").
- Features experimental background coloring to highlight potential bullish signals on the current chart.
Configuration:
Start Time: Crucial input – sets the anchor point for Fib calculations.
WatchList Selection: Choose between WatchList #1 (Bluechip/Midcap focus) or WatchList #2 (Defensive/Other focus) using the boolean toggles.
Symbol Customization: Easily replace the default symbols with your preferred Vietnamese stocks directly in the indicator settings.
Notification Prefix: Add custom text to the beginning of your alert messages.
Alert Setup: Remember to create an alert in TradingView, selecting this indicator and the alert() condition, usually with "Once Per Bar Close" frequency.
This tool is open-source under the MPL 2.0 license. Feel free to use, modify, and learn from it.
tafirstlibGeneral Purpose: Starts by stating it's a collection of utility functions for technical analysis.
Core Functionality Areas: Mentions key categories like:
Extrema detection (isMin, isMax, etc.)
Condition checking over time (isMachedInRange, isContinuous, etc.)
Rate of change analysis (isSlowDown)
Moving average calculation (getMA)
Advanced Features: Highlights the more complex functions:
Visualization helpers (getColorNew)
Moving Regression (mr) for smoothing/trend
Cycle analysis (bpDom)
Overall Goal: Concludes by stating the library's aim – simplifying development and enabling complex analysis.
Library "tafirstlib"
TODO: add library description here
isSlowDown(data)
isSlowDown
Parameters:
data (float) : array of numbers
Returns: boolean
isMin(data, maeLength)
isMin
Parameters:
data (float) : array of numbers
maeLength (int) : number
Returns: boolean
isMax(data, maeLength)
isMax
Parameters:
data (float) : array of numbers
maeLength (int) : number
Returns: boolean
isMinStopped(data, maeLength)
isMinStopped
Parameters:
data (float) : array of numbers
maeLength (int) : number
Returns: boolean
isMaxStopped(data, maeLength)
isMaxStopped
Parameters:
data (float) : array of numbers
maeLength (int) : number
Returns: boolean
isLongMinStopped(data, maeLength, distance)
isLongMinStopped
Parameters:
data (float) : array of numbers
maeLength (int) : number
distance (int) : number
Returns: boolean
isLongMaxStopped(data, maeLength, distance)
isLongMaxStopped
Parameters:
data (float) : array of numbers
maeLength (int) : number
distance (int) : number
Returns: boolean
isMachedInRangeSkipCurrent(data, findRange, findValue)
isMachedInRangeSkipCurrent
Parameters:
data (bool) : array of numbers
findRange (int) : number
findValue (bool) : number
Returns: boolean
isMachedInRange(data, findRange, findValue)
isMachedInRange
Parameters:
data (bool) : array of numbers
findRange (int) : number
findValue (bool) : number
Returns: boolean
isMachedColorInRange(data, findRange, findValue)
isMachedColorInRange isMachedColorInRange(series color data, int findRange, color findValue)
Parameters:
data (color) : series of color
findRange (int) : int
findValue (color) : color
Returns: boolean
countMachedInRange(data, findRange, findValue)
countMachedInRange
Parameters:
data (bool) : array of numbers
findRange (int) : number
findValue (bool) : number
Returns: number
getColor(data)
getColor
Parameters:
data (float) : array of numbers
Returns: color
getColorNew(data)
getColorNew
Parameters:
data (float) : array of numbers
Returns: color
isColorBetter(color_data)
isColorBetter
Parameters:
color_data (color) : array of colors
Returns: boolean
isColorWorst(color_data)
isColorWorst
Parameters:
color_data (color) : array of colors
Returns: boolean
isColorBetter2(color_data)
isColorBetter2
Parameters:
color_data (color) : array of colors
Returns: boolean
isColorWorst2(color_data)
isColorWorst2
Parameters:
color_data (color) : array of colors
Returns: boolean
isDecreased2Bar(data)
isDecreased2Bar
Parameters:
data (float) : array of numbers
Returns: boolean
isContinuousAdvance(targetSeries, range2Find, howManyException)
isContinuousAdvance
Parameters:
targetSeries (bool) : array of booleans
range2Find (int) : number
howManyException (int) : number
Returns: boolean
isContinuous(targetSeries, range2Find, truefalse)
isContinuous
Parameters:
targetSeries (bool) : array of booleans
range2Find (int) : number
truefalse (bool) : boolean
Returns: boolean
isContinuousNotNow(targetSeries, range2Find, truefalse)
isContinuousNotNow
Parameters:
targetSeries (bool) : array of booleans
range2Find (int) : number
truefalse (bool) : boolean
Returns: boolean
isContinuousTwoFactors(targetSeries, range2Find, truefalse)
isContinuousTwoFactors
Parameters:
targetSeries (bool) : array of booleans
range2Find (int) : number
truefalse (bool) : boolean
Returns: boolean
findEventInRange(startDataBarIndex, neededDataBarIndex, currentBarIndex)
findEventInRange
Parameters:
startDataBarIndex (int) : number
neededDataBarIndex (int) : number
currentBarIndex (int) : number
Returns: boolean
findMin(firstdata, secondata, thirddata, forthdata)
findMin
Parameters:
firstdata (float) : number
secondata (float) : number
thirddata (float) : number
forthdata (float) : number
Returns: number
findMax(firstdata, secondata, thirddata, forthdata)
findMax
Parameters:
firstdata (float) : number
secondata (float) : number
thirddata (float) : number
forthdata (float) : number
Returns: number
getMA(src, length, mav)
getMA
Parameters:
src (float) : number
length (simple int) : number
mav (string) : string
Returns: number
mr(mrb_src, mrb_window, mrb_degree)
Parameters:
mrb_src (float)
mrb_window (int)
mrb_degree (int)
bpDom(maeLength, bpw, mult)
Parameters:
maeLength (int)
bpw (float)
mult (float)
Global M2 sandboxThis indicator aggregates global sources of liquidity to use as a proxy for the global money supply and allows an offsetting number of days to be implemented to use as a leading indicator.
// EUROZONE Data
EUM2D = request.security("ECONOMICS:EUM2*FX:EURUSD", "D", close, lookahead=barmerge.lookahead_on)
// North America Data
USM2D = request.security("ECONOMICS:USM2", "D", close, lookahead=barmerge.lookahead_on)
CAM2D = request.security("ECONOMICS:CAM2*FX_IDC:CADUSD", "D", close, lookahead=barmerge.lookahead_on)
// Non-EU Europe Data
CHM2D = request.security("ECONOMICS:CHM2*FX_IDC:CHFUSD", "D", close, lookahead=barmerge.lookahead_on)
GBM2D = request.security("ECONOMICS:GBM2*FX:GBPUSD", "D", close, lookahead=barmerge.lookahead_on)
FIPOP = request.security("ECONOMICS:FIM2/FX_IDC:USDFIM", "D", close, lookahead=barmerge.lookahead_on)
RUM2D = request.security("ECONOMICS:RUM2*FX_IDC:RUBUSD", "D", close, lookahead=barmerge.lookahead_on)
// Pacific Data
NZM2D = request.security("ECONOMICS:NZM2*FX_IDC:NZDUSD", "D", close, lookahead=barmerge.lookahead_on)
// Asia Data
CNM2D = request.security("ECONOMICS:CNM2*FX_IDC:CNYUSD", "D", close, lookahead=barmerge.lookahead_on)
TWM2D = request.security("ECONOMICS:TWM2*FX_IDC:TWDUSD", "D", close, lookahead=barmerge.lookahead_on)
HKM2D = request.security("ECONOMICS:HKM2*FX_IDC:HKDUSD", "D", close, lookahead=barmerge.lookahead_on)
INM2D = request.security("ECONOMICS:INM2*FX_IDC:INRUSD", "D", close, lookahead=barmerge.lookahead_on)
JPM2D = request.security("ECONOMICS:JPM2*FX_IDC:JPYUSD", "D", close, lookahead=barmerge.lookahead_on)
PHM2D = request.security("ECONOMICS:PHM2*FX_IDC:PHPUSD", "D", close, lookahead=barmerge.lookahead_on)
SGM2D = request.security("ECONOMICS:SGM2*FX_IDC:SGDUSD", "D", close, lookahead=barmerge.lookahead_on)
// Latin America Data
BRM2D = request.security("ECONOMICS:BRM2*FX_IDC:BRLUSD", "D", close, lookahead=barmerge.lookahead_on)
COM2D = request.security("ECONOMICS:COM2*FX_IDC:COPUSD", "D", close, lookahead=barmerge.lookahead_on)
MXM2D = request.security("ECONOMICS:MXM2*FX_IDC:MXNUSD", "D", close, lookahead=barmerge.lookahead_on)
// Middle East Data
AEM2D = request.security("ECONOMICS:AEM2*FX_IDC:AEDUSD", "D", close, lookahead=barmerge.lookahead_on)
TRM2D = request.security("ECONOMICS:TRM2*FX_IDC:TRYUSD", "D", close, lookahead=barmerge.lookahead_on)
// Africa Data
ZAM2D = request.security("ECONOMICS:ZAM2*FX_IDC:ZARUSD", "D", close, lookahead=barmerge.lookahead_on)
// Calculate Global Money Supply M2
total = (EUM2D + USM2D + CAM2D + CHM2D + GBM2D + FIPOP + RUM2D + NZM2D + CNM2D + TWM2D + HKM2D + INM2D + JPM2D + PHM2D + SGM2D + BRM2D + COM2D + MXM2D + AEM2D + TRM2D + ZAM2D) / 1000000000000
FunctionSurvivalEstimationLibrary "FunctionSurvivalEstimation"
The Survival Estimation function, also known as Kaplan-Meier estimation or product-limit method, is a statistical technique used to estimate the survival probability of an individual over time. It's commonly used in medical research and epidemiology to analyze the survival rates of patients with different treatments, diseases, or risk factors.
What does it do?
The Survival Estimation function takes into account censored observations (i.e., individuals who are still alive at a certain point) and calculates the probability that an individual will survive beyond a specific time period. It's particularly useful when dealing with right-censoring, where some subjects are lost to follow-up or have not experienced the event of interest by the end of the study.
Interpretation
The Survival Estimation function provides a plot of the estimated survival probability over time, which can be used to:
1. Compare survival rates between different groups (e.g., treatment arms)
2. Identify patterns in the data that may indicate differences in mortality or disease progression
3. Make predictions about future outcomes based on historical data
4. In a trading context it may be used to ascertain the survival ratios of trading under specific conditions.
Reference:
www.global-developments.org
"Beyond GDP" ~ www.aeaweb.org
en.wikipedia.org
www.kdnuggets.com
survival_probability(alive_at_age, initial_alive)
Kaplan-Meier Survival Estimator.
Parameters:
alive_at_age (int) : The number of subjects still alive at a age.
initial_alive (int) : The Total number of initial subjects.
Returns: The probability that a subject lives longer than a certain age.
utility(c, l)
Captures the utility value from consumption and leisure.
Parameters:
c (float) : Consumption.
l (float) : Leisure.
Returns: Utility value from consumption and leisure.
welfare_utility(age, b, u, s)
Calculate the welfare utility value based age, basic needs and social interaction.
Parameters:
age (int) : Age of the subject.
b (float) : Value representing basic needs (food, shelter..).
u (float) : Value representing overall well-being and happiness.
s (float) : Value representing social interaction and connection with others.
Returns: Welfare utility value.
expected_lifetime_welfare(beta, consumption, leisure, alive_data, expectation)
Calculates the expected lifetime welfare of an individual based on their consumption, leisure, and survival probability over time.
Parameters:
beta (float) : Discount factor.
consumption (array) : List of consumption values at each step of the subjects life.
leisure (array) : List of leisure values at each step of the subjects life.
alive_data (array) : List of subjects alive at each age, the first element is the total or initial number of subjects.
expectation (float) : Optional, `defaut=1.0`. Expectation or weight given to this calculation.
Returns: Expected lifetime welfare value.
Statistical Trailing Stop [LuxAlgo]The Statistical Trailing Stop tool offers traders a way to lock in profits in trending markets with four statistical levels based on the log-normal distribution of volatility.
The indicator also features a dashboard with statistics of all detected signals.
🔶 USAGE
The tool works out of the box, traders can adjust the data used with two parameters: data & distribution length.
By default, the tool takes volatility measures of groups of 10 candles, and statistical measures of the last 100 of these groups then traders can adjust the base level to use as trailing, the larger the level, the more resistant the tool will be to moves against the trend.
🔹 Base Levels
Traders can choose up to 4 different levels of trailing, all based on the statistical distribution of volatility.
As we can see in the chart above, each higher level is more resistant to market movements, so level 0 is the most reactive and level 3 the least.
It is up to the trader to determine the best level for each underlying, time frame and market conditions.
🔹 Dashboard
The tool provides a dashboard with the statistics of all trades, making it very easy to assess the performance of the parameters used for any given market.
As we can see on the chart, all Daily BTC signals with default parameters but different base levels, level 2 is the best performing of all four, giving a positive expectation of $2435 per trade, taking into account all long and short trades.
Of note are the long trades with a win rate of 76.47% and a risk-to-reward of 3.34, giving a positive expectation of $4839 per trade, with winners having an average duration of 210 days and losers 32 days.
This, compared to short trades with negative expectation, speaks to the uptrend bias of this particular market.
🔶 SETTINGS
Data Length: Select how many bars to use per data point
Distribution Length: Select how many data points the distribution will have
Base Level: Choose between 4 different trailing levels
🔹 Dashboard
Show Statistics: Enable/disable dashboard
Position: Select dashboard position
Size: Select dashboard size
Indian Market Price LevelsScript to mark levels in Indian market to look for levels in market that including supports and resistance in the market
Composite Scaled EMA LevelsComposite Scaled EMA Levels Indicator
This TradingView Pine Script indicator calculates a “composite EMA” that compares the closing price of the current asset with that of the XU100 index and scales the EMA values to the XU100 level. It then visualizes these computed levels as horizontal lines on the chart with corresponding labels.
Key Components:
Inputs and Data Retrieval:
Length Input: The user defines a parameter length (default is 10) which determines over how many bars the horizontal line is drawn.
Data Collection:
The daily closing price of the current symbol (current_close) is retrieved using request.security().
The daily closing price of the XU100 index (xu100) is also retrieved.
A ratio is computed as current_close / xu100. This ratio serves as the basis for calculating the composite EMAs.
EMA Calculations:
The indicator computes Exponential Moving Averages (EMAs) on the ratio for specific periods.
In the provided version, the script calculates EMAs for three periods (34, 55, and 233), though you can easily expand this to other periods if needed.
Each computed EMA (for instance, EMA34, EMA55, EMA233) is then scaled by multiplying it with the XU100 index’s close, converting it to a price level that is meaningful on the chart.
Drawing Horizontal Lines:
Instead of using the standard plot() function, the script uses line.new() to draw horizontal lines representing the scaled EMA values over the last “length” bars.
Before drawing new lines, any existing lines and labels are deleted to ensure that only the most current values are shown.
Adding Labels to Lines:
The script creates a label for each EMA using label.new(), placing the label at the current bar (i.e., the rightmost position on the chart) using label.style_label_left so that the text appears to the right of the line.
The label displays the name of the composite EMA (e.g., "Composite EMA 34") along with its current scaled value.
Visualization:
The horizontal lines and labels provide a visual reference for the composite EMA levels. These lines help traders see critical support/resistance levels derived from the relationship between the current asset and the XU100 index.
Colors are assigned for clarity (for example, the EMA lines in this version use green).
Summary:
The Composite Scaled EMA Levels indicator is designed to help traders analyze the relationship between an asset’s price and the broader market index (XU100) by calculating a ratio and then applying EMAs on that ratio. By scaling these EMAs back to price levels and displaying them as horizontal lines with clear labels on the chart, the indicator offers a visual tool to assess trend direction and potential support or resistance levels. This can assist in making informed trading decisions based on composite trend analysis.
Mark Days with >4% Gain (vs. Previous Close)Shows days when the overall market increased by more than 4%
Quad Rotation Divergence – diag v4‑fixquad rotation divergence strategy theorised by george lane and popularised by day trading radio, this is my own little indictor to help me with spotting reversals with 4 stochastic oscilators in one indictor mimicing higher time frames
financial_history_utilsLibrary "financial_history_utils"
get_fq_value_n_quarters_ago(symbol, financial_id, n)
Parameters:
symbol (string)
financial_id (string)
n (int)
Average Body RangeThe Average Body Range (ABR) indicator calculates the average size of a candle's real body over a specified period. Unlike the traditional Average Daily Range (ADR), which measures the full range from high to low, the ABR focuses solely on the absolute difference between the open and close of each bar. This provides insight into market momentum and trading activity by reflecting how much price is actually moving from open to close , not just in total.
This indicator is especially useful for identifying:
Periods of strong directional movement (larger body sizes)
Low-volatility or indecisive markets (smaller body sizes)
Changes in trend conviction or momentum
Customization:
Length: Number of bars used to compute the average (default: 14)
Use ABR to enhance your understanding of price behavior and better time entries or exits based on market strength.
RTH and ETH RangesKey Functions :
Visualizes Regular Trading Hours (RTH) and Extended Trading Hours (ETH) price ranges
Tracks session highs, lows, and 50% levels where significant market reactions occur
Detects breakouts beyond previous session extremes
Trading Applications :
Exposes potential liquidity raids at session boundaries where smart money targets stop orders
Identifies critical price thresholds where institutional activity concentrates
Highlights divergences between RTH and ETH behavior that precede directional moves
Provides measurement of session volatility differences
Maps key price levels for objective entry and exit parameters
Reveals market dynamics at session transitions where institutional positioning changes