Buy/Sell Oscillator (BSO)📊 Buy/Sell Oscillator (BSO) – TradingView Script (Quick Guide)
What It Is:
A momentum-based indicator that plots buy/sell signals using a custom oscillator similar to RSI.
How It Works:
Calculates average gain/loss over a set period using Wilder’s method.
Converts the ratio into a BSO value (0–100 scale).
Buy Signal (Green Arrow): When BSO crosses below 40 (oversold).
Sell Signal (Red Arrow): When BSO crosses above 60 (overbought).
How to Use:
Apply on intraday charts (1–5 min) for momentum trading.
Buy on green arrow + price strength.
Sell or short on red arrow + weakness.
Works best with trend or volume confirmation.
Customizable:
Length, overbought/oversold levels, arrow visibility.
Penunjuk dan strategi
POC + VWAP Strategy w/ Time Filter & Trailing StopPoint of control from fixed range volume profile is determined on a 15 min chart. When price touches the point of control and price is below VWAP, it is a sell. When price is above vwap a buy happens. Only one trade at at time and there are trailing stop and take profit parameters.
Weighted Regression Bands (Zeiierman)█ Overview
Weighted Regression Bands is a precision-engineered trend and volatility tool designed to adapt to the real market structure instead of reacting to price noise.
This indicator analyzes Weighted High/Low medians and applies user-selectable smoothing methods — including Kalman Filtering, ALMA, and custom Linear Regression — to generate a Fair Value line. Around this, it constructs dynamic standard deviation bands that adapt in real-time to market volatility.
The result is a visually clean and structurally intelligent trend framework suitable for breakout traders, mean reversion strategies, and trend-driven analysis.
█ How It Works
⚪ Structural High/Low Analysis
At the heart of this indicator is a custom high/low weighting system. Instead of using just the raw high or low values, it calculates a midline = (high + low) / 2, then applies one of three weighting methods to determine which price zones matter most.
Users can select the method using the “Weighted HL Method” setting:
Simple
Selects the single most dominant median (highest or lowest) in the lookback window. Ideal for fast, reactive signals.
Advanced
Ranks each bar based on a composite score: median × range × recency. This method highlights structurally meaningful bars that had both volatility and recency. A built-in Kalman filter is applied for extra stability.
Smooth
Blends multiple bars into a single weighted average using smoothed decay and range. This provides the softest and most stable structural response.
⚪ Smoothing Methods (ALMA / Linear Regression)
ALMA provides responsive, low-lag smoothing for fast trend reading.
Linear Regression projects the Fair Value forward, ideal for trend modeling.
⚪ Kalman Smoothing Filter
Before trend calculations, the indicator applies an optional Kalman-style smoothing filter. This helps:
Reduce choppy false shifts in trend,
Retain signal clarity during volatile periods,
Provide stability for long-term setups.
⚪ Deviation Bands (Dynamic Volatility Envelopes)
The indicator builds ±1, ±2, and ±3 standard deviation bands around the fair value line:
Calculated from the standard deviation of price,
Bands expand and contract based on recent volatility,
Visualizes potential overbought/oversold or trending conditions.
█ How to Use
⚪ Trend Trading & Filtering
Use the Fair Value line to identify the dominant direction.
Only trade in the direction of the slope for higher probability setups.
⚪ Volatility-Based Entries
Watch for price reaching outer bands (+2σ, +3σ) for possible exhaustion.
Mean reversion entries become higher quality when far from Fair Value.
█ Settings
Length – Lookback for Weighted HL and trend smoothing
Deviation Multiplier – Controls how wide the bands are from the fair value line
Method – Choose between ALMA or Linear Regression smoothing
Smoothing – Strength of Kalman Filter (1 = none, <1 = stronger smoothing)
-----------------
Disclaimer
The content provided in my scripts, indicators, ideas, algorithms, and systems is for educational and informational purposes only. It does not constitute financial advice, investment recommendations, or a solicitation to buy or sell any financial instruments. I will not accept liability for any loss or damage, including without limitation any loss of profit, which may arise directly or indirectly from the use of or reliance on such information.
All investments involve risk, and the past performance of a security, industry, sector, market, financial product, trading strategy, backtest, or individual's trading does not guarantee future results or returns. Investors are fully responsible for any investment decisions they make. Such decisions should be based solely on an evaluation of their financial circumstances, investment objectives, risk tolerance, and liquidity needs.
Customizable 10‑MA SuiteCustomizable 10‑Moving‑Average Suite
OverviewPlot up to 10 independent moving averages on a single chart. Every line can be tailored to your trading style with adjustable length, timeframe, MA type (SMA, EMA, WMA, RMA, VWMA, HMA, LinReg), data source, colour, width, and plot style.
Key Features
True multi‑time‑frame support via request.security(): mix intraday and higher‑time‑frame MAs effortlessly.
Fine‑grained visibility control: toggle each MA on/off to keep charts clean and script performance high.
Versatile display options: choose between line, step, histogram, or area plots for every MA.
Typical Use‑Cases
Quickly compare short‑, medium‑, and long‑term trends.
Identify dynamic support/resistance and moving‑average crossovers.
Add confluence to existing strategies or discretionary setups.
Pro TipHighlight your primary trend MA with a thicker line and bolder colour, while setting secondary MAs to thinner or dashed styles—this keeps focus where it matters and prevents visual clutter.
Enjoy!
Ema CriptoMiltsIndicator showing EMA crossovers with the corresponding directionality.
The EMA price can be modified as desired.
Order Blocks📈 Order Blocks Only (With Mitigation Alerts)
This indicator identifies bullish and bearish order blocks on your chart and alerts you when they are formed or mitigated . Order blocks are key institutional price levels where strong buying or selling has previously occurred, often leading to significant future price reactions.
🔍 How It Works:
-Bullish Order Block: Formed when price closes above the high of a recent bearish candle. This suggests buyers have taken control.
-Bearish Order Block: Formed when price closes below the low of a recent bullish candle. This signals seller dominance.
-Once an order block is formed, a box is drawn on the chart to highlight the zone.
-These boxes last for a user-defined number of bars (default is 20) and can be automatically removed when price mitigates (retests and closes beyond) the zone.
🛠 User Settings:
-Show Bullish Order Blocks – Toggle green zones on/off.
-Show Bearish Order Blocks – Toggle red zones on/off.
-Order Block Duration – How many bars the boxes should remain on the chart.
-Delete Mitigated Boxes – If enabled, mitigated zones are automatically removed.
-Custom Colors – Personalize the fill and border colors of bullish and bearish blocks.
🔔 Alerts:
This tool supports four built-in alert types:
-Bullish Order Block Formed
-Bearish Order Block Formed
-Bullish Order Block Mitigated
-Bearish Order Block Mitigated
Set these alerts to stay on top of key price reactions.
✅ How to Use It:
1. Apply the indicator to any chart and timeframe.
2. Watch for new order blocks to form after strong price breaks.
3. Use these zones as potential entry points, stop placement areas, or take profit zones.
4. Enable alerts to catch key institutional levels as they form or are retested.
Supply and Demand Zones🔍 Supply and Demand Zones
by The_Forex_Steward
This indicator automatically identifies Supply and Demand Zones based on aggregated synthetic candles, helping traders pinpoint potential reversal or breakout levels with clarity and precision.
🧠 How It Works:
This tool aggregates price data over a set number of candles (defined by the Aggregation Factor ) to create "synthetic candles" that smooth out noise and highlight significant institutional price activity. These candles are then analyzed to detect bullish or bearish order blocks , which are visualized as zones:
-Demand Zones (Green) : Formed when price breaks above the high of a previous bearish synthetic candle.
-Supply Zones (Red) : Formed when price breaks below the low of a previous bullish synthetic candle.
These areas often represent key institutional interest where price is likely to react.
⚙️ Key Features:
-Aggregation Factor : Groups candles to form larger, synthetic ones. Higher values smooth price and reduce noise.
-Custom Zone Length : Define how far zones extend forward (up to 500 bars).
-Mitigation Logic : Choose whether to auto-delete zones once price breaks through them.
-Visual Customization : Customize zone colors and borders to suit your charting style.
-Alerts : Get notified when new Supply or Demand zones are formed.
📈 How to Use It:
1. Trend Trading : Use zones as dynamic support/resistance to enter with trend pullbacks.
2. Reversals : Look for price reactions at untested zones for potential counter-trend setups.
3. Breakouts : Monitor for zone breaks that signal strong momentum or shifts in market structure.
4. Confluence : Combine with other indicators (like RSI or volume) for more robust trade setups.
🔔 Alerts:
Receive alerts when new demand or supply zones are formed so you can take action in real time.
✅ Recommended Settings:
For intraday trading : Use lower aggregation values (e.g., 3–5).
For swing/position trading : Higher values (e.g., 6–10) may give better structure.
SOXL Trend Surge v3.0.2 - Refined Reality RunnerSOXL Trend Surge v3.0.2 – Refined Reality Runner (Long Only)
Overview:
A precision-engineered, swing-focused strategy built for SOXL on the 1-hour chart. Designed to mirror real-world execution in a cash account, this system blends trend confirmation, volatility filters, and profit-locking logic to extract gains from explosive semiconductor moves — without relying on fantasy backtest fills.
Key Features:
Cumulative gain: +25% (1H SOXL, 2024–2025)
Win rate: ~65%
Profit factor: >2.0
Max drawdown: ~5%
Strategy Highlights:
Entry Logic:
Price above 200 EMA
Supertrend confirmation
RSI under 75
Volume & ATR filters to avoid false breakouts
Price must be outside a tight EMA “chop zone”
Exit Logic:
Partial profit at 2× ATR
Break-even stop after partial taken
RSI exit if overheated
Full exit via ATR stop or trailing stop on the runner
Execution Style:
Cash-account friendly
All trades ≥ 2 bars (no same-candle flips)
Ideal for Webull, TradingView alerts, or Alpaca automation
LANZ Strategy 2.0 [Backtest]🔷 LANZ Strategy 2.0 — Structural Breakout Logic with Dynamic Swing Protection
LANZ Strategy 2.0 is a precision-focused backtesting system built for intraday traders who rely on structural confirmations before the London session to guide directional bias. This tool uses smart swing detection, risk-defined position sizing, and strict time-based execution to simulate real trading conditions with clarity and control.
🧠 Core Components:
Structural Confirmation (Trend & BoS): Detects trend direction and break of structure (BoS) using a three-swing logic, aligning trade entries with valid structural movement.
Time-Based Execution: Trades are triggered exclusively at 02:00 a.m. New York time, ensuring disciplined and repeatable intraday testing.
Swing-Based SL Models: Traders can select between three stop-loss protection types:
First Swing: Most recent structural level
Second Swing: Prior level
Full Coverage: All recent swing levels + configurable pip buffer
Dynamic TP Calculation: Take-Profit is projected as a risk-based multiple (RR), fully adjustable via input.
Capital-Based Risk Management: Risk is defined as a percentage of a fixed account size (e.g., $100 per trade from $10,000), and lot size is automatically calculated based on SL distance.
Fallback Entry Logic: If structural breakout is present but trend is not confirmed, a secondary entry is triggered.
End-of-Session Management: Any open trades are automatically closed at 11:45 a.m. NY time, with optional manual labeling or review.
📊 Visual Features (Optional in Indicator Version):
(Note: Visuals apply to the indicator version of LANZ 2.0, not this backtest script)
Swing level labels (1st, 2nd) and dynamic SL/TP lines.
Real-time session coloring for clarity: Pre-London, Entry Window, and NY Close.
Outcome labels: +RR, -RR, or net % at close.
Auto-cleanup of previous drawings for a clean chart per session.
⚙️ How It Works:
Detects last trend and BoS using swing logic before 02:00 a.m. NY.
At 02:00 a.m., evaluates directional bias and executes BUY or SELL if confirmed.
Applies selected SL logic (1st, 2nd, or full swing protection).
Sets TP based on the RR multiplier.
Closes the trade either on SL, TP, or at 11:45 a.m. NY manually.
🔔 Alerts:
Time-of-day alert at 02:00 a.m. NY to monitor execution.
Can be extended to cover SL/TP triggers or new BoS events.
📝 Notes:
Designed for backtesting precision and discretionary decision-making.
Ideal for Forex pairs, indices, or assets active during the London session.
Fully customizable: session timing, swing logic, SL buffer, and RR.
👤 Credits:
Strategy built by @rau_u_lanz using Pine Script v6, combining structural logic, capital-based risk control, and London-session timing in a backtest-ready framework for traders who demand accuracy and structure.
Perp R/R Toolcalculate lot size and automatically plot SL and TP and entry for quicker execution when scalping. SL is currently set to high of candle for shorts and low of candle for longs +1 ATR. can change ATR, risk per trade and r/r ratio in settings. change trade direction to show info for long, short or both.
ErrorFunctionsLibrary "ErrorFunctions"
A collection of functions used to approximate the area beneath a Gaussian curve.
Because an ERF (Error Function) is an integral, there is no closed-form solution to calculating the area beneath the curve. Meaning all ERFs are approximations; precisely wrong, but mostly accurate. How close you need to get to the actual area depends entirely on your use case, with more precision being less efficient.
The internal precision of floats in Pine Script is 1e-16 (16 decimals, aka. double precision). This library adapts well known algorithms designed to efficiently reach double precision. Single precision alternates are also included. All of them were made free to use, modify, and distribute by their original authors.
HASTINGS
Adaptation of a single precision ERF by Cecil Hastings Jr, published through Princeton University in 1955. It was later documented by Abramowitz and Stegun as equation 7.1.26 in their 1972 Handbook of Mathematical Functions. Fast, efficient, and ideal when precision beyond a few decimals is unnecessary.
GILES
Adaptation of a single precision Inverse ERF by Michael Giles, published through the University of Oxford in 2012. It reverses the ERF, estimating an X coordinate from an area. It too is fast, efficient, and ideal when precision beyond a few decimals is unnecessary.
LIBC
Adaptation of the double precision ERF & ERFC in the standard C library (aka. libc). It is also the same ERF & ERFC that SciPy uses. While not quite as efficient as the Hastings approximation, it's still very fast and fully maximizes Pines precision.
BOOST
Adaptation of the double precision Inverse ERF & Inverse ERFC in the Boost Math C++ library. SciPy uses these as well. These reverse the ERF & ERFC, estimating an X coordinate from an area. It too isn't quite as efficient as the Giles approximation, but still fast and fully maximizes Pines precision.
While these algorithms are not exported directly, they are available through their exported counterparts.
- - -
ERROR FUNCTIONS
erf(x, precise)
An Error Function estimates the theoretical error of a measurement.
Parameters:
x (float) : (float) Upper limit of the integration.
precise (bool) : Double precision (true) or single precision (false).
Returns: (float) Between -1 and 1.
erfc(x, precise)
A Complementary Error Function estimates the difference between a theoretical error and infinity.
Parameters:
x (float) : (float) Lower limit of the integration.
precise (bool) : Double precision (true) or single precision (false).
Returns: (float) Between 0 and 2.
erfinv(x, precise)
An Inverse Error Function reverses the erf() by estimating the original measurement from the theoretical error.
Parameters:
x (float) : (float) Theoretical error.
precise (bool) : Double precision (true) or single precision (false).
Returns: (float) Between 0 and ± infinity.
erfcinv(x, precise)
An Inverse Complementary Error Function reverses the erfc() by estimating the original measurement from the difference between the theoretical error and infinity.
Parameters:
x (float) : (float) Difference between the theoretical error and infinity.
precise (bool) : Double precision (true) or single precision (false).
Returns: (float) Between 0 and ± infinity.
- - -
DISTRIBUTION FUNCTIONS
pdf(x, m, s)
A Probability Density Function estimates the probability density . For clarity, density is not a probability .
Parameters:
x (float) : (float) X coordinate for which a density will be estimated.
m (float) : (float) Mean
s (float) : (float) Sigma
Returns: (float) Between 0 and ∞.
cdf(z, precise)
A Cumulative Distribution Function estimates the area under a Gaussian curve between negative infinity and the Z Score.
Parameters:
z (float) : (float) Z Score.
precise (bool) : Double precision (true) or single precision (false).
Returns: (float) Between 0 and 1.
cdfinv(a, precise)
An Inverse Cumulative Distribution Function reverses the cdf() by estimating the Z Score from an area.
Parameters:
a (float) : (float) Area between 0 and 1.
precise (bool) : Double precision (true) or single precision (false).
Returns: (float) Between -∞ and +∞
cdfab(z1, z2, precise)
A Cumulative Distribution Function from A to B estimates the area under a Gaussian curve between two Z Scores (A and B).
Parameters:
z1 (float) : (float) First Z Score.
z2 (float) : (float) Second Z Score.
precise (bool) : Double precision (true) or single precision (false).
Returns: (float) Between 0 and 1.
ttt(z, precise)
A Two-Tailed Test estimates the area under a Gaussian curve between symmetrical ± Z scores and ± infinity.
Parameters:
z (float) : (float) One of the symmetrical Z Scores.
precise (bool) : Double precision (true) or single precision (false).
Returns: (float) Between 0 and 1.
tttinv(a, precise)
An Inverse Two-Tailed Test reverses the ttt() by estimating the absolute Z Score from an area.
Parameters:
a (float) : (float) Area between 0 and 1.
precise (bool) : Double precision (true) or single precision (false).
Returns: (float) Between 0 and ∞.
ott(z, precise)
A One-Tailed Test estimates the area under a Gaussian curve between an absolute Z Score and infinity.
Parameters:
z (float) : (float) Z Score.
precise (bool) : Double precision (true) or single precision (false).
Returns: (float) Between 0 and 1.
ottinv(a, precise)
An Inverse One-Tailed Test Reverses the ott() by estimating the Z Score from a an area.
Parameters:
a (float) : (float) Area between 0 and 1.
precise (bool) : Double precision (true) or single precision (false).
Returns: (float) Between 0 and ∞.
Multi-Timeframe Sweep and AlertThis indicator is designed to be used with the Fractal Model in that it will visually alert you when there has been a sweep on the 15m, 30m, 1h, and 4H time frames. You can also have it send you alerts as well
target tendance//@version=6
indicator("target tendance", "TT", overlay = true)
// Trend settings
st_factor = input.float(12, title="Supertrend Factor", minval=1, step=0.5, group="Trend Settings",
tooltip="Multiplier for the ATR to determine Supertrend bands width. Higher values create wider bands and fewer signals.")
st_atr_period = input.int(90, title="Supertrend ATR Period", minval=1, group="Trend Settings",
tooltip="Number of bars used to calculate the ATR for Supertrend. Longer periods create smoother, less reactive bands.")
wma_length = input.int(40, title="WMA Length", minval=1, group="Trend Settings",
tooltip="Length of the Weighted Moving Average applied to the SuperTrend. Higher values create smoother, less reactive lines.")
ema_length = input.int(14, title="EMA Length", minval=1, group="Trend Settings",
tooltip="Length of the Exponential Moving Average applied to the WMA. Controls the final smoothness of the trend line.")
//Continuation settings
cont_factor = input.int(3, title="Confirmation count", minval=1, group="Rejection Settings",
tooltip="Number of consecutive bars that must consolidate at the trend line before a rejection signal is generated. Higher values require more bars to confirm a trend.")
// Volatility settings
shw_TP1 = input.bool(true, title="Show Take Profit Levels", group="Targets",
tooltip="Toggle visibility of take profit target levels on the chart.")
atr_period = input.int(14, title="Volatility (ATR) period", minval=1, group="Targets",
tooltip="Number of bars used to calculate the Average True Range for position sizing and targets.")
sl_multiplier = input.float(5, title="Stop Loss ATR Multiplier", minval=0.1, step=0.1, group="Targets",
tooltip="Multiplier applied to ATR to determine stop loss distance from entry. Higher values place stops further away.")
tp1_multiplier = input.float(0.5, title="TP1 Multiplier", minval=0.1, step=0.1, tooltip="Multiple of SL distance for first take profit target.", group="Targets")
tp2_multiplier = input.float(1.0, title="TP2 Multiplier", minval=0.1, step=0.1, tooltip="Multiple of SL distance for second take profit target.", group="Targets")
tp3_multiplier = input.float(1.5, title="TP3 Multiplier", minval=0.1, step=0.1, tooltip="Multiple of SL distance for third take profit target.", group="Targets")
volatility = ta.atr(atr_period)
// Appearance settings
green = input.color(#95eed6, title="Bullish Color", tooltip="Color used for bullishness", group="Appearance")
red = input.color(#ff1100, title="Bearish Color", tooltip="Color used for bearishness", group="Appearance")
pine_supertrend(factor, atrPeriod) =>
src = hl2
atr = ta.atr(atrPeriod)
upperBand = src + factor * atr
lowerBand = src - factor * atr
prevLowerBand = nz(lowerBand )
prevUpperBand = nz(upperBand )
lowerBand := lowerBand > prevLowerBand or close < prevLowerBand ? lowerBand : prevLowerBand
upperBand := upperBand < prevUpperBand or close > prevUpperBand ? upperBand : prevUpperBand
= pine_supertrend(st_factor, st_atr_period)
tL = ta.ema(ta.wma(math.avg(lwr, upr), wma_length), ema_length)
var trend = 0
if ta.crossover(tL, tL )
trend := 1
if ta.crossunder(tL, tL )
trend := -1
var rejcount = 0
bullishrej = trend == 1 and high > tL and low < tL
bearishrej = trend == -1 and high > tL and low < tL
if (bullishrej or bearishrej)
rejcount += 1
if ta.cross(trend, 0) or (not (bullishrej or bearishrej) and rejcount > 0)
rejcount := 0
plotchar((rejcount > cont_factor and trend == 1) ? tL : na, "Bullish Rejection", "▲", location.belowbar, green, size = size.tiny)
plotchar((rejcount > cont_factor and trend == -1) ? tL : na, "Bearish Rejection", "▼", location.abovebar, red, size = size.tiny)
plot(tL, "Baseline", color=trend == 1 ? color.new(green, 50) : color.new(red, 50), linewidth = 2)
barcolor(trend == 1 ? color.new(green, 50) : color.new(red, 50))
plotshape(ta.crossover(tL, tL ) ? tL : na, title="Bullish Trend Change", style=shape.labelup, location=location.absolute, size=size.small, color=green)
plotshape(ta.crossunder(tL, tL ) ? tL : na, title="Bearish Trend Change", style=shape.labeldown, location=location.absolute, size=size.small, color=red)
longSignal = ta.crossover(trend, 0)
shortSignal = ta.crossunder(trend, 0)
var SL = 0.0
var TP1_lvl = 0.0
var TP2_lvl = 0.0
var TP3_lvl = 0.0
var line entry_line = na
var line sl_line = na
var line tp1_line = na
var line tp2_line = na
var line tp3_line = na
var label entry_label = na
var label sl_label = na
var label tp1_label = na
var label tp2_label = na
var label tp3_label = na
if longSignal and shw_TP1
SL := low - volatility * sl_multiplier
TP1_lvl := close + math.abs(close - SL) * tp1_multiplier
TP2_lvl := close + math.abs(close - SL) * tp2_multiplier
TP3_lvl := close + math.abs(close - SL) * tp3_multiplier
entry_line := line.new(bar_index, close, bar_index, close, color = green, width = 3)
entry_label := label.new(bar_index, close, text = "Entry ▸ " + str.tostring(close, format.mintick), style = label.style_label_left, color = green, textcolor = color.white)
sl_line := line.new(bar_index, SL, bar_index, SL, color = color.new(red, 80), width = 3)
sl_label := label.new(bar_index, SL, text = "✘ SL ▸ " + str.tostring(SL, format.mintick), style = label.style_label_left, color = color.new(red, 80), textcolor = color.white)
QQ BBW-NelloCalc & Plot BBW (Bollinger Band With)
Calc History average
Plot background when BBW it's lower 50% of History
Statistical Pairs Trading IndicatorZ-Score Stat Trading — Statistical Pairs Trading Indicator
📊🔗
---
What is it?
Z-Score Stat Trading is a powerful indicator for statistical pairs trading and quantitative analysis of two correlated assets.
It calculates the Z-Score of the log-price spread between any two symbols you choose, providing both long-term and short-term Z-Score signals.
You’ll also see real-time correlation, volatility, spread, and the number of long/short signals in a handy on-chart table!
---
How to Use 🛠️
1. Add the indicator to your chart.
2. Select two assets (symbols) to analyze in the settings.
3. Watch the Z-Score plots (blue and orange lines) and threshold levels (+2, -2 by default).
4. Check the info table for:
- Correlation
- Volatility
- Spread
- Number of long (NL) and short (NS) signals in the last 1000 bars
5. Set up alerts for signal generation or threshold crossings if you want to be notified automatically.
---
Trading Strategy 💡
- This indicator is designed for statistical arbitrage (mean reversion) strategies.
- Long Signal (🟢):
When both Z-Scores drop below the negative threshold (e.g., -2), a long signal is generated.
→ Buy Symbol A, Sell Symbol B, expecting the spread to revert to the mean.
- Short Signal (🔴):
When both Z-Scores rise above the positive threshold (e.g., +2), a short signal is generated.
→ Sell Symbol A, Buy Symbol B, again expecting mean reversion.
- The info table helps you quickly assess the frequency of signals and the current statistical relationship between your chosen assets.
---
Best Practices & Warnings 🚦
- Avoid high leverage! Pairs trading can be risky, especially during periods of divergence. Use conservative position sizing.
- Check for cointegration: Before using this indicator, make sure both assets are cointegrated or have a strong historical relationship. This increases the reliability of mean reversion signals.
- Check correlation: Only use asset pairs with a high correlation (preferably 0.8–0.9 or higher) for best results. The correlation value is shown in the info table.
- Scale in and out gradually: When entering or exiting positions, consider doing so in parts rather than all at once. This helps manage slippage and risk, especially in volatile markets.
---
⚠️ Note on Performance:
This indicator may work a bit slowly, especially on large timeframes or long chart histories, because the calculation of NL and NS (number of long/short signals) is computationally intensive.
---
Disclaimer ⚠️
This script is provided for educational and informational purposes only .
It is not financial advice or a recommendation to buy or sell any asset.
Use at your own risk. The author assumes no responsibility for any trading decisions or losses.
MACD Crossover Alert with LabelsSenses crossover to Bullish and Bearish puts a label on the crossovers and sets an alert
Newton_lowerit's the indicator Graham Lindman from Finacial Wars using in his TOS....
The indicator is calculating the difference between fast and slow moving average ( ema 5 & ema 16). The result is shown as an histogram & colored candles for positive and negative short term momentum.
target tendance//@version=6
indicator("target tendance", "TT", overlay = true)
// Trend settings
st_factor = input.float(12, title="Supertrend Factor", minval=1, step=0.5, group="Trend Settings",
tooltip="Multiplier for the ATR to determine Supertrend bands width. Higher values create wider bands and fewer signals.")
st_atr_period = input.int(90, title="Supertrend ATR Period", minval=1, group="Trend Settings",
tooltip="Number of bars used to calculate the ATR for Supertrend. Longer periods create smoother, less reactive bands.")
wma_length = input.int(40, title="WMA Length", minval=1, group="Trend Settings",
tooltip="Length of the Weighted Moving Average applied to the SuperTrend. Higher values create smoother, less reactive lines.")
ema_length = input.int(14, title="EMA Length", minval=1, group="Trend Settings",
tooltip="Length of the Exponential Moving Average applied to the WMA. Controls the final smoothness of the trend line.")
//Continuation settings
cont_factor = input.int(3, title="Confirmation count", minval=1, group="Rejection Settings",
tooltip="Number of consecutive bars that must consolidate at the trend line before a rejection signal is generated. Higher values require more bars to confirm a trend.")
// Volatility settings
shw_TP1 = input.bool(true, title="Show Take Profit Levels", group="Targets",
tooltip="Toggle visibility of take profit target levels on the chart.")
atr_period = input.int(14, title="Volatility (ATR) period", minval=1, group="Targets",
tooltip="Number of bars used to calculate the Average True Range for position sizing and targets.")
sl_multiplier = input.float(5, title="Stop Loss ATR Multiplier", minval=0.1, step=0.1, group="Targets",
tooltip="Multiplier applied to ATR to determine stop loss distance from entry. Higher values place stops further away.")
tp1_multiplier = input.float(0.5, title="TP1 Multiplier", minval=0.1, step=0.1, tooltip="Multiple of SL distance for first take profit target.", group="Targets")
tp2_multiplier = input.float(1.0, title="TP2 Multiplier", minval=0.1, step=0.1, tooltip="Multiple of SL distance for second take profit target.", group="Targets")
tp3_multiplier = input.float(1.5, title="TP3 Multiplier", minval=0.1, step=0.1, tooltip="Multiple of SL distance for third take profit target.", group="Targets")
volatility = ta.atr(atr_period)
// Appearance settings
green = input.color(#95eed6, title="Bullish Color", tooltip="Color used for bullishness", group="Appearance")
red = input.color(#ff1100, title="Bearish Color", tooltip="Color used for bearishness", group="Appearance")
pine_supertrend(factor, atrPeriod) =>
src = hl2
atr = ta.atr(atrPeriod)
upperBand = src + factor * atr
lowerBand = src - factor * atr
prevLowerBand = nz(lowerBand )
prevUpperBand = nz(upperBand )
lowerBand := lowerBand > prevLowerBand or close < prevLowerBand ? lowerBand : prevLowerBand
upperBand := upperBand < prevUpperBand or close > prevUpperBand ? upperBand : prevUpperBand
= pine_supertrend(st_factor, st_atr_period)
tL = ta.ema(ta.wma(math.avg(lwr, upr), wma_length), ema_length)
var trend = 0
if ta.crossover(tL, tL )
trend := 1
if ta.crossunder(tL, tL )
trend := -1
var rejcount = 0
bullishrej = trend == 1 and high > tL and low < tL
bearishrej = trend == -1 and high > tL and low < tL
if (bullishrej or bearishrej)
rejcount += 1
if ta.cross(trend, 0) or (not (bullishrej or bearishrej) and rejcount > 0)
rejcount := 0
plotchar((rejcount > cont_factor and trend == 1) ? tL : na, "Bullish Rejection", "▲", location.belowbar, green, size = size.tiny)
plotchar((rejcount > cont_factor and trend == -1) ? tL : na, "Bearish Rejection", "▼", location.abovebar, red, size = size.tiny)
plot(tL, "Baseline", color=trend == 1 ? color.new(green, 50) : color.new(red, 50), linewidth = 2)
barcolor(trend == 1 ? color.new(green, 50) : color.new(red, 50))
plotshape(ta.crossover(tL, tL ) ? tL : na, title="Bullish Trend Change", style=shape.labelup, location=location.absolute, size=size.small, color=green)
plotshape(ta.crossunder(tL, tL ) ? tL : na, title="Bearish Trend Change", style=shape.labeldown, location=location.absolute, size=size.small, color=red)
longSignal = ta.crossover(trend, 0)
shortSignal = ta.crossunder(trend, 0)
var SL = 0.0
var TP1_lvl = 0.0
var TP2_lvl = 0.0
var TP3_lvl = 0.0
var line entry_line = na
var line sl_line = na
var line tp1_line = na
var line tp2_line = na
var line tp3_line = na
var label entry_label = na
var label sl_label = na
var label tp1_label = na
var label tp2_label = na
var label tp3_label = na
if longSignal and shw_TP1
SL := low - volatility * sl_multiplier
TP1_lvl := close + math.abs(close - SL) * tp1_multiplier
TP2_lvl := close + math.abs(close - SL) * tp2_multiplier
TP3_lvl := close + math.abs(close - SL) * tp3_multiplier
entry_line := line.new(bar_index, close, bar_index, close, color = green, width = 3)
entry_label := label.new(bar_index, close, text = "Entry ▸ " + str.tostring(close, format.mintick), style = label.style_label_left, color = green, textcolor = color.white)
sl_line := line.new(bar_index, SL, bar_index, SL, color = color.new(red, 80), width = 3)
sl_label := label.new(bar_index, SL, text = "✘ SL ▸ " + str.tostring(SL, format.mintick), style = label.style_label_left, color = color.new(red, 80), textcolor = color.white)
Volume Spike 20%+This indicator highlights volume spikes that exceed the 20% threshold above the 20-period simple moving average of volume.
🔹 Gray bars: Normal volume
🔹 Green bars: Volume is at least 20% higher than the 20-period average
🔸 Orange line: The 20-period volume moving average
Use case:
This tool helps traders quickly spot abnormal trading activity or increased interest in a stock, which may precede a price breakout or reversal.
Simple, clean, and effective – perfect for momentum, breakout, or volume-based strategies.
EMA Ribbon with Source SelectionThe EMA Ribbon with Source Selection is a versatile trend-following indicator that plots three customizable Exponential Moving Averages (EMAs) directly on the price chart. Each EMA can be configured with a unique input source (e.g., close, open, high, low) and length, allowing traders to tailor the ribbon to their strategy or asset.
How It Works:
The indicator draws three EMAs (default lengths: 8, 20, and 50) to represent short-, medium-, and long-term trends.
Each EMA line is dynamically color-coded based on its recent slope, making it easy to spot changes in momentum:
Green/Blue shades indicate upward movement.
Red/Black shades signal downward movement.
Use Cases:
Identify trend direction across multiple timeframes.
Spot trend reversals or confirm entries and exits.
Customize the source for each EMA to match your trading style or preferred signals.
Ideal For:
Swing traders, trend followers, and anyone looking to enhance chart clarity with a clean and responsive EMA ribbon.
HVC Daily LevelsDaily High Volume Candle Levels Marked on all Timeframes
HVC Level Sentinel v6 — High Volume Candle Levels
HVC Level Sentinel v6 automatically detects and highlights “High Volume Candles” (HVCs) — bars with the highest trading volume in a rolling, user-defined window (e.g., 30 days). This tool helps you spot key price levels where significant trading activity occurred, which can act as important support or resistance zones.
Features
Customizable Lookback: Choose how many bars to look back for HVC detection (default: 30 days, adjustable).
Automatic Highlighting: HVC candles are highlighted on your chart with a customizable color.
Level Lines: Draws horizontal lines at the Open, High, Low, and Close of each recent HVC, so you can easily track these key levels.
Line Fading: Only the most recent N HVCs (user-adjustable) have lines, with older lines fading out or disappearing for clarity.
Per-Line Control: Turn on/off Open, High, Low, and Close lines individually in the settings.
Fully Customizable: Adjust colors, line styles, widths, and opacity to fit your chart style.
How It Works
On each new bar, the script checks if the current bar’s volume is the highest in the last N bars.
If so, it marks the bar as an HVC and draws lines at its O/H/L/C (if enabled).
You can highlight all HVCs historically, but only the most recent N will have lines for a clean, focused chart.
Use Cases
Identify major breakout or reversal points driven by high volume.
Track where institutional or “smart money” activity may have occurred.
Use HVC levels as dynamic support/resistance for entries, exits, or stop placement.
Tip :
Adjust the lookback window and number of HVCs with lines to match your trading style—shorter for active trading, longer for swing/position trading.