INFLECTION NEXUS - Shadow Portfolio AdaptiveINFLECTION NEXUS - SPA (Shadow Portfolio Adaptive)
Foreword: The Living Algorithm
For decades, technical analysis has been a conversation between a trader and a static chart. We draw our lines, we apply our indicators with their fixed-length inputs, and we hope that our rigid tools can somehow capture the essence of a market that is fluid, chaotic, and perpetually evolving. When our tools fail, we are told to "adapt." But what if the tools themselves could learn that lesson? What if our indicators could adapt not just for us, but with us?
This script, INFLECTION NEXUS - SPA, is the first step in that direction. It is an experimental framework, a research project shared publicly, built around a radical new core: the Shadow Portfolio Adaptive (SPA) Engine . Let's be clear from the outset: the signal logic you see—the buy and sell labels—is a refined version from my previous work, "Turning Point." The signals are not the star of this show. This entire publication is a showcase of the groundbreaking, self-learning engine that now powers them.
You will likely feel that this system is overwhelmingly complex when you first load it. That is by design. This is not another simple crossover indicator. This is a look under the hood of a system designed to emulate the perpetual learning cycle of a human mind. My goal with this document is to break down every single component, every color, every number, into simple, understandable pieces. We will go through this step-by-step, so that by the end, you will not only understand how it works, but you will appreciate the depth of the analysis it performs on your behalf.
This is a beta release. Not all planned features are fully functional, and I will be updating it as the research continues. But the core engine is here, and it represents a new paradigm. Prepare to engage with a script that doesn't just analyze the market—it actively seeks to understand it.
Chapter 1: The Paradigm Shift - Why the SPA Engine is a Leap Forward
To grasp the innovation here, we must first deconstruct the old way of thinking about "adaptive" indicators.
Part A: The Traditional Model - Driving by the Rear-View Mirror
Imagine a self-driving car that can only make adjustments after it has already completed a trip. This is, in essence, how most "adaptive" trading systems work. Their process is fundamentally reactive and inefficient:
Wait for a Signal: The system is idle until its specific, hard-coded logic (e.g., a moving average crossover) generates a buy or sell signal.
Wait for an Outcome: It then waits for that entire trade to play out and close, resulting in a win or a loss.
Collect Limited Data: It only learns from the performance of its own signals. If the market is moving but not generating signals, the system is blind and learns nothing.
Require a Massive Sample Size: To avoid making changes based on random luck, it must wait for a huge number of trades—often 50, 100, or even more—before it has a statistically significant sample of wins and losses.
Make a Belated Adjustment: Finally, after this long "warm-up" period, it will make a tiny, retrospective adjustment to its parameters.
The fatal flaw is obvious: this model is always adapting to a market that no longer exists. It is slow, data-starved, and hopelessly biased by its own signal logic.
Part B: The SPA Model - The Proactive Co-Pilot
The Shadow Portfolio Adaptive (SPA) engine is a complete re-imagining of this process. It is not a reactive historian; it is a proactive, ever-present co-pilot, constantly learning and recalibrating.
It Never Waits: The SPA engine does not wait for a signal to learn. From the moment you load it on the chart, its Shadow Portfolio begins running constant, 5-bar long and short trades in the background. It is not testing a "signal"; it is testing the very fabric of the market, bar by bar.
It is Data-Saturated: Because it learns from every 5-bar slice of price action, the SPA engine gathers a colossal amount of unbiased data. While a traditional system might learn from one trade every 50 bars, the SPA engine learns from a long and a short trade every single bar after its initial cycle.
Instantaneous Market Awareness - The End of the "Warm-Up": This is the core innovation. A traditional adaptive system is effectively useless for the first 50-100 trades. The SPA engine's warm-up period is exactly five bars . On the 6th bar of the chart, the first shadow trade closes, a data point is generated, and the learning process begins. From the 6th bar onward, the engine is market-aware and capable of making intelligent adjustments. The SPA engine isn't adapting to old wins and losses. It is adapting, in near real-time, to the market's ever-shifting character, volatility, and personality.
Chapter 2: The Anatomy of the SPA Engine - A Toddler's Guide to a Complex Brain
The engine is composed of three primary systems that work in a beautiful, interconnected symphony. Let's break them down.
Section 1: The Shadow Portfolio (The Information Harvester)
What it is, Simply: Think of this as the script's eyes and ears. It's a team of 10 virtual traders (5 long, 5 short) who are constantly taking small, quick trades to feel out the market.
How it Works, Simply: On every new bar, a new "long" trader and a new "short" trader enter the market. Exactly 5 bars later, they close their positions. This cycle is perpetual and relentless.
The Critical 'Why': Because these virtual traders enter and exit based on a fixed time (5 bars), not on a "good" or "bad" signal, their results are completely unbiased . They are simply measuring: "What happened to price over the last 5 bars?" This provides the raw, untainted truth about the market's behavior that the rest of the system needs to learn effectively.
The Golden Metric (ATR Normalization): The engine doesn't just look at dollar P&L. It's smarter than that. It asks a more intelligent question: "How much did this trade make relative to the current volatility?"
Analogy: Imagine a flea and an elephant. If they both jump 1 inch, who is more impressive? The flea. The SPA engine understands this. A $10 profit when the market is dead quiet is far more significant than a $10 profit during a wild, volatile swing.
The Formula: realized_atr = (close - trade.entry) / trade.atr_entry. It takes the raw profit and divides it by the Average True Range (a measure of volatility) at the moment of entry. This gives a pure, "apples-to-apples" score for every single trade, which is the foundational data point for all learning.
Section 2: The Cognitive Map (The Long-Term Brain)
What it is, Simply: This is the engine's deep memory, its library of experiences. Imagine a giant, 64-square chessboard (8x8 grid). Each square on the board represents a very specific type of market environment.
The Two Dimensions of Thought (The 'How'): How does it know which square we are on? It looks at two things:
The Market's Personality (X-Axis): Is the market behaving like a disciplined soldier, marching in a clear trend? Or is it like a chaotic, unpredictable child, running all over the place? The engine calculates a "Regime" score to figure this out.
The Market's Energy Level (Y-Axis): Is the market sleepy and quiet, or is it wide-awake and hyperactive? The engine measures "Normalized Volatility" to determine this.
The Power of Generalization (The 'Why'): When a Shadow Portfolio trade closes, its result is recorded in the corresponding square on the chessboard. But here's the clever part: it also shares a little bit of that lesson with the squares immediately next to it (using a Gaussian Kernel).
Analogy: If you touch a hot stove and learn "don't touch," your brain is smart enough to know you probably shouldn't touch the hot oven door next to it either, even if you haven't touched it directly. The Cognitive Map does the same thing, allowing it to make intelligent inferences even in market conditions it has seen less frequently. Each square remembers what indicator settings worked best in that specific environment.
Section 3: The Adaptive Engine (The Central Nervous System)
What it is, Simply: This is the conductor of the orchestra. It takes information from all other parts of the system and decides exactly what to do.
The Symphony of Inputs: It listens to three distinct sources of information before making a decision:
The Short-Term Memory (Rolling Stats): It looks at the performance of the last rollN shadow trades. This is its immediate, recent experience.
The Long-Term Wisdom (Cognitive Map): It consults the grand library of the Cognitive Map to see what has worked best in the current market type over the long haul.
The Gut Instinct (Bin Learning): It keeps a small "mini-batch" of the most recent trades. If this batch shows a very strong, sudden pattern, it can trigger a rapid, reflexive adjustment, like pulling your hand away from a flame.
The Fusion Process: It then blends these three opinions together in a sophisticated way. It gives more weight to the opinions it's more confident in (e.g., a Cognitive Map square with hundreds of trades of experience) and uses your Adaptation Intensity (dialK) input to decide how much to listen to its "gut instinct." The final decision is then smoothed to ensure the indicator's parameters change in a stable, intelligent way.
Chapter 3: The Control Panel - A Granular Guide to the Inputs
Every input is a lever to tune the engine. Let's demystify them.
🧾 Signal Engine (Original): These inputs control the "Turning Point" signal logic.
What they are: Toggles for Reversal Mode (catch tops/bottoms) and Breakout Mode (follow the trend), plus filters like Require New Extreme to ensure signals come from points of extension.
How to use them: For a ranging market, you might favor Reversal mode. For a strongly trending market, Breakout mode might be better. These settings fine-tune the final alert, which is powered by the adaptive engine.
🎛️ Master Control:
Adaptation Intensity (dialK): THIS IS THE MOST IMPORTANT INPUT. It controls the personality of the learning engine.
Low Setting (1-5): Creates a "Wise Old Professor" engine. It's patient, learns from larger batches of data, and makes slow, deliberate, and highly confident adjustments. Use this for stable assets like indices or blue-chip stocks.
High Setting (15-20): Creates a "Hyper-Reactive Day Trader" engine. It learns from tiny samples, trusts its gut instinct, and makes large, aggressive adjustments to keep up with a frantic market. Use this for highly volatile assets like crypto or meme stocks.
🧠 Adaptive Engine & 🎯 Learning:
What they are: The deep mechanics of the learning process. Base Learn Rate is the fundamental step size of adjustments. Rolling Window Size is the length of its "short-term memory." Adaptation Momentum controls how smoothly the parameters transition to their new learned values.
How to use them: For most users, the defaults are well-balanced. Advanced users can tweak these to make the engine even more or less sensitive to new information.
🗺️ Cognitive Map, STM & Checkpoints:
What they are: Controls for the engine's brain. Enable Cognitive Map turns on the long-term memory.
The Checkpoint System - Your "Save Game" Feature: This is incredibly powerful.
To Save: Toggle Emit Checkpoint Now. Go to your alert log, and you will see a very long string of text. Copy this entire string.
To Load: Paste that string into the Memory Checkpoint input box. Toggle Apply Checkpoint On Next Bar. The script will instantly load its entire "brain"—every learned parameter and all 64 cells of the Cognitive Map. You can train the engine on one chart and transfer its intelligence to another.
Chapter 4: The Command Center - Decoding the Dashboard
This is your window into the engine's mind. Do not be intimidated. Let's break it down.
PANEL A (INFLECTION NEXUS): The high-level overview.
Market Context: See how the engine classifies the market's Trend and Regime (personality).
Shadow Portfolio Summary: The engine's report card. Watch the Win Rate and Avg P&L to see the quality of the raw data it's learning from.
PANEL B (SHADOW PORTFOLIO ADAPTIVE): The deep diagnostics.
Performance Metrics: Advanced stats like Sharpe Ratio (return vs. risk) and Sortino Ratio (return vs. downside risk). This tells you about the quality and consistency of the market movements the engine is analyzing.
Adaptive Parameters (Live vs Base): THIS IS THE MOST IMPORTANT SECTION. It shows the engine's Live parameters right next to your (Base) inputs.
How to interpret it: If you see the Live ATR Len is 45 while your Base input is 20, the engine is telling you: "The market is in a long, smooth trend right now. Short-term noise is a trap. I have learned that we must use a longer-term perspective to see clearly." This section translates the engine's learning directly into actionable insight.
Memory Log: A live ticker of the engine's thoughts, showing every trade it learns from and every adaptation it makes.
Chapter 5: Reading the Canvas - On-Chart Visuals
The Bands (Green/Blue Lines): These are not static Supertrend lines. They are the
physical manifestation of the engine's current thinking. As the engine learns and adapts its ATR Period and Multiplier, you will see these bands widen, tighten, and adjust their distance from price. They are alive.
The Labels (BUY/SELL): These are the final output of the "Turning Point" logic, now supercharged and informed by the fully adaptive SPA engine.
The Purple Pulse (Dot and Background Glow): This is your visual cue that the engine is "thinking." Every time you see this pulse, it means the SPA has just completed a learning cycle and updated its parameters. It is actively recalibrating itself to the market.
Chapter 6: A Personal Manifesto on Innovation
I want to conclude with a personal note on why I dedicate countless hours to building systems like this and sharing them openly.
My purpose is to drive innovation, period. I am not in this space to follow the crowd or to re-package old ideas. The world does not need a 100th version of a slightly modified MACD. Real progress comes from venturing into the wilderness, from asking difficult questions, and from pursuing concepts that lie at the very edge of possibility.
I am not afraid of being wrong. I am not afraid of being bested by my peers. In fact, I welcome it. If another developer takes an idea from this engine, improves it, and builds something even more magnificent, that is a profound win for our entire community. The only failure I recognize is the failure to try. The only trap I fear is the creative complacency of producing sterile, recycled work just to appease the status quo.
I love this community, and I believe with every fiber of my being that we have barely scratched the surface of what can be discovered and created. This script is my contribution to that shared journey. It is a tool, an idea, and a challenge to all of us: let's keep pushing.
DISCLAIMER: This script is an experimental framework provided for educational and research purposes ONLY. It is not financial advice. All trading involves substantial risk of loss. Past performance is not indicative of future results. Please use this tool responsibly and as part of a comprehensive trading plan.
As the great computer scientist Herbert A. Simon, a pioneer of artificial intelligence, famously said:
"Learning is any process by which a system improves performance from experience."
May this engine enhance your experience.
— Dskyz, for DAFE Trading Systems
อินดิเคเตอร์และกลยุทธ์
Alts VS OTHERSPlots Current alt chart against OTHERS index. casdsaddddddd dfvbcbvvc rthhhhhhhhhfghgfh fghfghfg hfghfghfghfgh
SmartSkull 15 minutes//@version=5
indicator("LegendGPT – First 15m Extremes + Second 15m Breakout FVG + Alerts", overlay=true, max_boxes_count=500)
// SETTINGS
boxColor = input.color(color.new(color.gray, 85), "Opening Box Color")
fvgBullColor = input.color(color.new(color.green, 85), "Bullish FVG Color")
fvgBearColor = input.color(color.new(color.red, 85), "Bearish FVG Color")
sessionTZ = "America/New_York"
nasdaqOpenHour = 9
nasdaqOpenMinute = 30
// 15m data for box
time15_tf = request.security(syminfo.tickerid, "15", time, lookahead=barmerge.lookahead_on)
high15_tf = request.security(syminfo.tickerid, "15", high, lookahead=barmerge.lookahead_on)
low15_tf = request.security(syminfo.tickerid, "15", low, lookahead=barmerge.lookahead_on)
// First 15m candle start
isFirst15mActive = (hour(time15_tf, sessionTZ) == nasdaqOpenHour and minute(time15_tf, sessionTZ) == nasdaqOpenMinute)
isSecond15mActive = (hour(time15_tf, sessionTZ) == nasdaqOpenHour and minute(time15_tf, sessionTZ) == nasdaqOpenMinute + 15)
// STATE VARS
var box openingRangeBox = na
var float session1mHigh = na
var int session1mHighBar = na
var float session1mLow = na
var int session1mLowBar = na
var bool extremesMarked = false
var bool bullBreakout = false
var bool bearBreakout = false
var bool fvgDrawn = false
var box fvgBox = na
var label fvgFilledLabel = na
newDay = time("D", sessionTZ) != time("D", sessionTZ)
// RESET DAILY
if newDay
if not na(openingRangeBox)
box.delete(openingRangeBox)
if not na(fvgBox)
box.delete(fvgBox)
if not na(fvgFilledLabel)
label.delete(fvgFilledLabel)
session1mHigh := na
session1mHighBar := na
session1mLow := na
session1mLowBar := na
extremesMarked := false
bullBreakout := false
bearBreakout := false
fvgDrawn := false
// Only run on 1-minute timeframe
if timeframe.multiplier == 1
// CREATE OPENING RANGE BOX for first 15m
if isFirst15mActive and na(openingRangeBox)
openingRangeBox := box.new(left=bar_index, top=high15_tf, right=bar_index + 15, bottom=low15_tf, bgcolor=boxColor, border_color=color.new(color.black, 90))
// Track highest/lowest 1m candle during first 15m
if isFirst15mActive
if na(session1mHigh)
session1mHigh := high
session1mHighBar := bar_index
session1mLow := low
session1mLowBar := bar_index
else
if high > session1mHigh
session1mHigh := high
session1mHighBar := bar_index
if low < session1mLow
session1mLow := low
session1mLowBar := bar_index
// When first 15m ends, mark extremes
if isFirst15mActive and not isFirst15mActive and not extremesMarked
// Green box for highest 1m candle
box.new(left=session1mHighBar, top=session1mHigh, right=session1mHighBar + 1, bottom=session1mHigh, border_color=color.green, bgcolor=color.new(color.green, 80))
// Red box for lowest 1m candle
box.new(left=session1mLowBar, top=session1mLow, right=session1mLowBar + 1, bottom=session1mLow, border_color=color.red, bgcolor=color.new(color.red, 80))
extremesMarked := true
// SECOND 15m: Check breakout of high/low
if isSecond15mActive
// Bullish breakout
if not bullBreakout and high > session1mHigh
bullBreakout := true
bearBreakout := false
alert("LegendGPT: Bullish Breakout above first 15m high", alert.freq_once_per_bar)
// Bearish breakout
if not bearBreakout and low < session1mLow
bearBreakout := true
bullBreakout := false
alert("LegendGPT: Bearish Breakout below first 15m low", alert.freq_once_per_bar)
// After breakout in second 15m, look for first FVG
if isSecond15mActive and not fvgDrawn
// Bullish FVG condition
if bullBreakout and low > high
fvgBox := box.new(left=bar_index - 1, top=high , right=bar_index, bottom=low, bgcolor=fvgBullColor, border_color=color.green)
fvgDrawn := true
alert("LegendGPT: Bullish FVG formed after breakout", alert.freq_once_per_bar)
// Bearish FVG condition
if bearBreakout and high < low
fvgBox := box.new(left=bar_index - 1, top=high, right=bar_index, bottom=low , bgcolor=fvgBearColor, border_color=color.red)
fvgDrawn := true
alert("LegendGPT: Bearish FVG formed after breakout", alert.freq_once_per_bar)
// PERSISTENT FVG: delete when filled
if not na(fvgBox)
fvgTop = box.get_top(fvgBox)
fvgBottom = box.get_bottom(fvgBox)
if high >= fvgBottom and low <= fvgTop
box.delete(fvgBox)
fvgBox := na
fvgDrawn := false
if not na(fvgFilledLabel)
label.delete(fvgFilledLabel)
fvgFilledLabel := label.new(bar_index, close, text="FVG filled", style=label.style_label_center, color=color.blue, textcolor=color.white, size=size.tiny)
alert("LegendGPT: FVG filled (mitigation)", alert.freq_once_per_bar)
ZigzagLiteLibrary "ZigzagLite"
Lighter version of the Zigzag Library. Without indicators and sub-component divisions
method getPrices(pivots)
Gets the array of prices from array of Pivots
Namespace types: array
Parameters:
pivots (array) : array array of Pivot objects
Returns: array array of pivot prices
method getBars(pivots)
Gets the array of bars from array of Pivots
Namespace types: array
Parameters:
pivots (array) : array array of Pivot objects
Returns: array array of pivot bar indices
method getPoints(pivots)
Gets the array of chart.point from array of Pivots
Namespace types: array
Parameters:
pivots (array) : array array of Pivot objects
Returns: array array of pivot points
method getPoints(this)
Gets the array of chart.point from Zigzag Object
Namespace types: Zigzag
Parameters:
this (Zigzag) : Zigzag object
Returns: array array of pivot points
method calculate(this, ohlc, ltfHighTime, ltfLowTime)
Calculate zigzag based on input values and indicator values
Namespace types: Zigzag
Parameters:
this (Zigzag) : Zigzag object
ohlc (array) : Array containing OHLC values. Can also have custom values for which zigzag to be calculated
ltfHighTime (int) : Used for multi timeframe zigzags when called within request.security. Default value is current timeframe open time.
ltfLowTime (int) : Used for multi timeframe zigzags when called within request.security. Default value is current timeframe open time.
Returns: current Zigzag object
method calculate(this)
Calculate zigzag based on properties embedded within Zigzag object
Namespace types: Zigzag
Parameters:
this (Zigzag) : Zigzag object
Returns: current Zigzag object
method nextlevel(this)
Calculate Next Level Zigzag based on the current calculated zigzag object
Namespace types: Zigzag
Parameters:
this (Zigzag) : Zigzag object
Returns: Next Level Zigzag object
method clear(this)
Clears zigzag drawings array
Namespace types: array
Parameters:
this (array) : array
Returns: void
method clear(this)
Clears zigzag drawings array
Namespace types: array
Parameters:
this (array) : array
Returns: void
method drawplain(this)
draws fresh zigzag based on properties embedded in ZigzagDrawing object without trying to calculate
Namespace types: ZigzagDrawing
Parameters:
this (ZigzagDrawing) : ZigzagDrawing object
Returns: ZigzagDrawing object
method drawplain(this)
draws fresh zigzag based on properties embedded in ZigzagDrawingPL object without trying to calculate
Namespace types: ZigzagDrawingPL
Parameters:
this (ZigzagDrawingPL) : ZigzagDrawingPL object
Returns: ZigzagDrawingPL object
method drawfresh(this, ohlc)
draws fresh zigzag based on properties embedded in ZigzagDrawing object
Namespace types: ZigzagDrawing
Parameters:
this (ZigzagDrawing) : ZigzagDrawing object
ohlc (array) : values on which the zigzag needs to be calculated and drawn. If not set will use regular OHLC
Returns: ZigzagDrawing object
method drawcontinuous(this, ohlc)
draws zigzag based on the zigzagmatrix input
Namespace types: ZigzagDrawing
Parameters:
this (ZigzagDrawing) : ZigzagDrawing object
ohlc (array) : values on which the zigzag needs to be calculated and drawn. If not set will use regular OHLC
Returns:
PivotCandle
PivotCandle represents data of the candle which forms either pivot High or pivot low or both
Fields:
_high (series float) : High price of candle forming the pivot
_low (series float) : Low price of candle forming the pivot
length (series int) : Pivot length
pHighBar (series int) : represents number of bar back the pivot High occurred.
pLowBar (series int) : represents number of bar back the pivot Low occurred.
pHigh (series float) : Pivot High Price
pLow (series float) : Pivot Low Price
Pivot
Pivot refers to zigzag pivot. Each pivot can contain various data
Fields:
point (chart.point) : pivot point coordinates
dir (series int) : direction of the pivot. Valid values are 1, -1, 2, -2
level (series int) : is used for multi level zigzags. For single level, it will always be 0
ratio (series float) : Price Ratio based on previous two pivots
sizeRatio (series float) : ratio of current zigzag wave size in comparison to last zigzag wave in the same direction
barRatio (series float) : Bar Ratio based on previous two pivots
ZigzagFlags
Flags required for drawing zigzag. Only used internally in zigzag calculation. Should not set the values explicitly
Fields:
newPivot (series bool) : true if the calculation resulted in new pivot
doublePivot (series bool) : true if the calculation resulted in two pivots on same bar
updateLastPivot (series bool) : true if new pivot calculated replaces the old one.
Zigzag
Zigzag object which contains whole zigzag calculation parameters and pivots
Fields:
length (series int) : Zigzag length. Default value is 5
numberOfPivots (series int) : max number of pivots to hold in the calculation. Default value is 20
offset (series int) : Bar offset to be considered for calculation of zigzag. Default is 0 - which means calculation is done based on the latest bar.
level (series int) : Zigzag calculation level - used in multi level recursive zigzags
zigzagPivots (array) : array which holds the last n pivots calculated.
flags (ZigzagFlags) : ZigzagFlags object which is required for continuous drawing of zigzag lines.
ZigzagObject
Zigzag Drawing Object
Fields:
zigzagLine (series line) : Line joining two pivots
zigzagLabel (series label) : Label which can be used for drawing the values, ratios, directions etc.
ZigzagProperties
Object which holds properties of zigzag drawing. To be used along with ZigzagDrawing
Fields:
lineColor (series color) : Zigzag line color. Default is color.blue
lineWidth (series int) : Zigzag line width. Default is 1
lineStyle (series string) : Zigzag line style. Default is line.style_solid.
showLabel (series bool) : If set, the drawing will show labels on each pivot. Default is false
textColor (series color) : Text color of the labels. Only applicable if showLabel is set to true.
maxObjects (series int) : Max number of zigzag lines to display. Default is 300
xloc (series string) : Time/Bar reference to be used for zigzag drawing. Default is Time - xloc.bar_time.
curved (series bool) : Boolean field to print curved zigzag - used only with polyline implementation
force_overlay (series bool) : force drawing in price overlay
ZigzagDrawing
Object which holds complete zigzag drawing objects and properties.
Fields:
zigzag (Zigzag) : Zigzag object which holds the calculations.
properties (ZigzagProperties) : ZigzagProperties object which is used for setting the display styles of zigzag
drawings (array) : array which contains lines and labels of zigzag drawing.
ZigzagDrawingPL
Object which holds complete zigzag drawing objects and properties - polyline version
Fields:
zigzag (Zigzag) : Zigzag object which holds the calculations.
properties (ZigzagProperties) : ZigzagProperties object which is used for setting the display styles of zigzag
zigzagLabels (array)
zigzagLine (series polyline) : polyline object of zigzag lines
EMA Volume Confluence + Trend Bands[BBM]# EMA Volume Confluence + Trend Bands Indicator
## Overview
A professional day trading indicator designed to eliminate false breakouts and early entries by combining multiple confirmation signals. Perfect for futures and crypto traders holding positions 1-2 days max.
## What It Does
- **Filters out false signals** by requiring EMA crossovers, volume spikes, VWAP confirmation, AND momentum alignment
- **Shows volatility-based trend bands** to identify genuine breakouts vs noise
- **Provides clear entry signals** only when ALL conditions align
- **Real-time metrics dashboard** showing RSI, volume, VWAP position, and band status
## Signal Types
- **LONG/SHORT triangles**: High-probability EMA cross entries with full confirmation
- **BO (Breakout) crosses**: Volatility expansion breakouts with volume support
- **Yellow background**: Volume spike in progress - watch for signals
- **Colored bands**: Trade inside the channel or wait for confirmed breakouts
## Recommended Settings
### For Crypto (High Volatility)
- **Volume Spike Multiplier**: 2.0x (crypto has bigger spikes)
- **Band Multiplier**: 2.5-3.0 (wider bands for volatility)
- **Best Timeframes**: 5min, 15min
- **RSI Settings**: Keep default (70/30)
### For Futures (E-mini, Oil, Gold)
- **Volume Spike Multiplier**: 1.3-1.5x (tighter volume filter)
- **Band Multiplier**: 1.5-2.0 (narrower for cleaner signals)
- **Best Timeframes**: 1min, 5min, 15min
- **RSI Settings**: Keep default (70/30)
### For Swing/Position (1-2 day holds)
- **Volume Spike Multiplier**: 1.5x
- **Band Multiplier**: 2.0
- **Best Timeframes**: 1H, 4H
- **Consider**: Adjust RSI to 65/35 for less filtering on larger timeframes
## Pro Tips
1. **Best trades**: LONG/SHORT signals that appear right as price touches the bands
2. **Avoid**: Signals when RSI is extended (red/green in table)
3. **Volume is key**: No yellow background = probably skip the signal
4. **VWAP acts as bias**: Above = favor longs, Below = favor shorts
5. **Band breakouts (BO)**: These are your highest conviction momentum plays
## Risk Management
- Use the Band Multiplier (ATR-based) to gauge volatility
- "Above/Below" band position = extended move, consider taking profits
- "Inside" band position = consolidation, best for entries
- Higher volume multiplier = fewer but higher quality signals
## Alert Setup
Set alerts for:
- "Long Entry" - Full EMA setup
- "Short Entry" - Full EMA setup
- "Breakout Long" - Band breakout with volume
- "Breakout Short" - Band breakdown with volume
---
**Note**: This indicator prioritizes quality over quantity. You'll get fewer signals, but they have much better win rates because they require multiple confirmations. Perfect for traders tired of getting whipsawed by false breakouts!
SuperSmoother MA OscillatorSuperSmoother MA Oscillator - Ehlers-Inspired Lag-Minimized Signal Framework
Overview
The SuperSmoother MA Oscillator is a crossover and momentum detection framework built on the pioneering work of John F. Ehlers, who introduced digital signal processing (DSP) concepts into technical analysis. Traditional moving averages such as SMA and EMA are prone to two persistent flaws: excessive lag, which delays recognition of trend shifts, and high-frequency noise, which produces unreliable whipsaw signals. Ehlers’ SuperSmoother filter was designed to specifically address these flaws by creating a low-pass filter with minimal lag and superior noise suppression, inspired by engineering methods used in communications and radar systems.
This oscillator extends Ehlers’ foundation by combining the SuperSmoother filter with multi-length moving average oscillation, ATR-based normalization, and dynamic color coding. The result is a tool that helps traders identify market momentum, detect reliable crossovers earlier than conventional methods, and contextualize volatility and phase shifts without being distracted by transient price noise.
Unlike conventional oscillators, which either oversimplify price structure or overload the chart with reactive signals, the SuperSmoother MA Oscillator is designed to balance responsiveness and stability. By preprocessing price data with the SuperSmoother filter, traders gain a signal framework that is clean, robust, and adaptable across assets and timeframes.
Theoretical Foundation
Traditional MA oscillators such as MACD or dual-EMA systems react to raw or lightly smoothed price inputs. While effective in some conditions, these signals are often distorted by high-frequency oscillations inherent in market data, leading to false crossovers and poor timing. The SuperSmoother approach modifies this dynamic: by attenuating unwanted frequencies, it preserves structural price movements while eliminating meaningless noise.
This is particularly useful for traders who need to distinguish between genuine market cycles and random short-term price flickers. In practical terms, the oscillator helps identify:
Early trend continuations (when fast averages break cleanly above/below slower averages).
Preemptive breakout setups (when compressed oscillator ranges expand).
Exhaustion phases (when oscillator swings flatten despite continued price movement).
Its multi-purpose design allows traders to apply it flexibly across scalping, day trading, swing setups, and longer-term trend positioning, without needing separate tools for each.
The oscillator’s visual system - fast/slow lines, dynamic coloration, and zero-line crossovers - is structured to provide trend clarity without hiding nuance. Strong green/red momentum confirms directional conviction, while neutral gray phases emphasize uncertainty or low conviction. This ensures traders can quickly gauge the market state without losing access to subtle structural signals.
How It Works
The SuperSmoother MA Oscillator builds signals through a layered process:
SuperSmoother Filtering (Ehlers’ Method)
At its core lies Ehlers’ two-pole recursive filter, mathematically engineered to suppress high-frequency components while introducing minimal lag. Compared to traditional EMA smoothing, the SuperSmoother achieves better spectral separation - it allows meaningful cyclical market structures to pass through, while eliminating erratic spikes and aliasing. This makes it a superior preprocessing stage for oscillator inputs.
Fast and Slow Line Construction
Within the oscillator framework, the filtered price series is used to build two internal moving averages: a fast line (short-term momentum) and a slow line (longer-term directional bias). These are not plotted directly on the chart - instead, their relationship is transformed into the oscillator values you see.
The interaction between these two internal averages - crossovers, separation, and compression - forms the backbone of trend detection:
Uptrend Signal : Fast MA rises above the slow MA with expanding distance, generating a positive oscillator swing.
Downtrend Signal : Fast MA falls below the slow MA with widening divergence, producing a negative oscillator swing.
Neutral/Transition : Lines compress, flattening the oscillator near zero and often preceding volatility expansion.
This design ensures traders receive the information content of dual-MA crossovers while keeping the chart visually clean and focused on the oscillator’s dynamics.
ATR-Based Normalization
Markets vary in volatility. To ensure the oscillator behaves consistently across assets, ATR (Average True Range) normalization scales outputs relative to prevailing volatility conditions. This prevents the oscillator from appearing overly sensitive in calm markets or too flat during high-volatility regimes.
Dynamic Color Coding
Color transitions reflect underlying market states:
Strong Green : Bullish alignment, momentum expanding.
Strong Red : Bearish alignment, momentum expanding.
These visual cues allow traders to quickly gauge trend direction and strength at a glance, with expanding colors indicating increasing conviction in the underlying momentum.
Interpretation
The oscillator offers a multi-dimensional view of price dynamics:
Trend Analysis : Fast/slow line alignment and zero-line interactions reveal trend direction and strength. Expansions indicate momentum building; contractions flag weakening conditions or potential reversals.
Momentum & Volatility : Rapid divergence between lines reflects increasing momentum. Compression highlights periods of reduced volatility and possible upcoming expansion.
Cycle Awareness : Because of Ehlers’ DSP foundation, the oscillator captures market cycles more cleanly than conventional MA systems, allowing traders to anticipate turning points before raw price action confirms them.
Divergence Detection : When oscillator momentum fades while price continues in the same direction, it signals exhaustion - a cue to tighten stops or anticipate reversals.
By focusing on filtered, volatility-adjusted signals, traders avoid overreacting to noise while gaining early access to structural changes in momentum.
Strategy Integration
The SuperSmoother MA Oscillator adapts across multiple trading approaches:
Trend Following
Enter when fast/slow alignment is strong and expanding:
A fast line crossing above the slow line with expanding green signals confirms bullish continuation.
Use ATR-normalized expansion to filter entries in line with prevailing volatility.
Breakout Trading
Periods of compression often precede breakouts:
A breakout occurs when fast lines diverge decisively from slow lines with renewed green/red strength.
Exhaustion and Reversals
Oscillator divergence signals weakening trends:
Flattening momentum while price continues trending may indicate overextension.
Traders can exit or hedge positions in anticipation of corrective phases.
Multi-Timeframe Confluence
Apply the oscillator on higher timeframes to confirm the directional bias.
Use lower timeframes for refined entries during compression → expansion transitions.
Technical Implementation Details
SuperSmoother Algorithm (Ehlers) : Recursive two-pole filter minimizes lag while removing high-frequency noise.
Oscillator Framework : Fast/slow MAs derived from filtered prices.
ATR Normalization : Ensures consistent amplitude across market regimes.
Dynamic Color Engine : Aligns visual cues with structural states (expansion and contraction).
Multi-Factor Analysis : Combines crossover logic, volatility context, and cycle detection for robust outputs.
This layered approach ensures the oscillator is highly responsive without overloading charts with noise.
Optimal Application Parameters
Asset-Specific Guidance:
Forex : Normalize with moderate ATR scaling; focus on slow-line confirmation.
Equities : Balance responsiveness with smoothing; useful for capturing sector rotations.
Cryptocurrency : Higher ATR multipliers recommended due to volatility.
Futures/Indices : Lower frequency settings highlight structural trends.
Timeframe Optimization:
Scalping (1-5min) : Higher sensitivity, prioritize fast-line signals.
Intraday (15m-1h) : Balance between fast/slow expansions.
Swing (4h-Daily) : Focus on slow-line momentum with fast-line timing.
Position (Daily-Weekly) : Slow lines dominate; fast lines highlight cycle shifts.
Performance Characteristics
High Effectiveness:
Trending environments with moderate-to-high volatility.
Assets with steady liquidity and clear cyclical structures.
Reduced Effectiveness:
Flat/choppy conditions with little directional bias.
Ultra-short timeframes (<1m), where noise dominates.
Integration Guidelines
Confluence : Combine with liquidity zones, order blocks, and volume-based indicators for confirmation.
Risk Management : Place stops beyond slow-line thresholds or ATR-defined zones.
Dynamic Trade Management : Use expansions/contractions to scale position sizes or tighten stops.
Multi-Timeframe Confirmation : Filter lower-timeframe entries with higher-timeframe momentum states.
Disclaimer
The SuperSmoother MA Oscillator is an advanced trend and momentum analysis tool, not a guaranteed profit system. Its effectiveness depends on proper parameter settings per asset and disciplined risk management. Traders should use it as part of a broader technical framework and not in isolation.
Best Indicators for Day Trading//@version=5
indicator("Best Indicators for Day Trading", shorttitle="Day Trading Indicators", overlay= true)
//---------------------------- MA's ----------------------------//
priceSource = input.source(close, title='Price Source For The Moving Averages', group='Moving Average')
IgnoreExtendedHours = input.bool(true, title='Ignore Extended Hours', group='Moving Average')
resolution = timeframe.period
price = request.security(syminfo.tickerid, resolution, priceSource)
shortMAPeriod = input.int(8, title='MA 1', group='Moving Average', inline='short')
shortMAType = input.string(defval='EMA', title='', confirm=false, options= , group='Moving Average', inline='short')
longMAPeriod = input.int(21, title='MA 2', group='Moving Average', inline='long')
longMAType = input.string(defval='EMA', title='', confirm=false, options= , group='Moving Average', inline='long')
i_timeframe_signal = input.timeframe(title='Crossover MAs Timeframe', defval='', group='Moving Average')
useTextLabels = input.bool(true, title='Use Text-Based Crossover Labels?', group='Moving Average')
showBonusMA1 = input.bool(true, title='Bonus MA', group='Moving Average', inline='bma1')
bonusMA1Period = input.int(34, title='',group='Moving Average', inline='bma1')
bonus1MAType = input.string(defval='EMA', title='', confirm=false, options= , group='Moving Average', inline='bma1')
i_timeframe_bma1 = input.timeframe(title='', defval='', group='Moving Average', inline='bma1')
ZLMASmooth = 3
f_security(_sym, _res, _src) =>
request.security(_sym, _res, _src , barmerge.gaps_off, lookahead=barmerge.lookahead_off)
ticker = ticker.new(syminfo.prefix, syminfo.ticker, IgnoreExtendedHours ? session.regular : syminfo.session)
// MA calculation
short = shortMAType == 'SMA' ? f_security(ticker, i_timeframe_signal, ta.sma(price, shortMAPeriod)) : shortMAType == 'EMA' ? f_security(ticker, i_timeframe_signal, ta.ema(price, shortMAPeriod)) : shortMAType == 'WMA' ? f_security(ticker, i_timeframe_signal, ta.wma(price, shortMAPeriod)) : shortMAType == 'HMA' ? f_security(ticker, i_timeframe_signal, ta.hma(price, shortMAPeriod)) : shortMAType == 'ALMA' ? f_security(ticker, i_timeframe_signal, ta.alma(price, shortMAPeriod, 0.85, 6)) : shortMAType == 'LIN' ? f_security(ticker, i_timeframe_signal, ta.linreg(price, shortMAPeriod, 0)) : shortMAType == 'ZLMA' ? f_security(ticker, i_timeframe_signal, 2 * ta.wma(ta.wma(price, shortMAPeriod), ZLMASmooth) - ta.wma(ta.wma(ta.wma(price, shortMAPeriod), ZLMASmooth), shortMAPeriod)) : na
long = longMAType == 'SMA' ? f_security(ticker, i_timeframe_signal, ta.sma(price, longMAPeriod)) : longMAType == 'EMA' ? f_security(ticker, i_timeframe_signal, ta.ema(price, longMAPeriod)) : longMAType == 'WMA' ? f_security(ticker, i_timeframe_signal, ta.wma(price, longMAPeriod)) : longMAType == 'HMA' ? f_security(ticker, i_timeframe_signal, ta.hma(price, longMAPeriod)) : longMAType == 'ALMA' ? f_security(ticker, i_timeframe_signal, ta.alma(price, longMAPeriod, 0.85, 6)) : longMAType == 'LIN' ? f_security(ticker, i_timeframe_signal, ta.linreg(price, longMAPeriod, 0)) : longMAType == 'ZLMA' ? f_security(ticker, i_timeframe_signal, 2 * ta.wma(ta.wma(price, longMAPeriod), ZLMASmooth) - ta.wma(ta.wma(ta.wma(price, longMAPeriod), ZLMASmooth), longMAPeriod)) : na
bonus1 = bonus1MAType == 'SMA' ? f_security(ticker, i_timeframe_bma1, ta.sma(price, bonusMA1Period)) : bonus1MAType == 'EMA' ? f_security(ticker, i_timeframe_bma1, ta.ema(price, bonusMA1Period)) : bonus1MAType == 'WMA' ? f_security(ticker, i_timeframe_bma1, ta.wma(price, bonusMA1Period)) : bonus1MAType == 'HMA' ? f_security(ticker, i_timeframe_bma1, ta.hma(price, bonusMA1Period)) : bonus1MAType == 'ALMA' ? f_security(ticker, i_timeframe_bma1, ta.alma(price, bonusMA1Period, 0.85, 6)) : bonus1MAType == 'LIN' ? f_security(ticker, i_timeframe_bma1, ta.linreg(price, bonusMA1Period, 0)) : bonus1MAType == 'ZLMA' ? f_security(ticker, i_timeframe_bma1, 2 * ta.wma(ta.wma(price, bonusMA1Period), ZLMASmooth) - ta.wma(ta.wma(ta.wma(price, bonusMA1Period), ZLMASmooth), bonusMA1Period)) : na
// trend direction/color
TrendingUp() =>
short > long
TrendingDown() =>
short < long
Uptrend() =>
TrendingUp() and TrendingDown()
Downtrend() =>
TrendingDown() and TrendingUp()
trendColor = TrendingUp() ? color.new(color.green, 85) : TrendingDown() ? color.new(color.red, 85) : color.new(color.blue, 85)
MA1 = plot(short, title='Short Period Moving Average', color=color.fuchsia, linewidth=2, style=plot.style_line)
MA2 = plot(long, title='Long Period Moving Average', color=color.navy, linewidth=1, style=plot.style_line)
fill(MA1, MA2, color=trendColor, title='Short/Long Divergence Fill')
plot(showBonusMA1 ? bonus1 : na, title='MA 3', color=color.white, linewidth=1, style=plot.style_line)
// Short & Long Moving Averages cross alert
MAcrossing = ta.cross(short, long) ? short : na
plot(MAcrossing , title='Calls/Puts Crossing Icon', style=plot.style_cross, linewidth=3, color=trendColor)
// Bull and Bear Alerts
Bull = ta.crossover(short, long)
Bear = ta.crossunder(short, long)
plotshape(Bull, title='Calls Label', color=color.new(color.green, 25), textcolor=useTextLabels ? color.white : color.new(color.white, 100), style=useTextLabels ? shape.labelup : shape.triangleup, text='Calls', location=location.belowbar)
plotshape(Bear, title='Puts Label', color=color.new(color.red, 25), textcolor=useTextLabels ? color.white : color.new(color.white, 100), style=useTextLabels ? shape.labeldown : shape.triangledown, text='Puts', location=location.abovebar)
if Bull
alert('Calls Alert: 8ema crossed over 21ema', alert.freq_once_per_bar_close)
if Bear
alert('Puts Alert: 8ema crossed under 21ema', alert.freq_once_per_bar_close)
//---------------------------- VWAP ----------------------------//
vwapprice = input(defval=hlc3, title="VWAP Source", group='VWAP')
enable_vwap = input(true, title="Enable VWAP", group='VWAP')
vwapResolution = input.timeframe(title = "VWAP Resolution", defval = "", group='VWAP')
vwapFunction = ta.vwap(vwapprice)
vwapSecurity = request.security(syminfo.tickerid, vwapResolution, vwapFunction)
plot(enable_vwap ? vwapSecurity : na, title="VWAP", color=color.yellow, linewidth=2, editable=true)
//---------------------------- FVG ----------------------------//
showFractals = input(false,title="Show Fractals?", group="Fair Value Gap")
showBrekout = input(false,title="Show Market Structure Breakouts?", group="Fair Value Gap")
breakType = input.string("Body",title="Fractal Break Type:",options= , group="Fair Value Gap")
n = input.int(title="Periods", defval=2, minval=2, group="Fair Value Gap")
showImbalance = input(true,title="Show Breakout Imbalances", group="Fair Value Gap")
showOtherImbalance = input(true,title="Show Other Imbalances", group="Fair Value Gap")
imbGreenClr = input.color(color.new(color.green,65),title="Up:",inline="i_1", group="Fair Value Gap")
imbRedClr = input.color(color.new(color.red,65),title="Down:",inline="i_1", group="Fair Value Gap")
imbRestClr = input.color(color.new(color.yellow,65), title="Other:",inline="i_1", group="Fair Value Gap")
showBoxes = input(false,title="Show OrderBlocks?", group="Fair Value Gap")
changeColor = input(false,title="Change OrderBlock Colors?", group="Fair Value Gap")
transGreenClr = input.color(color.new(color.green,80),title="Bg:",inline="a_1", group="Fair Value Gap")
greenClr = input.color(color.new(color.green,0),title="Border:",inline="a_1", group="Fair Value Gap")
transRedClr = input.color(color.new(color.red,80),title="Bg:",inline="b_1", group="Fair Value Gap")
redClr = input.color(color.new(color.red,0),title="Border:",inline="b_1", group="Fair Value Gap")
//Fractals{
// UpFractal
bool upflagDownFrontier = true
bool upflagUpFrontier0 = true
bool upflagUpFrontier1 = true
bool upflagUpFrontier2 = true
bool upflagUpFrontier3 = true
bool upflagUpFrontier4 = true
for i = 1 to n
upflagDownFrontier := upflagDownFrontier and (high < high )
upflagUpFrontier0 := upflagUpFrontier0 and (high < high )
upflagUpFrontier1 := upflagUpFrontier1 and (high <= high and high < high )
upflagUpFrontier2 := upflagUpFrontier2 and (high <= high and high <= high and high < high )
upflagUpFrontier3 := upflagUpFrontier3 and (high <= high and high <= high and high <= high and high < high )
upflagUpFrontier4 := upflagUpFrontier4 and (high <= high and high <= high and high <= high and high <= high and high < high )
flagUpFrontier = upflagUpFrontier0 or upflagUpFrontier1 or upflagUpFrontier2 or upflagUpFrontier3 or upflagUpFrontier4
upFractal = (upflagDownFrontier and flagUpFrontier)
//DownFractal
bool downflagDownFrontier = true
bool downflagUpFrontier0 = true
bool downflagUpFrontier1 = true
bool downflagUpFrontier2 = true
bool downflagUpFrontier3 = true
bool downflagUpFrontier4 = true
for i = 1 to n
downflagDownFrontier := downflagDownFrontier and (low > low )
downflagUpFrontier0 := downflagUpFrontier0 and (low > low )
downflagUpFrontier1 := downflagUpFrontier1 and (low >= low and low > low )
downflagUpFrontier2 := downflagUpFrontier2 and (low >= low and low >= low and low > low )
downflagUpFrontier3 := downflagUpFrontier3 and (low >= low and low >= low and low >= low and low > low )
downflagUpFrontier4 := downflagUpFrontier4 and (low >= low and low >= low and low >= low and low >= low and low > low )
flagDownFrontier = downflagUpFrontier0 or downflagUpFrontier1 or downflagUpFrontier2 or downflagUpFrontier3 or downflagUpFrontier4
downFractal = (downflagDownFrontier and flagDownFrontier)
//}
var float topValue = na, var float bottomValue = na
var int lastRedIndex = na, var float lastRedLow = na, var float lastRedHigh = na
var int lastGreenIndex = na, var float lastGreenLow = na, var float lastGreenHigh = na
var line topLine = na, var line bottomLine = na
var box demandBox = na, var box supplyBox = na
var box imbalanceBox = na
var bool checkUpImbalance = false
var bool checkDownImbalance = false
var topBreakBlock = false, var bottomBreakBlock = false
var isLongBreak = false, var isShortBreak = false
var arrBoxes = array.new_box(0)
topBreakCheckSource = breakType == "Wick+Body" ? high : close
bottomBreakCheckSource = breakType == "Wick+Body" ? low : close
//IMBALANCE
//Data
L1 = low
H3 = high
H1 = high
L3 = low
FVGUp = H3 < L1 ? 1 : 0
plotFVGU = FVGUp ? H3 : na
plotFVGUL = FVGUp ? L1 : na
FVGDown = L3 > H1 ? 1 : 0
plotFVGD = FVGDown ? L3 : na
plotFVGH = FVGDown ? H1 : na
if FVGUp and showOtherImbalance and checkUpImbalance == false
imbalanceBox := box.new(bar_index-2, plotFVGU,bar_index,plotFVGUL, bgcolor=imbRestClr, border_color=imbRestClr)
if FVGDown and showOtherImbalance and checkDownImbalance == false
imbalanceBox := box.new(bar_index-2, plotFVGH,bar_index,plotFVGD, bgcolor=imbRestClr, border_color=imbRestClr)
//Last red check
if close < open
lastRedIndex := bar_index
lastRedLow := low
lastRedHigh := high
//Last green check
if close > open
lastGreenIndex := bar_index
lastGreenLow := low
lastGreenHigh := high
//Check Imbalance
if checkUpImbalance
checkUpImbalance := false
imbTop = low
imbBottom = high
if imbTop > imbBottom and showImbalance
imbalanceBox := box.new(bar_index-2, imbTop,bar_index,imbBottom, bgcolor=imbGreenClr, border_color=imbGreenClr)
if checkDownImbalance
checkDownImbalance := false
imbTop = low
imbBottom = high
if imbTop > imbBottom and showImbalance
imbalanceBox := box.new(bar_index-2, imbTop,bar_index,imbBottom, bgcolor=imbRedClr, border_color=imbRedClr)
//Top break
if ta.crossover(topBreakCheckSource,topValue) and topBreakBlock == false
topBreakBlock := true
isLongBreak := true
checkUpImbalance := true
if showBrekout
line.set_x2(topLine,bar_index)
if showBoxes
demandBox := box.new(lastRedIndex-1, lastRedHigh,lastRedIndex+1,lastRedLow, bgcolor=transGreenClr, border_color=greenClr)
array.push(arrBoxes,demandBox)
//Bottom break
if ta.crossunder(bottomBreakCheckSource,bottomValue) and bottomBreakBlock == false
bottomBreakBlock := true
isShortBreak := true
checkDownImbalance := true
if showBrekout
line.set_x2(bottomLine,bar_index)
if showBoxes
supplyBox := box.new(lastGreenIndex-1, lastGreenHigh,lastGreenIndex+1,lastGreenLow, bgcolor=transRedClr, border_color=redClr)
array.push(arrBoxes,supplyBox)
//New up fractal
if upFractal
topBreakBlock := false
isLongBreak := false
topValue := high
if showBrekout
topLine := line.new(bar_index ,topValue,bar_index,topValue, color=color.teal, style=line.style_dotted, width=2)
if isLongBreak == false
line.delete(topLine )
//New down fractal
if downFractal
bottomBreakBlock := false
isShortBreak := false
bottomValue := low
if showBrekout
bottomLine := line.new(bar_index ,bottomValue,bar_index,bottomValue, color=color.maroon, style=line.style_dotted, width=2)
if isShortBreak == false
line.delete(bottomLine )
//Box state update
//activeBoxes = box.all
activeBoxes = arrBoxes
if array.size(activeBoxes) > 0 and changeColor
for i = 0 to array.size(activeBoxes) - 1
bVal = box.get_bottom(array.get(activeBoxes, i))
tVal = box.get_top(array.get(activeBoxes, i))
if close < bVal
box.set_bgcolor(array.get(activeBoxes, i),transRedClr)
box.set_border_color(array.get(activeBoxes, i),redClr)
if close > tVal
box.set_bgcolor(array.get(activeBoxes, i),transGreenClr)
box.set_border_color(array.get(activeBoxes, i),greenClr)
//PLOTS
plotshape(showFractals ? downFractal : na,style=shape.triangleup, location=location.belowbar, offset=-n, color=color.new(color.gray,80), size = size.tiny)
plotshape(showFractals ? upFractal : na, style=shape.triangledown, location=location.abovebar, offset=-n, color=color.new(color.gray,80), size = size.tiny)
//---------------------------- Bollinger Bands ----------------------------//
bbshow = input.bool(true, "Show Bollinger Bands?", group="Bollinger Bands")
bblength = input.int(20, minval=1, group="Bollinger Bands")
bbsrc = input(close, title="Source", group="Bollinger Bands")
bbmult = input.float(2.0, minval=0.001, maxval=50, title="StdDev", group="Bollinger Bands")
bbbasis = ta.sma(bbsrc, bblength)
bbdev = bbmult * ta.stdev(bbsrc, bblength)
bbupper = bbbasis + bbdev
bblower = bbbasis - bbdev
//Input Checkbox
basis_checkbok = input.bool(title="Basis", defval = true)
bboffset = input.int(0, "Offset", minval = -499, maxval = 500)
//Plot
plot(basis_checkbok ? bbbasis : na, "Basis", color=#872323, offset = bboffset)
p1 = plot(bbshow ? bbupper : na, "Upper", color=color.teal, offset = bboffset)
p2 = plot(bbshow ? bblower : na, color = color.teal)
fill(p1, p2, title = "Background", color=#198787)
//---------------------------- Support and Resistance ----------------------------//
prd = input.int(defval=10, title='Pivot Period', minval=4, maxval=30, group="S&R")
ppsrc = input.string(defval='High/Low', title='Source', options= , group="S&R")
maxnumpp = input.int(defval=20, title=' Maximum Number of Pivot', minval=5, maxval=100, group="S&R")
ChannelW = input.int(defval=10, title='Maximum Channel Width %', minval=1, group="S&R")
maxnumsr = input.int(defval=5, title=' Maximum Number of S/R', minval=1, maxval=10, group="S&R")
min_strength = input.int(defval=2, title=' Minimum Strength', minval=1, maxval=10, group="S&R")
labelloc = input.int(defval=20, title='Label Location', group="S&R", tooltip='Positive numbers reference future bars, negative numbers reference histical bars')
linestyle = input.string(defval='Dashed', title='Line Style', options= , group="S&R")
linewidth = input.int(defval=2, title='Line Width', minval=1, maxval=4, group="S&R")
resistancecolor = input.color(defval=color.red, title='Resistance Color', group="S&R")
supportcolor = input.color(defval=color.lime, title='Support Color', group="S&R")
showpp = input(false, title='Show Point Points')
float src1 = ppsrc == 'High/Low' ? high : math.max(close, open)
float src2 = ppsrc == 'High/Low' ? low : math.min(close, open)
float ph = ta.pivothigh(src1, prd, prd)
float pl = ta.pivotlow(src2, prd, prd)
plotshape(ph and showpp, text='H', style=shape.labeldown, color=na, textcolor=color.new(color.red, 0), location=location.abovebar, offset=-prd)
plotshape(pl and showpp, text='L', style=shape.labelup, color=na, textcolor=color.new(color.lime, 0), location=location.belowbar, offset=-prd)
Lstyle = linestyle == 'Dashed' ? line.style_dashed : linestyle == 'Solid' ? line.style_solid : line.style_dotted
//calculate maximum S/R channel zone width
prdhighest = ta.highest(300)
prdlowest = ta.lowest(300)
cwidth = (prdhighest - prdlowest) * ChannelW / 100
var pivotvals = array.new_float(0)
if ph or pl
array.unshift(pivotvals, ph ? ph : pl)
if array.size(pivotvals) > maxnumpp // limit the array size
array.pop(pivotvals)
get_sr_vals(ind) =>
float lo = array.get(pivotvals, ind)
float hi = lo
int numpp = 0
for y = 0 to array.size(pivotvals) - 1 by 1
float cpp = array.get(pivotvals, y)
float wdth = cpp <= lo ? hi - cpp : cpp - lo
if wdth <= cwidth // fits the max channel width?
lo := cpp <= lo ? cpp : lo
hi := cpp > lo ? cpp : hi
numpp += 1
numpp
var sr_up_level = array.new_float(0)
var sr_dn_level = array.new_float(0)
sr_strength = array.new_float(0)
find_loc(strength) =>
ret = array.size(sr_strength)
for i = ret > 0 ? array.size(sr_strength) - 1 : na to 0 by 1
if strength <= array.get(sr_strength, i)
break
ret := i
ret
ret
check_sr(hi, lo, strength) =>
ret = true
for i = 0 to array.size(sr_up_level) > 0 ? array.size(sr_up_level) - 1 : na by 1
//included?
if array.get(sr_up_level, i) >= lo and array.get(sr_up_level, i) <= hi or array.get(sr_dn_level, i) >= lo and array.get(sr_dn_level, i) <= hi
if strength >= array.get(sr_strength, i)
array.remove(sr_strength, i)
array.remove(sr_up_level, i)
array.remove(sr_dn_level, i)
ret
else
ret := false
ret
break
ret
var sr_lines = array.new_line(11, na)
var sr_labels = array.new_label(11, na)
for x = 1 to 10 by 1
rate = 100 * (label.get_y(array.get(sr_labels, x)) - close) / close
label.set_text(array.get(sr_labels, x), text=str.tostring(label.get_y(array.get(sr_labels, x))) + '(' + str.tostring(rate, '#.##') + '%)')
label.set_x(array.get(sr_labels, x), x=bar_index + labelloc)
label.set_color(array.get(sr_labels, x), color=label.get_y(array.get(sr_labels, x)) >= close ? color.red : color.lime)
label.set_textcolor(array.get(sr_labels, x), textcolor=label.get_y(array.get(sr_labels, x)) >= close ? color.white : color.black)
label.set_style(array.get(sr_labels, x), style=label.get_y(array.get(sr_labels, x)) >= close ? label.style_label_down : label.style_label_up)
line.set_color(array.get(sr_lines, x), color=line.get_y1(array.get(sr_lines, x)) >= close ? resistancecolor : supportcolor)
if ph or pl
//because of new calculation, remove old S/R levels
array.clear(sr_up_level)
array.clear(sr_dn_level)
array.clear(sr_strength)
//find S/R zones
for x = 0 to array.size(pivotvals) - 1 by 1
= get_sr_vals(x)
if check_sr(hi, lo, strength)
loc = find_loc(strength)
// if strength is in first maxnumsr sr then insert it to the arrays
if loc < maxnumsr and strength >= min_strength
array.insert(sr_strength, loc, strength)
array.insert(sr_up_level, loc, hi)
array.insert(sr_dn_level, loc, lo)
// keep size of the arrays = 5
if array.size(sr_strength) > maxnumsr
array.pop(sr_strength)
array.pop(sr_up_level)
array.pop(sr_dn_level)
for x = 1 to 10 by 1
line.delete(array.get(sr_lines, x))
label.delete(array.get(sr_labels, x))
for x = 0 to array.size(sr_up_level) > 0 ? array.size(sr_up_level) - 1 : na by 1
float mid = math.round_to_mintick((array.get(sr_up_level, x) + array.get(sr_dn_level, x)) / 2)
rate = 100 * (mid - close) / close
array.set(sr_labels, x + 1, label.new(x=bar_index + labelloc, y=mid, text=str.tostring(mid) + '(' + str.tostring(rate, '#.##') + '%)', color=mid >= close ? color.red : color.lime, textcolor=mid >= close ? color.white : color.black, style=mid >= close ? label.style_label_down : label.style_label_up))
array.set(sr_lines, x + 1, line.new(x1=bar_index, y1=mid, x2=bar_index - 1, y2=mid, extend=extend.both, color=mid >= close ? resistancecolor : supportcolor, style=Lstyle, width=linewidth))
f_crossed_over() =>
ret = false
for x = 0 to array.size(sr_up_level) > 0 ? array.size(sr_up_level) - 1 : na by 1
float mid = math.round_to_mintick((array.get(sr_up_level, x) + array.get(sr_dn_level, x)) / 2)
if close <= mid and close > mid
ret := true
ret
ret
f_crossed_under() =>
ret = false
for x = 0 to array.size(sr_up_level) > 0 ? array.size(sr_up_level) - 1 : na by 1
float mid = math.round_to_mintick((array.get(sr_up_level, x) + array.get(sr_dn_level, x)) / 2)
if close >= mid and close < mid
ret := true
ret
ret
alertcondition(f_crossed_over(), title='Resistance Broken', message='Resistance Broken')
alertcondition(f_crossed_under(), title='Support Broken', message='Support Broken')
CB Charts - GEX MESZ2025/ESZ2025Last Updated: 09/22/2025 6:41 a.m. PST
*DISCLAIMER: Only intended for ESZ2025/MESZ2025 charts.
This indicator plots horizontal levels based on batched GEX levels for ESZ2025/MESZ2025. The batched data is derived from contracts expiring: 0DTE, 1DTE, EoW, EoM, Next Week, Next Month and 3-months out. Labels are available for a high-level view of which levels are which. Hovering (or long-pressing on mobile TV) over the labels will display the nominal values and Rank. This script is manually updated and may not be always updated.
When and what to use:
- Most respected levels come from 1DTE, EoW and EoM.
- 0DTE is included for when this script becomes intraday updated. (CURRENTLY NOT UPDATED INTRADAY)
- Next Week setting is best used only for Friday and Sunday trading
- Next Month setting is best for weeks close to the end of the current month
Powered by the Camels of Wallstreet
Volume Profile Bar-Magnified Order Blocks [JacobMagleby]djfkudfudgfdsfhdcjdgcgbkdcjbfsdhgfhgignhdghklgdlgdkgnhdghnfjknvlskvmjldkvmjlkfgmjlfgvjljm
LW Outside Day Flip【SpeculationLab】Applicable Timeframe
⚠️ Note: This indicator is primarily designed for the Daily timeframe.
Larry Williams’ original discussion and statistics were based on daily data. While it can technically be applied to other timeframes, results may vary. It is strongly recommended to use it on daily charts.
Overview
This indicator marks a classic “Outside Day + Extreme Close” price action pattern. The idea comes from Larry Williams’ Long-Term Secrets to Short-Term Trading (2nd edition, Chapter 7).
The indicator does not execute trades or generate alerts — it simply plots visual markers on the chart when the pattern conditions are met, to assist research and review.
Logic
Outside Bar Condition
Current high > previous high
Current low < previous low
Extreme Close Filter
Long signal: Close < previous low
Short signal: Close > previous high
Confirmation
Signals are only confirmed at bar close (barstate.isconfirmed), to avoid repainting during intrabar movement.
Chart Display
When a long signal is triggered, a green downward triangle is plotted above the bar.
When a short signal is triggered, a red upward triangle is plotted below the bar.
Signals are overlaid directly on the price chart (overlay=true) and serve only as visual cues.
Usage Notes
Best used as a filter or secondary confirmation tool, not as a standalone entry trigger.
Consider combining with higher timeframe trend, key support/resistance, or volume analysis.
Entries, stop losses, and profit targets should be defined and tested independently by the trader.
Limitations and Risks
In strong trending markets, these signals may fail.
In low-liquidity or gapping conditions, accuracy may be reduced.
A single candlestick pattern cannot ensure consistent profitability.
Disclaimer
This script is for educational and research purposes only. It is not financial advice. Trading carries risk, and users are solely responsible for their own decisions and results.
===================
指标适用范围
⚠️ 特别提示:本指标主要适用于日线图(Daily Timeframe)。
Larry Williams 的原始讨论与统计均基于日线数据。虽然技术上可以在其它周期应用,但效果可能会不同,建议严格以日线作为主要参考周期。
功能概述
本指标用于在图表上标记一种经典的“外包线 + 极端收盘”的价格行为形态。思路参考 Larry Williams 在《Long-Term Secrets to Short-Term Trading》(第二版,第七章)中对日线“Outside Day”与反向收盘的讨论。指标不包含交易执行或提醒功能,仅在满足条件时绘制信号标记,用于辅助研究。
计算逻辑
外包线(Outside Bar)判定
最高价高于前一根K线的最高价;
最低价低于前一根K线的最低价。
极端收盘过滤
做多信号(Long):收盘价低于前一根K线的最低价;
做空信号(Short):收盘价高于前一根K线的最高价。
确认方式
仅在K线收盘后确认(避免盘中信号反复出现/消失)。
绘图说明
触发做多条件时,在K线 上方 绘制 绿色 向下三角形标记。
触发做空条件时,在K线 下方 绘制 红色 向上三角形标记。
信号直接叠加在价格图上(overlay=true),仅作提示。
使用建议
建议作为筛选条件或二次确认工具,不要单独作为入场依据;
可以配合趋势方向、关键支撑/阻力、成交量等其他因素一起使用;
入场、止损与止盈需由使用者自行定义和验证。
限制与风险
在强趋势行情中,信号可能失效;
在低流动性或跳空行情中,信号准确度下降;
单一形态不能保证稳定盈利。
免责声明
本指标仅用于教育与研究,不构成投资建议。实际交易风险由使用者自行承担。
Momentum Shift Oscillator (MSO) [SharpStrat]Momentum Shift Oscillator (MSO)
The Momentum Shift Oscillator (MSO) is a custom-built oscillator that combines the best parts of RSI, ROC, and MACD into one clean, powerful indicator. Its goal is to identify when momentum shifts are happening in the market, filtering out noise that a single momentum tool might miss.
Why MSO?
Most traders rely on just one momentum indicator like RSI, MACD, or ROC. Each has strengths, but also weaknesses:
RSI → great for overbought/oversold, but often lags in strong trends.
ROC (Rate of Change) → captures price velocity, but can be too noisy.
MACD Histogram → shows trend strength shifts, but reacts slowly at times.
By blending all three (with adjustable weights), MSO gives a balanced view of momentum. It captures trend strength, velocity, and exhaustion in one oscillator.
How MSO Works
Inputs:
RSI, ROC, and MACD Histogram are calculated with user-defined lengths.
Each is normalized (so they share the same scale of -100 to +100).
You can set weights for RSI, ROC, and MACD to emphasize different components.
The components are blended into a single oscillator value.
Smoothing (SMA, EMA, or WMA) is applied.
MSO plots as a smooth line, color-coded by slope (green rising, red falling).
Overbought and oversold levels are plotted (default: +60 / -60).
A zero line helps identify bullish vs bearish momentum shifts.
How to trade with MSO
Zero line crossovers → crossing above zero suggests bullish momentum; crossing below zero suggests bearish momentum.
Overbought and oversold zones → values above +60 may indicate exhaustion in bullish moves; values below -60 may signal exhaustion in bearish moves.
Slope of the line → a rising line shows strengthening momentum, while a falling line signals fading momentum.
Divergences → if price makes new highs or lows but MSO does not, it can point to a possible reversal.
Why MSO is Unique
Combines trend + momentum + velocity into one view.
Filters noise better than standalone RSI/MACD.
Adapts to both trend-following and mean-reversion styles.
Can be used across any timeframe for confirmation.
ninu3q merged//@version=6
indicator("Ultimate Trend + Momentum + Volume Pro (merged)", overlay=true,
max_boxes_count=700, max_lines_count=300, max_labels_count=300)
// -----------------------------
// 1) EMA Trend + VWAP Layer (combined)
// -----------------------------
ema200 = ta.ema(close, 200)
ema50 = ta.ema(close, 50)
vwap = ta.vwap
ema200Plot = plot(ema200, "EMA 200", color=color.red, linewidth=2, style=plot.style_line)
ema50Plot = plot(ema50, "EMA 50", color=color.teal, linewidth=1, style=plot.style_line)
vwapPlot = plot(vwap, "VWAP", color=color.orange, linewidth=1, style=plot.style_line)
// Trick: combine them into a group so TradingView counts less
plot(na) // placeholder, only one is really required
// -----------------------------
// 2) UT Bot Alerts
// -----------------------------
utAtrPeriod = input.int(10, "UT ATR Period")
utAtrMultiplier = input.float(2.0, "UT ATR Multiplier")
utAtr = ta.atr(utAtrPeriod)
utUpper = close + utAtrMultiplier * utAtr
utLower = close - utAtrMultiplier * utAtr
utBuy = ta.crossover(close, utUpper)
utSell = ta.crossunder(close, utLower)
plotshape(utBuy, "UT Buy", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(utSell, "UT Sell", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")
// -----------------------------
// 3) Volume Profile (anchored to last N bars)
// -----------------------------
barsBack = input.int(150, "Bars Back", minval=1, maxval=5000)
cols = input.int(35, "Columns", minval=5, maxval=200)
vaPct = input.float(70.0, "Value Area %", minval=40.0, maxval=99.0)
histWidth = input.int(24, "Histogram Width (bars)", minval=6, maxval=200)
direction = input.string("Into chart (left)", "Histogram Direction", options= )
// Block/line styles
blockFillColor = input.color(#B0B0B0, "Volume Block Fill Color")
blockFillOpacity = input.int(70, "Volume Block Fill Opacity %", minval=0, maxval=100)
blockBorderColor = input.color(#000000, "Volume Block Border Color")
blockBorderOpacity = input.int(0, "Volume Block Border Opacity %", minval=0, maxval=100)
showPOC = input.bool(true, "Show POC Line")
pocColor = input.color(#FF0000, "POC Color")
pocWidth = input.int(2, "POC Width", minval=1, maxval=6)
showVA = input.bool(false, "Show VAH/VAL Lines")
vaColor = input.color(#FFA500, "VA Color")
vaWidth = input.int(1, "VA Width", minval=1, maxval=6)
showVWAP = input.bool(false, "Show AVWAP Line")
vwapColor = input.color(#0000FF, "AVWAP Color")
vwapWidth = input.int(1, "AVWAP Width", minval=1, maxval=6)
showLabels = input.bool(false, "Show Line Labels")
priceForBin = hlcc4
// Draw registries
var boxesArr = array.new_box()
var linesArr = array.new_line()
var labelsArr = array.new_label()
f_wipe() =>
while array.size(boxesArr) > 0
box.delete(array.pop(boxesArr))
while array.size(linesArr) > 0
line.delete(array.pop(linesArr))
while array.size(labelsArr) > 0
label.delete(array.pop(labelsArr))
if barstate.islast
f_wipe()
eff = math.min(barsBack, bar_index + 1)
if eff > 1
float pMin = na
float pMax = na
float pvSum = 0.0
float vSum = 0.0
for look = 0 to eff - 1
lo = low
hi = high
pMin := na(pMin) ? lo : math.min(pMin, lo)
pMax := na(pMax) ? hi : math.max(pMax, hi)
pvSum += priceForBin * volume
vSum += volume
anchoredVWAP = vSum > 0 ? pvSum / vSum : na
if not na(pMin) and not na(pMax) and pMax > pMin
step = (pMax - pMin) / cols
step := step == 0.0 ? syminfo.mintick : step
var vols = array.new_float()
var lows = array.new_float()
var highs = array.new_float()
array.clear(vols), array.clear(lows), array.clear(highs)
for i = 0 to cols - 1
array.push(vols, 0.0)
lo = pMin + i * step
hi = lo + step
array.push(lows, lo)
array.push(highs, hi)
for look = 0 to eff - 1
pr = priceForBin
vol = volume
idx = int(math.floor((pr - pMin) / step))
idx := idx < 0 ? 0 : idx > cols - 1 ? cols - 1 : idx
array.set(vols, idx, array.get(vols, idx) + vol)
pocIdx = 0
pocVol = 0.0
totalVol = 0.0
for i = 0 to cols - 1
v = array.get(vols, i)
totalVol += v
if v > pocVol
pocVol := v
pocIdx := i
targetVol = totalVol * (vaPct / 100.0)
left = pocIdx
right = pocIdx
cumVA = array.get(vols, pocIdx)
while cumVA < targetVol and (left > 0 or right < cols - 1)
vLeft = left > 0 ? array.get(vols, left - 1) : -1.0
vRight = right < cols - 1 ? array.get(vols, right + 1) : -1.0
if vRight > vLeft
right += 1
cumVA += array.get(vols, right)
else if vLeft >= 0
left -= 1
cumVA += array.get(vols, left)
else
break
VAH = array.get(highs, right)
VAL = array.get(lows, left)
profileStart = bar_index - (eff - 1)
rightStart = bar_index + 1
rightEnd = bar_index + 1 + histWidth
intoChart = direction == "Into chart (left)"
for i = 0 to cols - 1
v = array.get(vols, i)
len = pocVol > 0 ? (v / pocVol) : 0.0
px = int(math.round(len * histWidth))
x1 = intoChart ? (rightEnd - px) : rightStart
x2 = intoChart ? rightEnd : (rightStart + px)
y1 = array.get(lows, i)
y2 = array.get(highs, i)
b = box.new(x1, y2, x2, y1, xloc=xloc.bar_index, border_color=color.new(blockBorderColor, blockBorderOpacity))
box.set_bgcolor(b, color.new(blockFillColor, 100 - blockFillOpacity))
array.push(boxesArr, b)
if showPOC
pocPrice = (array.get(lows, pocIdx) + array.get(highs, pocIdx)) / 2.0
lnPOC = line.new(profileStart, pocPrice, rightEnd, pocPrice, xloc=xloc.bar_index, extend=extend.right, color=pocColor, width=pocWidth)
array.push(linesArr, lnPOC)
if showLabels
lbPOC = label.new(rightEnd, pocPrice, "POC", xloc=xloc.bar_index, style=label.style_label_right, textcolor=color.white, color=pocColor)
array.push(labelsArr, lbPOC)
if showVA
lnVAL = line.new(profileStart, VAL, rightEnd, VAL, xloc=xloc.bar_index, extend=extend.right, color=vaColor, width=vaWidth)
lnVAH = line.new(profileStart, VAH, rightEnd, VAH, xloc=xloc.bar_index, extend=extend.right, color=vaColor, width=vaWidth)
array.push(linesArr, lnVAL)
array.push(linesArr, lnVAH)
if showLabels
lbVAH = label.new(rightEnd, VAH, "VAH", xloc=xloc.bar_index, style=label.style_label_right, textcolor=color.white, color=vaColor)
lbVAL = label.new(rightEnd, VAL, "VAL", xloc=xloc.bar_index, style=label.style_label_right, textcolor=color.white, color=vaColor)
array.push(labelsArr, lbVAH)
array.push(labelsArr, lbVAL)
if showVWAP and not na(anchoredVWAP)
lnVW = line.new(profileStart, anchoredVWAP, rightEnd, anchoredVWAP, xloc=xloc.bar_index, extend=extend.right, color=vwapColor, width=vwapWidth)
array.push(linesArr, lnVW)
if showLabels
lbVW = label.new(rightEnd, anchoredVWAP, "AVWAP", xloc=xloc.bar_index, style=label.style_label_right, textcolor=color.white, color=vwapColor)
array.push(labelsArr, lbVW)
// placeholder plot
plot(na)
MTF EMA Smooth Indicator By : KaizenotradingPH (Open Source)This indicator script can display three different timeframe MTF EMA indicators simultaneously. The special thing of this script is that it has smoothing feature that can smooth the MTF EMA but only in minutes and hours timeframe (script limitation). You can enable the anti repainting as well which reference the previous bar. These features are useful for customize strategies scripts to avoid repainting. Additionally, this script have customizable length for the three MTF EMA indicators.
This is the open source version of the script.
hy_smc_ictLibrary "hy_smc_ict"
getHighestLowest(period)
Parameters:
period (int)
ob_reset_state(bullishList, bearishList)
Parameters:
bullishList (array)
bearishList (array)
ob_find_order_blocks(bullishList, bearishList, length, atrVal, maxATRMult, obEndMethod)
Parameters:
bullishList (array)
bearishList (array)
length (int)
atrVal (float)
maxATRMult (float)
obEndMethod (string)
orderBlockInfo
Fields:
top (series float)
bottom (series float)
obVolume (series float)
obType (series string)
startTime (series int)
bbVolume (series float)
obLowVolume (series float)
obHighVolume (series float)
breaker (series bool)
breakTime (series int)
timeframeStr (series string)
disabled (series bool)
combinedTimeframesStr (series string)
combined (series bool)
obSwing
Fields:
x (series int)
y (series float)
swingVolume (series float)
crossed (series bool)
Multiple Relative Strength IndicatorThis indicator is used to display multiple Relative strength of a stock compared with another.
Default value for the first Relative strength period is 55
Default value for the second Relative strength period is 21
Default value for the comparable Index is CNX500
You can add the sectorial index for sector comparison
Breakout ORB + HTF EMA + ATR Targets (America/Denver)This is a perfect simple chart for those trading Crypto pairs between the London and US market overlays.
Moving Averages with Alerts: 9, 21, 51, 100, 144, 200---
This indicator plots six configurable moving averages (MA) with options for EMA, SMA, RCI, HMA, and Pivô Boss types. It highlights key crossover points, especially monitoring the 9-period MA for crosses with others. Users can enable alerts for these crossovers, as well as set custom alerts between any two selected MAs. Additionally, the indicator marks the important crossovers of the 51 and 200 MAs on the chart with an “X”. This helps traders identify trend changes and potential entry or exit points efficiently.
---
FRANJAS POR FECHAS - RSDescription:
This indicator allows you to highlight specific dates on your chart with vertical background stripes, similar to a session indicator.
Input your dates in the format DD.MM.YYYY (you can separate them with commas, spaces, line breaks, or semicolons).
The script automatically normalizes the format and applies a shaded vertical band for each matching day.
Works on daily and intraday charts: in intraday, the shading will cover the full trading day.
Options available to adjust the color and transparency of the stripes.
Optional dotted lines can be enabled at the start and end of each highlighted day.
This is useful for marking important events such as FOMC meetings, earnings releases, economic data announcements, or any custom list of key dates you want to track directly on your chart.
Katz Calypso Indicator (Refactored)Overview
The Katz Calypso Indicator is a comprehensive momentum oscillator designed to identify potential entry and exit points in the market. At its core, it uses the True Strength Index (TSI) to gauge the strength and direction of a trend. To enhance signal accuracy and reduce false positives, the indicator integrates several optional filters, including the Waddah Attar Explosion, an EMA filter, and an ATR filter. It also provides an optional RVGI-based exit signal system.
This tool is designed to provide a clear, visual representation of market momentum, with customizable filters to adapt to various trading styles and market conditions.
How to Use the Indicator
The indicator is displayed in a separate pane below the main price chart.
TSI Line (Blue): This is the main oscillator line. Its position relative to the zero line indicates the overall trend bias (above 0 is bullish, below is bearish).
Signal Line (Red): A moving average of the TSI line. Crossovers between the TSI and Signal Line are the primary triggers for trade signals.
Zero Line: The centerline of the oscillator. A cross of the Zero Line can indicate a significant shift in momentum.
Overbought/Oversold Levels: These user-defined levels (defaulting to 65 and -65) help identify potential exhaustion points in a trend, which can be used for taking profits.
On-Chart Signals: The indicator plots shapes directly on the chart to make signals easy to spot:
Green Triangles (Up): Indicate long entry or continuation signals.
Red Triangles (Down): Indicate short entry or continuation signals.
Yellow Triangles: Suggest taking profits.
Maroon/Lime Triangles: Indicate an exit based on a signal cross (like RVGI or the Zero Line).
Trading Rules
Long Trade Rules
Entry: A long trade is signaled when ALL of the following conditions are met:
The blue TSI Line crosses above the red Signal Line.
The blue TSI Line is above the 0 Zero Line.
All enabled filters (Waddah Attar, EMA, ATR) confirm bullish conditions.
A green triangle labeled "Long" will appear below the price.
Exit (Take Profit): A take-profit signal for a long trade is generated when either of these occurs:
The TSI Line crosses below the Overbought level.
The TSI Line crosses back below the Signal Line while still above zero.
A yellow triangle labeled "TPL" (Take Profit Long) will appear above the price.
Exit (Stop/Reverse): A signal to exit a long trade is generated when either of these occurs:
The TSI Line crosses below the 0 Zero Line.
The RVGI Exit filter is enabled and generates a bearish crossover signal.
A maroon triangle labeled "Exit Long" will appear above the price.
Short Trade Rules
Entry: A short trade is signaled when ALL of the following conditions are met:
The blue TSI Line crosses below the red Signal Line.
The blue TSI Line is below the 0 Zero Line.
All enabled filters (Waddah Attar, EMA, ATR) confirm bearish conditions.
A red triangle labeled "Short" will appear above the price.
Exit (Take Profit): A take-profit signal for a short trade is generated when either of these occurs:
The TSI Line crosses above the Oversold level.
The TSI Line crosses back above the Signal Line while still below zero.
A yellow triangle labeled "TPS" (Take Profit Short) will appear below the price.
Exit (Stop/Reverse): A signal to exit a short trade is generated when either of these occurs:
The TSI Line crosses above the 0 Zero Line.
The RVGI Exit filter is enabled and generates a bullish crossover signal.
A lime green triangle labeled "Exit Short" will appear below the price.
Optional Filters
You can enable or disable these filters in the indicator's settings to fine-tune its sensitivity.
Waddah Attar Explosion Filter: This filter measures trend strength and volatility. When enabled, it ensures that entries are only taken during periods of strong, confirmed momentum, helping to avoid sideways or choppy markets.
EMA Price Filter: A classic trend filter. When enabled, it will only allow long entries if the price is above the specified Exponential Moving Average and short entries only if the price is below it.
ATR Filter: This acts as a volatility-based filter to prevent chasing a move. It helps ensure that you are not entering a long trade when the price has already moved too far above its EMA, or vice-versa for a short trade.
RVGI Exit Filter: The Relative Vigor Index (RVGI) is used here exclusively as an exit signal. When enabled, a crossover of the RVGI and its signal line can provide an earlier exit signal before the TSI crosses the zero line, potentially locking in profits sooner.
Disclaimer: This indicator is provided for educational and informational purposes only. It is not financial advice. Trading carries a high level of risk, and you can lose more than your initial investment. You should use this indicator at your own risk and discretion. Always conduct your own research and consider your risk tolerance before making any trading decisions.
AlgoPilotX - OptionScope with Call/Put Bias BB SqueezeUnlock the power of options trading with real-time trend insights! AlgoPilotX - OptionScope combines multi-timeframe trend analysis, Bollinger Band squeezes, RSI signals, and ATR-based strike zones into one intuitive dashboard . Instantly see call/put bias, volatility squeezes, and optimal strike distances—perfect for traders who want actionable signals at a glance.
Features include:
✅ Multi-timeframe bullish/bearish trend detection
⚡ Bollinger Band squeeze alerts for volatility breakouts
📊 ATR-based dynamic strike zones for calls and puts
🔴🟢 RSI overbought/oversold signals
🚀 Visual arrows and a real-time dashboard panel
🔔 Fully alert-ready for automated notifications
Make smarter, faster trading decisions with OptionScope—the ultimate options trading companion.
Call/Put Bias
Shows overall market bias for calls or puts based on multi-timeframe trend analysis
Green = Call bias, Red = Put bias, Gray = Neutral
BB Squeeze
Detects low volatility periods that may lead to breakouts
Yellow = Squeeze active, Gray = No squeeze
Strike Distance
Suggests call and put strike levels based on ATR
Blue background
RSI
Indicates overbought/oversold conditions
Red = Overbought, Green = Oversold, Gray = Neutral
Z-Score Mean Reversion StrategyBased on Indicator "Rolling Z- Score trend" by QuantAlgo
The Z-Score Mean Reversion Strategy is a statistical trading approach that exploits price extremes and their tendency to return to average levels. It uses the Z-Score indicator to identify when an asset has deviated significantly from its statistical mean, creating high-probability reversal opportunities.
Core Concept:
Z-Score measures how many standard deviations price is from its moving average
When Z-Score reaches extreme levels (±1.5 or more), price is statistically "stretched"
The strategy trades the expected "snap back" to the mean
Works best in ranging or mean-reverting markets
How It Works:
LONG Entry: When price becomes oversold (Z-Score < -1.5), expect upward reversion
SHORT Entry: When price becomes overbought (Z-Score > +1.5), expect downward reversion
Exit: When price returns closer to the mean or reaches opposite extreme
Risk Management: Stop loss at -3% and take profit at +5% by default
🎯 Best Settings by Market & Timeframe
Cryptocurrency (High Volatility)
Preset: Scalping
Timeframe: 15m - 1H
Lookback: 10-15 periods
Entry Threshold: 1.0 - 1.5
Stop Loss: 2-3%
Take Profit: 3-5%
Notes: Crypto moves fast; use tighter parameters for quicker signals
Forex (Medium Volatility)
Preset: Default or Swing Trading
Timeframe: 1H - 4H
Lookback: 20-25 periods
Entry Threshold: 1.5 - 2.0
Stop Loss: 1-2%
Take Profit: 2-4%
Notes: Works well on major pairs during normal market conditions
Stocks (Lower Volatility)
Preset: Swing Trading
Timeframe: 4H - Daily
Lookback: 25-30 periods
Entry Threshold: 1.5 - 1.8
Stop Loss: 2-4%
Take Profit: 4-8%
Notes: Best on liquid stocks; avoid during earnings or major news
Indices (Trend + Ranging)
Preset: Trend Following
Timeframe: Daily - Weekly
Lookback: 35-50 periods
Entry Threshold: 2.0 - 2.5
Stop Loss: 3-5%
Take Profit: 5-10%
Notes: Higher threshold reduces false signals; captures major reversals
⚙️ Optimal Configuration Guide
Conservative (Lower Risk, Fewer Trades)
Lookback Period: 30-40
Entry Threshold: 2.0-2.5
Exit Threshold: 0.8-1.0
Stop Loss: 3-4%
Take Profit: 6-10%
Momentum Filter: ON
Balanced (Recommended Starting Point)
Lookback Period: 20-25
Entry Threshold: 1.5-1.8
Exit Threshold: 0.5-0.6
Stop Loss: 2-3%
Take Profit: 4-6%
Momentum Filter: OFF
Aggressive (Higher Risk, More Trades)
Lookback Period: 10-15
Entry Threshold: 1.0-1.2
Exit Threshold: 0.3-0.4
Stop Loss: 1-2%
Take Profit: 2-4%
Momentum Filter: OFF
💡 Pro Tips for Best Results
When the Strategy Works Best:
✅ Ranging markets with clear support/resistance
✅ High liquidity assets (major pairs, large-cap stocks)
✅ Normal market conditions (avoid during crashes or parabolic runs)
✅ Mean-reverting assets (avoid strong trending stocks)
When to Avoid:
❌ Strong trending markets (price won't revert)
❌ Low liquidity / low volume periods
❌ Major news events (earnings, FOMC, NFP)
❌ Market crashes or euphoria phases
Optimization Process:
Start with "Default" preset on your chosen timeframe
Backtest 6-12 months to see performance
Adjust Entry Threshold first (lower = more trades, higher = fewer but stronger signals)
Fine-tune Stop Loss/Take Profit based on average trade duration
Consider Momentum Filter if getting too many false signals
Key Metrics to Monitor:
Win Rate: Target 50-60% (mean reversion typically has moderate win rate)
Profit Factor: Aim for >1.5
Average Trade Duration: Should match your timeframe (scalping: minutes/hours, swing: days)
Max Drawdown: Keep under 20% of capital
📈 Quick Start Recommendation
For most traders, start here:
Timeframe: 1H or 4H
Preset: Default (Lookback 20, Threshold 1.5)
Stop Loss: 3%
Take Profit: 5%
Momentum Filter: OFF (turn ON if too many false entries)
Test on BTCUSD, EURUSD, or SPY first, then adapt to your preferred instruments!
nitai Daily ATR – Top Right PanelThis script calculates the Daily ATR (Average True Range) and displays it in a compact panel on the top-right corner of the chart.
The panel includes:
• ATR in USD (based on a user-defined period, default = 30)
• ATR% – volatility expressed as a percentage of the price
• ATR% EMA – smoothed volatility trend using an Exponential Moving Average
• Close + ATR and Close – ATR – projected upper and lower daily range levels
Use this tool to quickly assess daily volatility, compare stocks by relative movement, and support risk management (e.g., stop-loss placement).
Designed for traders who want a clean and simple volatility dashboard directly on the chart.
Mekayl's Session Zones//@version=5
indicator("Mekayl's Session zones", overlay=true, max_boxes_count=200)
// --- Colors
asiaFill = color.new(#3b3333, 80)
preLdnFill = color.new(#292323, 80)
ldnFill = color.new(#242222, 80)
preNyFill = color.new(#443322, 80)
nyFill = color.new(#664422, 80)
asiaBorder = color.new(#4d718f, 0)
preLdnBorder = color.new(#00897B, 0)
ldnBorder = color.new(#B2EBF2, 0)
preNyBorder = color.new(#FFA500, 0)
nyBorder = color.new(#FF8C00, 0)
// --- Sessions
asia_sess = "0100-0600"
preldn_sess = "0600-0800"
ldn_sess = "0800-1200"
preNY_sess = "1200-1300"
ny_sess = "1300-1700"
tz = "Europe/London"
// --- Variables for boxes & labels
var box asia_box = na
var label asia_label = na
var box pre_box = na
var label pre_label = na
var box ldn_box = na
var label ldn_label = na
var box preNY_box = na
var label preNY_label = na
var box ny_box = na
var label ny_label = na
// --- Function to get horizontal center above box
f_label_xy(b) =>
x = (box.get_left(b) + box.get_right(b)) / 2
y = box.get_top(b) + 3 * syminfo.mintick
// --- Asia box
asia_in = not na(time(timeframe.period, asia_sess, tz))
if asia_in
if na(asia_box)
asia_box := box.new(left=bar_index, top=high, right=bar_index, bottom=low, bgcolor=asiaFill, border_color=asiaBorder, border_width=2)
= f_label_xy(asia_box)
asia_label := label.new(x, y, "asia", style=label.style_none, textcolor=color.new(asiaBorder,0), size=size.normal)
else
box.set_right(asia_box, bar_index)
box.set_top(asia_box, math.max(box.get_top(asia_box), high))
box.set_bottom(asia_box, math.min(box.get_bottom(asia_box), low))
= f_label_xy(asia_box)
label.set_xy(asia_label, x, y)
else
if not na(asia_box)
box.set_right(asia_box, bar_index)
asia_box := na
asia_label := na
// --- Pre-London box
pre_in = not na(time(timeframe.period, preldn_sess, tz))
if pre_in
if na(pre_box)
pre_box := box.new(left=bar_index, top=high, right=bar_index, bottom=low, bgcolor=preLdnFill, border_color=preLdnBorder, border_width=2)
= f_label_xy(pre_box)
pre_label := label.new(x, y, "pre_ldn", style=label.style_none, textcolor=color.new(preLdnBorder,0), size=size.normal)
else
box.set_right(pre_box, bar_index)
box.set_top(pre_box, math.max(box.get_top(pre_box), high))
box.set_bottom(pre_box, math.min(box.get_bottom(pre_box), low))
= f_label_xy(pre_box)
label.set_xy(pre_label, x, y)
else
if not na(pre_box)
box.set_right(pre_box, bar_index)
pre_box := na
pre_label := na
// --- London box
ldn_in = not na(time(timeframe.period, ldn_sess, tz))
if ldn_in
if na(ldn_box)
ldn_box := box.new(left=bar_index, top=high, right=bar_index, bottom=low, bgcolor=ldnFill, border_color=ldnBorder, border_width=2)
= f_label_xy(ldn_box)
ldn_label := label.new(x, y, "ldn", style=label.style_none, textcolor=color.new(ldnBorder,0), size=size.normal)
else
box.set_right(ldn_box, bar_index)
box.set_top(ldn_box, math.max(box.get_top(ldn_box), high))
box.set_bottom(ldn_box, math.min(box.get_bottom(ldn_box), low))
= f_label_xy(ldn_box)
label.set_xy(ldn_label, x, y)
else
if not na(ldn_box)
box.set_right(ldn_box, bar_index)
ldn_box := na
ldn_label := na
// --- Pre-New York box
preNY_in = not na(time(timeframe.period, preNY_sess, tz))
if preNY_in
if na(preNY_box)
preNY_box := box.new(left=bar_index, top=high, right=bar_index, bottom=low, bgcolor=preNyFill, border_color=preNyBorder, border_width=2)
= f_label_xy(preNY_box)
preNY_label := label.new(x, y, "pre-ny", style=label.style_none, textcolor=color.new(preNyBorder,0), size=size.normal)
else
box.set_right(preNY_box, bar_index)
box.set_top(preNY_box, math.max(box.get_top(preNY_box), high))
box.set_bottom(preNY_box, math.min(box.get_bottom(preNY_box), low))
= f_label_xy(preNY_box)
label.set_xy(preNY_label, x, y)
else
if not na(preNY_box)
box.set_right(preNY_box, bar_index)
preNY_box := na
preNY_label := na
// --- New York box
ny_in = not na(time(timeframe.period, ny_sess, tz))
if ny_in
if na(ny_box)
ny_box := box.new(left=bar_index, top=high, right=bar_index, bottom=low, bgcolor=nyFill, border_color=nyBorder, border_width=2)
= f_label_xy(ny_box)
ny_label := label.new(x, y, "ny", style=label.style_none, textcolor=color.new(nyBorder,0), size=size.normal)
else
box.set_right(ny_box, bar_index)
box.set_top(ny_box, math.max(box.get_top(ny_box), high))
box.set_bottom(ny_box, math.min(box.get_bottom(ny_box), low))
= f_label_xy(ny_box)
label.set_xy(ny_label, x, y)
else
if not na(ny_box)
box.set_right(ny_box, bar_index)
ny_box := na
ny_label := na