EMA Crossover 9/21 📈 **EMA Crossover Signal Line**
Created by **Ahmet AKSOY (tugeday)**
This indicator visualizes the crossover between two EMAs using a single dynamic-colored line.
✅ **How it works:**
- The script calculates two EMAs: a short-period EMA and a long-period EMA.
- Only the **short EMA line** is displayed on the chart.
- When the short EMA **crosses above** the long EMA (bullish crossover), the line color turns **green**.
- When the short EMA **crosses below** the long EMA (bearish crossover), the line color turns **red**.
- The line color remains based on the last crossover signal.
🎛️ **Customizable Inputs:**
- Short EMA period (default: 9)
- Long EMA period (default: 21)
All EMA periods can be adjusted from the settings panel, allowing traders to fine-tune the indicator to match their strategy.
Simple, clean, and effective.
Developed by **Ahmet AKSOY (tugeday)** — enjoy and trade smart!
Chỉ báo và chiến lược
RSI with EMA and WMA on RSI
> "This is an indicator that combines EMA and WMA on the RSI.
> It highlights the strength of price waves as well as support and resistance zones."
HILO Interpolation | QuantEdgeB🚀 Introducing HILO Interpolation by QuantEdgeB
🛠️ Overview
HILO Interpolation is a dynamic price-action based signal engine crafted to adapt across trending and ranging conditions. By leveraging percentile-based price band interpolation, it identifies high-confidence breakout and breakdown zones. This indicator is designed to serve both as a momentum trigger in trend phases and as a price-reactive entry system during range-bound consolidation.
By intelligently switching between percentile thresholds and interpolated logic, HILO minimizes noise and whipsaws commonly seen in traditional crossover systems.
✨ Key Features
🔹 Percentile Interpolation Engine
Tracks price breakouts using percentile thresholds, making it adaptable to volatility and asset-specific structure.
🔹 Price-Based Signal Confirmation
Signals are only triggered when price meaningfully crosses through key percentile thresholds (based on historical high/low logic).
🔹 Visual Trend Encoding
Color-coded candles, dynamic interpolation bands, and optional long/cash labels give clear visual cues for trend and trade direction.
🔹 Dynamic Threshold Switching
Interpolated threshold flips based on where price sits relative to percentile bands—providing adaptive long/short logic.
📊 How It Works
1️⃣ Percentile Zone Definition
HILO defines two key percentiles from the historical high and low:
• Upper Threshold: 75th Percentile of Highs
• Lower Threshold: 50th Percentile of Lows
These are calculated using linear interpolation to ensure smoother transitions across lookback periods.
2️⃣ Adaptive Signal Line
Instead of using static crossovers, HILO dynamically flips its signal based on whether price exceeds the upper threshold or falls below the lower one.
📌 If price > upper → Signal = Short threshold
📌 If price < lower → Signal = Long threshold
📌 If price remains between thresholds → no flip (trend continuation)
3️⃣ Signal Logic
✅ Long Signal → Price exceeds upper bound while lower bound acts as ceiling
❌ Short Signal → Price breaks below lower percentile while upper bound flips
This simple yet powerful mechanism creates early entries while maintaining high signal confidence.
👁 Visual & Custom Features
• 🎨 Multiple Color Modes: Strategy, Solar, Warm, Cool, Classic, Magic
• 🔄 Dynamic Candle & Band Coloring
• 🏷️ Signal Labels: Optional “𝓛𝓸𝓷𝓰” and “𝓢𝓱𝓸𝓻𝓽” tags when trend flips
• 💬 Alerts Ready: Long/Short crossover conditions can trigger alerts instantly
👥 Who Should Use HILO?
✅ Breakout Traders – Catch early trend starts using percentile filters
✅ Swing Traders – Identify directional bias shifts in advance
✅ Range Strategists – Use band confluence zones to play reversions
✅ Quant & Rule-Based Traders – Incorporate percentile logic into broader systems
⚙️ Customization & Default Settings
Percentile Length:(Default 35) Lookback for calculating percentile thresholds
Lookback Period:(Default 4) Lag factor for interpolation responsiveness
Upper % Threshold: (Default 75) Defines breakout zone from historical highs
Lower % Threshold: (Default 50) Defines retest/accumulation zone from historical lows
📌 How to Use HILO in Trading
1️⃣ Trend-Following Strategy
✔ Enter long when price flips above the adaptive support line
✔ Exit or go short when price breaks below the interpolated resistance
✔ Continue position as long as trend color persists
2️⃣ Range-Reversion Strategy
✔ Buy when price tests the lower threshold and no short signal is triggered
✔ Sell or reduce when price hits the upper range boundary
🧠 Why It Works
HILO operates on the principle that historical price structure creates natural probabilistic thresholds. By interpolating between these using percentile logic, the system maintains adaptability to changing market conditions—without the lag of moving averages or the noise of fixed bands.
🔹 Conclusion
HILO Interpolation is a minimalist yet powerful signal engine built for adaptive breakout and reversion detection. Its percentile-based logic offers a novel way to identify structure shifts, giving traders an edge in both trend and range markets.
🔹 Key Takeaways:
1️⃣ Breakout Entry Logic – Uses percentile interpolation instead of static bands
2️⃣ Color-Driven Clarity – Visual clarity via gradient zone overlays
3️⃣ Trend Integrity – Avoids overfitting and responds only to significant price movements
📌 Disclaimer: Past performance is not indicative of future results. No trading strategy can guarantee success in financial markets.
📌 Strategic Advice: Always backtest, optimize, and align parameters with your trading objectives and risk tolerance before live trading.
Highlight London Session (12:30 to 3:30 IST)The very first Pine Script code was designed to highlight the London trading session, specifically from 12:30 PM to 3:30 PM IST, which corresponds to 7:00 AM to 10:00 AM in UTC. During this window, the script monitored the highest and lowest prices reached and, once the session ended, it automatically plotted horizontal lines at those high and low levels. These lines stayed on the chart to provide a clear visual reference of the London session range, making it easier for traders to spot key areas of support and resistance. This is especially useful for identifying potential breakouts, liquidity grabs, or retests later in the day. The script didn’t include any visual boxes or background highlights—just clean, simple lines that marked the session's price boundaries for strategic analysis.
Impulse Candle with Volume & Std AnalysisImpulse Candle with Volume & Std Analysis
This indicator highlights “impulse” candles on your chart by combining price action and volume analysis to gauge the strength of market moves.
How It Works:
Impulse Candle Detection:
The indicator measures the candle’s body size and compares it to the Average True Range (ATR). When a candle’s body exceeds a user-defined multiple of the ATR (the “Impulse Factor”), it is flagged as an impulse candle.
Volume Analysis:
For each impulse candle, the indicator calculates the expected volume (Impulse Factor × average volume) and compares the actual volume against this expected value. It uses the standard deviation of volume over a specified period to classify the move’s volume as:
Extreme Low: More than 2 standard deviations below the expected volume
Low: Between 1 and 2 standard deviations below expected
Normal: Within 1 standard deviation of expected volume
High: Between 1 and 2 standard deviations above expected
Extreme High: More than 2 standard deviations above expected
Visual Cues:
The impulse candles are color-coded based on the volume classification.
A text-only label (with customizable text color) appears just above each impulse candle, indicating its volume category. The label has no background, ensuring a clean, unobtrusive look.
Customization:
Users can adjust parameters such as the Impulse Factor, ATR length, and volume averaging period to tailor the indicator to their trading style.
This tool is perfect for traders who want a quick visual representation of both significant price moves and the corresponding volume strength behind those moves.
Highlight London Session (12:30 to 3:30 IST)The very first Pine Script code was designed to highlight the London trading session, specifically from 12:30 PM to 3:30 PM IST, which corresponds to 7:00 AM to 10:00 AM in UTC. During this window, the script monitored the highest and lowest prices reached and, once the session ended, it automatically plotted horizontal lines at those high and low levels. These lines stayed on the chart to provide a clear visual reference of the London session range, making it easier for traders to spot key areas of support and resistance. This is especially useful for identifying potential breakouts, liquidity grabs, or retests later in the day. The script didn’t include any visual boxes or background highlights—just clean, simple lines that marked the session's price boundaries for strategic analysis.
Liquidity Grab (Bullish + Bearish) + 14, 22, 30 Bars + AlertsThis is a Institutional Level alert system. When a liquidity grab level is reached, candles 14, 22, and 30 are lit up to help you enter and exit.
Supertrend + Fair Value Gap [Combined]//@version=5
indicator("Supertrend + Fair Value Gap ", overlay = true, max_lines_count = 500, max_boxes_count = 500)
// === SUPER TREND ===
atrPeriod = input.int(10, "ATR Length", minval = 1)
factor = input.float(3.0, "Factor", minval = 0.01, step = 0.01)
= ta.supertrend(factor, atrPeriod)
supertrend := bar_index == 0 ? na : supertrend
upTrend = plot(direction < 0 ? supertrend : na, "Up Trend", color=color.green, style=plot.style_linebr)
downTrend = plot(direction < 0 ? na : supertrend, "Down Trend", color=color.red, style=plot.style_linebr)
bodyMiddle = plot(bar_index == 0 ? na : (open + close) / 2, "Body Middle", display=display.none)
fill(bodyMiddle, upTrend, title="Uptrend background", color=color.new(color.green, 90), fillgaps=false)
fill(bodyMiddle, downTrend, title="Downtrend background", color=color.new(color.red, 90), fillgaps=false)
alertcondition(direction > direction, title='Downtrend to Uptrend', message='The Supertrend value switched from Downtrend to Uptrend')
alertcondition(direction < direction, title='Uptrend to Downtrend', message='The Supertrend value switched from Uptrend to Downtrend')
alertcondition(direction != direction, title='Trend Change', message='The Supertrend value switched trend')
// === FAIR VALUE GAP ===
thresholdPer = input.float(0, "FVG Threshold %", minval=0, maxval=100, step=.1, inline='threshold')
auto = input.bool(false, "Auto", inline='threshold')
showLast = input.int(0, "Unmitigated Levels", minval=0)
mitigationLevels = input.bool(false, "Mitigation Levels")
tf = input.timeframe('', "FVG Timeframe")
extend = input.int(20, "Extend", minval=0, inline='extend', group="Style")
dynamic = input.bool(false, "Dynamic", inline='extend', group="Style")
bullCss = input.color(color.new(#089981, 70), "Bullish FVG", group="Style")
bearCss = input.color(color.new(#f23645, 70), "Bearish FVG", group="Style")
showDash = input.bool(false, "Show Dashboard", group="Dashboard")
dashLoc = input.string("Top Right", "Location", options= , group="Dashboard")
textSize = input.string("Small", "Text Size", options= , group="Dashboard")
type fvg
float max
float min
bool isbull
int t = time
method tosolid(color id) => color.rgb(color.r(id), color.g(id), color.b(id))
n = bar_index
detect() =>
var new_fvg = fvg.new(na, na, na, na)
threshold = auto ? ta.cum((high - low) / low) / bar_index : thresholdPer / 100
bull_fvg = low > high and close > high and (low - high ) / high > threshold
bear_fvg = high < low and close < low and (low - high) / high > threshold
if bull_fvg
new_fvg := fvg.new(low, high , true)
else if bear_fvg
new_fvg := fvg.new(low , high, false)
var float max_bull_fvg = na, var float min_bull_fvg = na, var bull_count = 0, var bull_mitigated = 0
var float max_bear_fvg = na, var float min_bear_fvg = na, var bear_count = 0, var bear_mitigated = 0
var t = 0
var fvg_records = array.new(0)
var fvg_areas = array.new(0)
= request.security(syminfo.tickerid, tf, detect())
if bull_fvg and new_fvg.t != t
if dynamic
max_bull_fvg := new_fvg.max
min_bull_fvg := new_fvg.min
if not dynamic
fvg_areas.unshift(box.new(n - 2, new_fvg.max, n + extend, new_fvg.min, na, bgcolor=bullCss))
fvg_records.unshift(new_fvg)
bull_count += 1
t := new_fvg.t
else if dynamic
max_bull_fvg := math.max(math.min(close, max_bull_fvg), min_bull_fvg)
if bear_fvg and new_fvg.t != t
if dynamic
max_bear_fvg := new_fvg.max
min_bear_fvg := new_fvg.min
if not dynamic
fvg_areas.unshift(box.new(n - 2, new_fvg.max, n + extend, new_fvg.min, na, bgcolor=bearCss))
fvg_records.unshift(new_fvg)
bear_count += 1
t := new_fvg.t
else if dynamic
min_bear_fvg := math.min(math.max(close, min_bear_fvg), max_bear_fvg)
// Mitigation logic
if fvg_records.size() > 0
for i = fvg_records.size() - 1 to 0
get = fvg_records.get(i)
if get.isbull and close < get.min
if mitigationLevels
line.new(get.t, get.min, time, get.min, xloc.bar_time, color=bullCss, style=line.style_dashed)
if not dynamic
area = fvg_areas.remove(i)
area.delete()
fvg_records.remove(i)
bull_mitigated += 1
else if not get.isbull and close > get.max
if mitigationLevels
line.new(get.t, get.max, time, get.max, xloc.bar_time, color=bearCss, style=line.style_dashed)
if not dynamic
area = fvg_areas.remove(i)
area.delete()
fvg_records.remove(i)
bear_mitigated += 1
// Unmitigated lines
var unmitigated = array.new(0)
if barstate.islast and showLast > 0 and fvg_records.size() > 0
for element in unmitigated
element.delete()
unmitigated.clear()
for i = 0 to math.min(showLast - 1, fvg_records.size() - 1)
get = fvg_records.get(i)
unmitigated.push(line.new(get.t, get.isbull ? get.min : get.max, time, get.isbull ? get.min : get.max, xloc.bar_time, color=get.isbull ? bullCss : bearCss))
// Dashboard
var table_position = dashLoc == 'Bottom Left' ? position.bottom_left : dashLoc == 'Top Right' ? position.top_right : position.bottom_right
var table_size = textSize == 'Tiny' ? size.tiny : textSize == 'Small' ? size.small : size.normal
var tb = table.new(table_position, 3, 3, bgcolor=#1e222d, border_color=#373a46, border_width=1, frame_color=#373a46, frame_width=1)
if showDash
if bar_index == 0
tb.cell(1, 0, "Bullish", text_color=bullCss.tosolid(), text_size=table_size)
tb.cell(2, 0, "Bearish", text_color=bearCss.tosolid(), text_size=table_size)
tb.cell(0, 1, "Count", text_color=color.white, text_size=table_size)
tb.cell(0, 2, "Mitigated", text_color=color.white, text_size=table_size)
if barstate.islast
tb.cell(1, 1, str.tostring(bull_count), text_color=bullCss.tosolid(), text_size=table_size)
tb.cell(2, 1, str.tostring(bear_count), text_color=bearCss.tosolid(), text_size=table_size)
tb.cell(1, 2, str.tostring(bull_mitigated / bull_count * 100, format.percent), text_color=bullCss.tosolid(), text_size=table_size)
tb.cell(2, 2, str.tostring(bear_mitigated / bear_count * 100, format.percent), text_color=bearCss.tosolid(), text_size=table_size)
// Plots for dynamic
max_bull_plot = plot(max_bull_fvg, color=na)
min_bull_plot = plot(min_bull_fvg, color=na)
fill(max_bull_plot, min_bull_plot, color=bullCss)
max_bear_plot = plot(max_bear_fvg, color=na)
min_bear_plot = plot(min_bear_fvg, color=na)
fill(max_bear_plot, min_bear_plot, color=bearCss)
// Alerts
alertcondition(bull_count > bull_count , "Bullish FVG", "Bullish FVG detected")
alertcondition(bear_count > bear_count , "Bearish FVG", "Bearish FVG detected")
alertcondition(bull_mitigated > bull_mitigated , "Bullish FVG Mitigation", "Bullish FVG mitigated")
alertcondition(bear_mitigated > bear_mitigated , "Bearish FVG Mitigation", "Bearish FVG mitigated")
Fiyat Hareket EtkinliğiA simple script I generated using ChatGPT to detect divergences in momentum and volume changes.
Sometimes, after a candle with strong momentum and high volume, the trend continues, but that level of volume and momentum is never reached again — which can signal a potential reversal.
Key-level-3.1 ob bb msb fvg
//@version=5
indicator("Key-level-3.1 ob bb msb fvg","key level 3" ,overlay = true, max_lines_count = 66, max_labels_count = 66)
// -----------------------------------------------------------------------------
// edited by berkusa
// -----------------------------------------------------------------------------
showprice= input.bool(true, title = "fiyatlari goster veya gosterme ")
///level func
f_create_level(_type, _start_condition, _active_condition, _global_level_array, _color, _line_width, _line_ext, _line_style, _label_size, _title, _iter, _is_enabled) =>
var float _price = na
var int _start_time = na
var float _hh = na
var float _ll = na
var line _price_line = line.new(x1 = na, y1 = na, x2 = na, y2 = na, xloc = xloc.bar_time, color = _color, width = _line_width, style = _line_style)
var label _price_label = label.new(x = na, y = na, xloc = xloc.bar_time, style = label.style_label_left, color = #00000000, size = _label_size, textcolor = _color)
_end_time = int(time + _line_ext * ta.change(time))
if _type == "open"
if _start_condition
_price := open
_start_time := time
else if _type == "high"
if _start_condition
_price := high
_start_time := time
else if _active_condition
_price := math.max(_price, high)
else if _type == "low"
if _start_condition
_price := low
_start_time := time
else if _active_condition
_price := math.min(_price, low)
else if _type == "eq"
if _start_condition
_hh := high
_ll := low
_price := math.avg(_hh, _ll)
_start_time := time
else if _active_condition
_hh := math.max(_hh, high)
_ll := math.min(_ll, low)
_price := math.avg(_hh, _ll)
float _price_val = _iter == 0 ? _price : ta.valuewhen(_start_condition, _price , _iter - 1)
int _start_time_val = _iter == 0 ? _start_time : ta.valuewhen(_start_condition, _start_time , _iter - 1)
_found_existing = array.indexof(_global_level_array, _price_val) > -1
if _is_enabled
if _found_existing
line.set_xy1(_price_line, x = na, y = na)
line.set_xy2(_price_line, x = na, y = na)
label.set_xy(_price_label, x = na, y = na)
else
array.push(_global_level_array, _price_val)
line.set_xy1(_price_line, x = _start_time_val, y = _price_val)
line.set_xy2(_price_line, x = _end_time, y = _price_val)
label.set_xy(_price_label, x = _end_time, y = _price_val)
label.set_text(_price_label , text = showprice? _title + " : " + str.tostring(_price_val): _title )
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// }
// Necessary Variables {
// -----------------------------------------------------------------------------
// Global arrays used to detect duplicate levels.
// Duplication is detected implicitly by execution order and whether the level has already been placed in the global array.
float global_open_array = array.new_float()
float global_high_array = array.new_float()
float global_low_array = array.new_float()
float global_eq_array = array.new_float()
new_H4 = ta.change(time("240")) != 0
new_day = ta.change(time("D")) != 0
new_week = ta.change(time("W")) != 0
new_month = ta.change(time("M")) != 0
new_quarter = ta.change(time("3M")) != 0
new_year = ta.change(time("12M")) != 0
is_monday = dayofweek == dayofweek.monday
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// }
// Global settings {
// -----------------------------------------------------------------------------
//inp_open_line_style = input.string("Solid", options = , title = "Open Line Style", group = "Global Settings")
//inp_high_line_style = input.string("Dashed", options = , title = "High Line Style", group = "Global Settings")
//inp_low_line_style = input.string("Dashed", options = , title = "Low Line Style", group = "Global Settings")
//inp_eq_line_style = input.string("Dotted", options = , title = "EQ Line Style", group = "Global Settings")
inp_open_line_style = "Solid"// input.string("Solid", options = , title = "Open Line Style", group = "Global Settings")
inp_high_line_style = "Dashed"// input.string("Dashed", options = , title = "High Line Style", group = "Global Settings")
inp_low_line_style = "Dashed"// input.string("Dashed", options = , title = "Low Line Style", group = "Global Settings")
inp_eq_line_style = "Dotted"// input.string("Dotted", options = , title = "EQ Line Style", group = "Global Settings")
inp_text_size = input.string("Small", options = , title = "Text Size", group = "Global Settings")
inp_ext = input.int(30, title = "Line Extension", group = "Global Settings")
text_size = inp_text_size == "Small" ? size.small : inp_text_size == "Normal" ? size.normal : size.large
open_line_style = inp_open_line_style == "Solid" ? line.style_solid : inp_open_line_style == "Dotted" ? line.style_dotted : line.style_dashed
high_line_style = inp_high_line_style == "Solid" ? line.style_solid : inp_high_line_style == "Dotted" ? line.style_dotted : line.style_dashed
low_line_style = inp_low_line_style == "Solid" ? line.style_solid : inp_low_line_style == "Dotted" ? line.style_dotted : line.style_dashed
eq_line_style = inp_eq_line_style == "Solid" ? line.style_solid : inp_eq_line_style == "Dotted" ? line.style_dotted : line.style_dashed
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// }
// H4 and Prev H4
// -----------------------------------------------------------------------------
h4 = input.bool(true, title = "H4", group = "H4 Levels", inline = "1")
inp_show_H4_open = input.bool(true, title = "OPEN", group = "H4 Levels", inline = "1")
inp_show_H4_high = input.bool(false, title = "HIGH", group = "H4 Levels", inline = "1")
inp_show_H4_low = input.bool(false, title = "LOW", group = "H4 Levels", inline = "1")
inp_show_H4_eq = input.bool(false, title = "EQ", group = "H4 Levels", inline = "1")
inp_H4_col = input.color(color.teal, title = "color", group = "H4 Levels", inline = "2")
inp_H4_line_width =1// input.int(1, title = "Line width", minval = 1, group = "H4 Levels", inline = "2")
H4_ok = timeframe.isintraday and timeframe.multiplier < 240
f_create_level("open", new_H4, not new_H4, global_open_array, inp_H4_col, inp_H4_line_width, inp_ext, open_line_style, text_size, "H4-O", 0, inp_show_H4_open and H4_ok and h4 )
f_create_level("high", new_H4, not new_H4, global_high_array, inp_H4_col, inp_H4_line_width, inp_ext, high_line_style, text_size, "H4-H", 0, inp_show_H4_high and H4_ok and h4 )
f_create_level("low", new_H4, not new_H4, global_low_array, inp_H4_col, inp_H4_line_width, inp_ext, low_line_style, text_size, "H4-L", 0, inp_show_H4_low and H4_ok and h4 )
f_create_level("eq", new_H4, not new_H4, global_eq_array, inp_H4_col, inp_H4_line_width, inp_ext, eq_line_style, text_size, "H4-EQ", 0, inp_show_H4_eq and H4_ok and h4 )
prev_H4 = input.bool(true, title = "P-H4", group = "Prev H4 Levels", inline = "1")
inp_show_prev_H4_open = input.bool(true, title = "OPEN", group = "Prev H4 Levels", inline = "1")
inp_show_prev_H4_high = input.bool(false, title = "HIGH", group = "Prev H4 Levels", inline = "1")
inp_show_prev_H4_low = input.bool(false, title = "LOW", group = "Prev H4 Levels", inline = "1")
inp_show_prev_H4_eq = input.bool(false, title = "EQ", group = "Prev H4 Levels", inline = "1")
inp_prev_H4_col = input.color(color.olive, title = "color", group = "Prev H4 Levels", inline = "2")
inp_prev_H4_line_width =1// input.int(1, title = "Line width", minval = 1, group = "Prev H4 Levels", inline = "2")
f_create_level("open", new_H4, not new_H4, global_open_array, inp_prev_H4_col, inp_prev_H4_line_width, inp_ext, open_line_style, text_size, "P-H4-O", 1, inp_show_prev_H4_open and H4_ok and prev_H4)
f_create_level("high", new_H4, not new_H4, global_high_array, inp_prev_H4_col, inp_prev_H4_line_width, inp_ext, high_line_style, text_size, "P-H4-H", 1, inp_show_prev_H4_high and H4_ok and prev_H4)
f_create_level("low", new_H4, not new_H4, global_low_array, inp_prev_H4_col, inp_prev_H4_line_width, inp_ext, low_line_style, text_size, "P-H4-L", 1, inp_show_prev_H4_low and H4_ok and prev_H4)
f_create_level("eq", new_H4, not new_H4, global_eq_array, inp_prev_H4_col, inp_prev_H4_line_width, inp_ext, eq_line_style, text_size, "P-H4-EQ", 1, inp_show_prev_H4_eq and H4_ok and prev_H4)
// -----------------------------------------------------------------------------
// Daily and Prev Daily
// -----------------------------------------------------------------------------
daily = input.bool(true, title = "D", group = "Daily Levels", inline = "1")
inp_show_daily_open = input.bool(true, title = "OPEN", group = "Daily Levels", inline = "1")
inp_show_daily_high = input.bool(true, title = "HIGH", group = "Daily Levels", inline = "1")
inp_show_daily_low = input.bool(true, title = "LOW", group = "Daily Levels", inline = "1")
inp_show_daily_eq = input.bool(true, title = "EQ", group = "Daily Levels", inline = "1")
inp_daily_col = input.color(color.silver, title = "color", group = "Daily Levels", inline = "2")
inp_daily_line_width =1// input.int(1, title = "Line width", minval = 1, group = "Daily Levels", inline = "2")
daily_ok = timeframe.isintraday
f_create_level("open", new_day, not new_day, global_open_array, inp_daily_col, inp_daily_line_width, inp_ext, open_line_style, text_size, "DO", 0, inp_show_daily_open and daily_ok and daily)
f_create_level("high", new_day, not new_day, global_high_array, inp_daily_col, inp_daily_line_width, inp_ext, high_line_style, text_size, "DH", 0, inp_show_daily_high and daily_ok and daily)
f_create_level("low", new_day, not new_day, global_low_array, inp_daily_col, inp_daily_line_width, inp_ext, low_line_style, text_size, "DL", 0, inp_show_daily_low and daily_ok and daily)
f_create_level("eq", new_day, not new_day, global_eq_array, inp_daily_col, inp_daily_line_width, inp_ext, eq_line_style, text_size, "D-EQ", 0, inp_show_daily_eq and daily_ok and daily)
prev_daily = input.bool(true, title = "PD", group = "Prev Daily Levels", inline = "1")
inp_show_prev_daily_open = input.bool(true, title = "OPEN", group = "Prev Daily Levels", inline = "1")
inp_show_prev_daily_high = input.bool(true, title = "HIGH", group = "Prev Daily Levels", inline = "1")
inp_show_prev_daily_low = input.bool(true, title = "LOW", group = "Prev Daily Levels", inline = "1")
inp_show_prev_daily_eq = input.bool(false, title = "EQ", group = "Prev Daily Levels", inline = "1")
inp_prev_daily_col = input.color(color.gray, title = "color", group = "Prev Daily Levels", inline = "2")
inp_prev_daily_line_width = 1//input.int(1, title = "Line width", minval = 1, group = "Prev Daily Levels", inline = "2")
dd = input.int(1, title = "dayback", minval = 1,maxval=7, group = "Prev Daily Levels", inline = "2")
if dd >= 1
f_create_level("open", new_day, not new_day, global_open_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, open_line_style, text_size, "P-DO", 1, inp_show_prev_daily_open and daily_ok and prev_daily )
f_create_level("high", new_day, not new_day, global_high_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, high_line_style, text_size, "P-DH", 1 , inp_show_prev_daily_high and daily_ok and prev_daily )
f_create_level("low", new_day, not new_day, global_low_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, low_line_style, text_size, "P-DL", 1, inp_show_prev_daily_low and daily_ok and prev_daily )
f_create_level("eq", new_day, not new_day, global_eq_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, eq_line_style, text_size, "P-D-EQ", 1, inp_show_prev_daily_eq and daily_ok and prev_daily )
if dd >= 2
f_create_level("open", new_day, not new_day, global_open_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, open_line_style, text_size, "P-DO-2", 2, inp_show_prev_daily_open and daily_ok and prev_daily )
f_create_level("high", new_day, not new_day, global_high_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, high_line_style, text_size, "P-DH-2", 2 , inp_show_prev_daily_high and daily_ok and prev_daily )
f_create_level("low", new_day, not new_day, global_low_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, low_line_style, text_size, "P-DL-2", 2, inp_show_prev_daily_low and daily_ok and prev_daily )
f_create_level("eq", new_day, not new_day, global_eq_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, eq_line_style, text_size, "P-D-EQ-2", 2, inp_show_prev_daily_eq and daily_ok and prev_daily )
if dd >= 3
f_create_level("open", new_day, not new_day, global_open_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, open_line_style, text_size, "P-DO-3", dd, inp_show_prev_daily_open and daily_ok and prev_daily )
f_create_level("high", new_day, not new_day, global_high_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, high_line_style, text_size, "P-DH-3", dd , inp_show_prev_daily_high and daily_ok and prev_daily )
f_create_level("low", new_day, not new_day, global_low_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, low_line_style, text_size, "P-DL-3", dd, inp_show_prev_daily_low and daily_ok and prev_daily )
f_create_level("eq", new_day, not new_day, global_eq_array, inp_prev_daily_col, inp_prev_daily_line_width, inp_ext, eq_line_style, text_size, "P-D-EQ-3", dd, inp_show_prev_daily_eq and daily_ok and prev_daily )
// -----------------------------------------------------------------------------
// Weekly and Prev Weekly
// -----------------------------------------------------------------------------
weekly = input.bool(true, title = "W", group = "Weekly Levels", inline = "1")
inp_show_weekly_open = input.bool(true, title = "OPEN", group = "Weekly Levels", inline = "1")
inp_show_weekly_high = input.bool(true, title = "HIGH", group = "Weekly Levels", inline = "1")
inp_show_weekly_low = input.bool(true, title = "LOW", group = "Weekly Levels", inline = "1")
inp_show_weekly_eq = input.bool(false, title = "EQ", group = "Weekly Levels", inline = "1")
inp_weekly_col = input.color(color.aqua, title = "color", group = "Weekly Levels", inline = "2")
inp_weekly_line_width =1// input.int(1, title = "Line width", minval = 1, group = "Weekly Levels", inline = "2")
weekly_ok = timeframe.isintraday or timeframe.isdaily
f_create_level("open", new_week, not new_week, global_open_array, inp_weekly_col, inp_weekly_line_width, inp_ext, open_line_style, text_size, "WO", 0, inp_show_weekly_open and weekly_ok and weekly )
f_create_level("high", new_week, not new_week, global_high_array, inp_weekly_col, inp_weekly_line_width, inp_ext, high_line_style, text_size, "WH", 0, inp_show_weekly_high and weekly_ok and weekly )
f_create_level("low", new_week, not new_week, global_low_array, inp_weekly_col, inp_weekly_line_width, inp_ext, low_line_style, text_size, "WL", 0, inp_show_weekly_low and weekly_ok and weekly )
f_create_level("eq", new_week, not new_week, global_eq_array, inp_weekly_col, inp_weekly_line_width, inp_ext, eq_line_style, text_size, "W-EQ", 0, inp_show_weekly_eq and weekly_ok and weekly )
prev_weekly = input.bool(true, title = "PW", group = "Prev Weekly Levels", inline = "1")
inp_show_prev_weekly_open = input.bool(true, title = "OPEN", group = "Prev Weekly Levels", inline = "1")
inp_show_prev_weekly_high = input.bool(false, title = "HIGH", group = "Prev Weekly Levels", inline = "1")
inp_show_prev_weekly_low = input.bool(false, title = "LOW", group = "Prev Weekly Levels", inline = "1")
inp_show_prev_weekly_eq = input.bool(false, title = "EQ", group = "Prev Weekly Levels", inline = "1")
inp_prev_weekly_col = input.color(color.blue, title = "color", group = "Prev Weekly Levels", inline = "2")
inp_prev_weekly_line_width = 1//input.int(1, title = "Line width", minval = 1, group = "Prev Weekly Levels", inline = "2")
ww = input.int(1, title = "weekback", minval = 1,maxval=5, group = "Prev Weekly Levels", inline = "2")
f_create_level("open", new_week, not new_week, global_open_array, inp_prev_weekly_col, inp_prev_weekly_line_width, inp_ext, open_line_style, text_size, "P-WO", ww, inp_show_prev_weekly_open and weekly_ok and prev_weekly)
f_create_level("high", new_week, not new_week, global_high_array, inp_prev_weekly_col, inp_prev_weekly_line_width, inp_ext, high_line_style, text_size, "P-WH", ww, inp_show_prev_weekly_high and weekly_ok and prev_weekly)
f_create_level("low", new_week, not new_week, global_low_array, inp_prev_weekly_col, inp_prev_weekly_line_width, inp_ext, low_line_style, text_size, "P-WL", ww, inp_show_prev_weekly_low and weekly_ok and prev_weekly)
f_create_level("eq", new_week, not new_week, global_eq_array, inp_prev_weekly_col, inp_prev_weekly_line_width, inp_ext, eq_line_style, text_size, "P-W-EQ", ww, inp_show_prev_weekly_eq and weekly_ok and prev_weekly)
// Monday and Prev Monday
// -----------------------------------------------------------------------------
// Note : Monday range is a special case and is why the _active_condition is implemented in the function. We only want start on Monday, and ONLY update levels during monday.
monday_open = input.bool(false, title = "MonD", group = "Monday Levels", inline = "1")
inp_show_monday_open = input.bool(false, title = "OPEN", group = "Monday Levels", inline = "1")
inp_show_monday_high = input.bool(false, title = "HIGH", group = "Monday Levels", inline = "1")
inp_show_monday_low = input.bool(false, title = "LOW", group = "Monday Levels", inline = "1")
inp_show_monday_eq = input.bool(false, title = "EQ", group = "Monday Levels", inline = "1")
inp_monday_col = input.color(color.fuchsia, title = "color", group = "Monday Levels", inline = "2")
inp_monday_line_width = 1//input.int(1, title = "Line width", minval = 1, group = "Monday Levels", inline = "2")
monday_ok = timeframe.isintraday
f_create_level("open", new_week, is_monday, global_open_array, inp_monday_col, inp_monday_line_width, inp_ext, open_line_style, text_size, "M.Day-O", 0, inp_show_monday_open and monday_ok and monday_open)
f_create_level("high", new_week, is_monday, global_high_array, inp_monday_col, inp_monday_line_width, inp_ext, high_line_style, text_size, "M.Day-H", 0, inp_show_monday_high and monday_ok and monday_open)
f_create_level("low", new_week, is_monday, global_low_array, inp_monday_col, inp_monday_line_width, inp_ext, low_line_style, text_size, "M.Day-L", 0, inp_show_monday_low and monday_ok and monday_open)
f_create_level("eq", new_week, is_monday, global_eq_array, inp_monday_col, inp_monday_line_width, inp_ext, eq_line_style, text_size, "M.Day-EQ", 0, inp_show_monday_eq and monday_ok and monday_open)
prev_monday = input.bool(false, title = "p-mon", group = "Prev Monday Levels", inline = "1")
inp_show_prev_monday_open = input.bool(false, title = "OPEN", group = "Prev Monday Levels", inline = "1")
inp_show_prev_monday_high = input.bool(false, title = "HIGH", group = "Prev Monday Levels", inline = "1")
inp_show_prev_monday_low = input.bool(false, title = "LOW", group = "Prev Monday Levels", inline = "1")
inp_show_prev_monday_eq = input.bool(false, title = "EQ", group = "Prev Monday Levels", inline = "1")
inp_prev_monday_col = input.color(color.purple, title = "color", group = "Prev Monday Levels", inline = "2")
inp_prev_monday_line_width = 1//input.int(1, title = "Line width", minval = 1, group = "Prev Monday Levels", inline = "2")
f_create_level("open", new_week, is_monday, global_open_array, inp_prev_monday_col, inp_prev_monday_line_width, inp_ext, open_line_style, text_size, "P-M.Day-O", 1, inp_show_prev_monday_open and monday_ok and prev_monday and prev_monday)
f_create_level("high", new_week, is_monday, global_high_array, inp_prev_monday_col, inp_prev_monday_line_width, inp_ext, high_line_style, text_size, "P-M.Day-H", 1, inp_show_prev_monday_high and monday_ok and prev_monday and prev_monday)
f_create_level("low", new_week, is_monday, global_low_array, inp_prev_monday_col, inp_prev_monday_line_width, inp_ext, low_line_style, text_size, "P-M.Day-L", 1, inp_show_prev_monday_low and monday_ok and prev_monday and prev_monday)
f_create_level("eq", new_week, is_monday, global_eq_array, inp_prev_monday_col, inp_prev_monday_line_width, inp_ext, eq_line_style, text_size, "P-M.Day-EQ", 1, inp_show_prev_monday_eq and monday_ok and prev_monday and prev_monday)
// -----------------------------------------------------------------------------
// Monthly and Prev Monthly
// -----------------------------------------------------------------------------
monthly = input.bool(true, title = "M", group = "Monthly Levels", inline = "1")
inp_show_monthly_open = input.bool(true, title = "OPEN", group = "Monthly Levels", inline = "1")
inp_show_monthly_high = input.bool(true, title = "HIGH", group = "Monthly Levels", inline = "1")
inp_show_monthly_low = input.bool(true, title = "LOW", group = "Monthly Levels", inline = "1")
inp_show_monthly_eq = input.bool(false, title = "EQ", group = "Monthly Levels", inline = "1")
inp_monthly_col = input.color(color.lime, title = "color", group = "Monthly Levels", inline = "2")
inp_monthly_line_width = 1//input.int(1, title = "Line width", minval = 1 ,group = "Monthly Levels", inline = "2")
monthly_ok = timeframe.isintraday or timeframe.isdaily
f_create_level("open", new_month, not new_month, global_open_array, inp_monthly_col, inp_monthly_line_width, inp_ext, open_line_style, text_size, "MO", 0, inp_show_monthly_open and monthly_ok and monthly )
f_create_level("high", new_month, not new_month, global_high_array, inp_monthly_col, inp_monthly_line_width, inp_ext, high_line_style, text_size, "MH", 0, inp_show_monthly_high and monthly_ok and monthly )
f_create_level("low", new_month, not new_month, global_low_array, inp_monthly_col, inp_monthly_line_width, inp_ext, low_line_style, text_size, "ML", 0, inp_show_monthly_low and monthly_ok and monthly )
f_create_level("eq", new_month, not new_month, global_eq_array, inp_monthly_col, inp_monthly_line_width, inp_ext, eq_line_style, text_size, "M-EQ", 0, inp_show_monthly_eq and monthly_ok and monthly )
prev_monthly = input.bool(true, title = "PM", group = "Prev Monthly Levels", inline = "1")
inp_show_prev_monthly_open = input.bool(true, title = "OPEN", group = "Prev Monthly Levels", inline = "1")
inp_show_prev_monthly_high = input.bool(false, title = "HIGH", group = "Prev Monthly Levels", inline = "1")
inp_show_prev_monthly_low = input.bool(false, title = "LOW", group = "Prev Monthly Levels", inline = "1")
inp_show_prev_monthly_eq = input.bool(false, title = "EQ", group = "Prev Monthly Levels", inline = "1")
inp_prev_monthly_col = input.color(color.green, title = "color", group = "Prev Monthly Levels", inline = "2")
inp_prev_monthly_line_width =1// input.int(1, title = "Line width", minval = 1, group = "Prev Monthly Levels", inline = "2")
mm = input.int(1, title = "monthback", minval = 1,maxval=13, group = "Prev Monthly Levels", inline = "2")
f_create_level("open", new_month, not new_month, global_open_array, inp_prev_monthly_col, inp_prev_monthly_line_width, inp_ext, open_line_style, text_size, "P-MO", mm, inp_show_prev_monthly_open and monthly_ok and prev_monthly and prev_monthly )
f_create_level("high", new_month, not new_month, global_high_array, inp_prev_monthly_col, inp_prev_monthly_line_width, inp_ext, high_line_style, text_size, "P-MH", mm, inp_show_prev_monthly_high and monthly_ok and prev_monthly and prev_monthly )
f_create_level("low", new_month, not new_month, global_low_array, inp_prev_monthly_col, inp_prev_monthly_line_width, inp_ext, low_line_style, text_size, "P-ML", mm, inp_show_prev_monthly_low and monthly_ok and prev_monthly and prev_monthly )
f_create_level("eq", new_month, not new_month, global_eq_array, inp_prev_monthly_col, inp_prev_monthly_line_width, inp_ext, eq_line_style, text_size, "P-M-EQ", mm, inp_show_prev_monthly_eq and monthly_ok and prev_monthly and prev_monthly )
// -----------------------------------------------------------------------------
// Quarterly and Prev Quarterly
// -----------------------------------------------------------------------------
quarterly = input.bool(false, title = "Q", group = "Quarterly Levels", inline = "1")
inp_show_quarterly_open = input.bool(false, title = "OPEN", group = "Quarterly Levels", inline = "1")
inp_show_quarterly_high = input.bool(false, title = "HIGH", group = "Quarterly Levels", inline = "1")
inp_show_quarterly_low = input.bool(false, title = "LOW", group = "Quarterly Levels", inline = "1")
inp_show_quarterly_eq = input.bool(false, title = "EQ", group = "Quarterly Levels", inline = "1")
inp_quarterly_col = input.color(color.orange, title = "color", group = "Quarterly Levels", inline = "2")
inp_quarterly_line_width = 1//input.int(1, title = "Line width", minval = 1, group = "Quarterly Levels", inline = "2")
quarterly_ok = timeframe.isintraday or timeframe.isdaily or timeframe.isweekly
f_create_level("open", new_quarter, not new_quarter, global_open_array, inp_quarterly_col, inp_quarterly_line_width, inp_ext, open_line_style, text_size, "3M-O", 0, inp_show_quarterly_open and quarterly_ok and quarterly)
f_create_level("high", new_quarter, not new_quarter, global_high_array, inp_quarterly_col, inp_quarterly_line_width, inp_ext, high_line_style, text_size, "3M-H", 0, inp_show_quarterly_high and quarterly_ok and quarterly)
f_create_level("low", new_quarter, not new_quarter, global_low_array, inp_quarterly_col, inp_quarterly_line_width, inp_ext, low_line_style, text_size, "3M-L", 0, inp_show_quarterly_low and quarterly_ok and quarterly)
f_create_level("eq", new_quarter, not new_quarter, global_eq_array, inp_quarterly_col, inp_quarterly_line_width, inp_ext, eq_line_style, text_size, "3M-EQ", 0, inp_show_quarterly_eq and quarterly_ok and quarterly)
prev_quarterly = input.bool(false, title = "PQ", group = "Prev Quarterly Levels", inline = "1")
inp_show_prev_quarterly_open = input.bool(false, title = "OPEN", group = "Prev Quarterly Levels", inline = "1")
inp_show_prev_quarterly_high = input.bool(false, title = "HIGH", group = "Prev Quarterly Levels", inline = "1")
inp_show_prev_quarterly_low = input.bool(false, title = "LOW", group = "Prev Quarterly Levels", inline = "1")
inp_show_prev_quarterly_eq = input.bool(false, title = "EQ", group = "Prev Quarterly Levels", inline = "1")
inp_prev_quarterly_col = input.color(color.yellow, title = "color", group = "Prev Quarterly Levels", inline = "2")
inp_prev_quarterly_line_width = 1//input.int(1, title = "Line width", minval = 1, group = "Prev Quarterly Levels", inline = "2")
qq = input.int(1, title = "Quarterback", minval = 1,maxval=12, group = "Prev Quarterly Levels", inline = "2")
f_create_level("open", new_quarter, not new_quarter, global_open_array, inp_prev_quarterly_col, inp_prev_quarterly_line_width, inp_ext, open_line_style, text_size, "P 3MOpen", mm, inp_show_prev_quarterly_open and quarterly_ok and prev_quarterly and qq)
f_create_level("high", new_quarter, not new_quarter, global_high_array, inp_prev_quarterly_col, inp_prev_quarterly_line_width, inp_ext, high_line_style, text_size, "Prev 3MHIGH", mm, inp_show_prev_quarterly_high and quarterly_ok and prev_quarterly and qq)
f_create_level("low", new_quarter, not new_quarter, global_low_array, inp_prev_quarterly_col, inp_prev_quarterly_line_width, inp_ext, low_line_style, text_size, "P-3MLOW", mm, inp_show_prev_quarterly_low and quarterly_ok and prev_quarterly and qq)
f_create_level("eq", new_quarter, not new_quarter, global_eq_array, inp_prev_quarterly_col, inp_prev_quarterly_line_width, inp_ext, eq_line_style, text_size, "P-3M-EQ", mm, inp_show_prev_quarterly_eq and quarterly_ok and prev_quarterly and qq)
// -----------------------------------------------------------------------------
// Yearly & Prev Yearly
// -----------------------------------------------------------------------------
yearly = input.bool(false, title = "Y", group = "Yearly Levels", inline = "1")
inp_show_yearly_open = input.bool(false, title = "OPEN", group = "Yearly Levels", inline = "1")
inp_show_yearly_high = input.bool(false, title = "HIGH", group = "Yearly Levels", inline = "1")
inp_show_yearly_low = input.bool(false, title = "LOW", group = "Yearly Levels", inline = "1")
inp_show_yearly_eq = input.bool(false, title = "EQ", group = "Yearly Levels", inline = "1")
inp_yearly_col = input.color(color.red, title = "color", group = "Yearly Levels", inline = "2")
inp_yearly_line_width = input.int(1, title = "Line width", minval = 1, group = "Yearly Levels", inline = "2")
yearly_ok = timeframe.isintraday or timeframe.isdaily or timeframe.isweekly or (timeframe.ismonthly and timeframe.multiplier < 12)
f_create_level("open", new_year, not new_year, global_open_array, inp_yearly_col, inp_yearly_line_width, inp_ext, open_line_style, text_size, "YO", 0, inp_show_yearly_open and yearly_ok)
f_create_level("high", new_year, not new_year, global_high_array, inp_yearly_col, inp_yearly_line_width, inp_ext, high_line_style, text_size, "Yearly HIGH", 0, inp_show_yearly_high and yearly_ok)
f_create_level("low", new_year, not new_year, global_low_array, inp_yearly_col, inp_yearly_line_width, inp_ext, low_line_style, text_size, "Yearly LOW", 0, inp_show_yearly_low and yearly_ok)
f_create_level("eq", new_year, not new_year, global_eq_array, inp_yearly_col, inp_yearly_line_width, inp_ext, eq_line_style, text_size, "Yearly EQ", 0, inp_show_yearly_eq and yearly_ok)
prev_yearly = input.bool(false, title = "PY", group = "Prev Yearly Levels", inline = "1")
inp_show_prev_yearly_open = input.bool(false, title = "OPEN", group = "Prev Yearly Levels", inline = "1")
inp_show_prev_yearly_high = input.bool(false, title = "HIGH", group = "Prev Yearly Levels", inline = "1")
inp_show_prev_yearly_low = input.bool(false, title = "LOW", group = "Prev Yearly Levels", inline = "1")
inp_show_prev_yearly_eq = input.bool(false, title = "EQ", group = "Prev Yearly Levels", inline = "1")
inp_prev_yearly_col = input.color(color.maroon, title = "color", group = "Prev Yearly Levels", inline = "2")
inp_prev_yearly_line_width = input.int(1, title = "Line width", minval = 1, group = "Prev Yearly Levels", inline = "2")
yy = input.int(1, title = "yearback", minval = 1, maxval=2, group = "Prev Yearly Levels", inline = "2")
f_create_level("open", new_year, not new_year, global_open_array, inp_prev_yearly_col, inp_prev_yearly_line_width, inp_ext, open_line_style, text_size, "P-YO", yy, inp_show_prev_yearly_open and yearly_ok and prev_yearly)
f_create_level("high", new_year, not new_year, global_high_array, inp_prev_yearly_col, inp_prev_yearly_line_width, inp_ext, high_line_style, text_size, "Prev Yearly HIGH", yy, inp_show_prev_yearly_high and yearly_ok and prev_yearly)
f_create_level("low", new_year, not new_year, global_low_array, inp_prev_yearly_col, inp_prev_yearly_line_width, inp_ext, low_line_style, text_size, "Prev Yearly LOW", yy, inp_show_prev_yearly_low and yearly_ok and prev_yearly)
f_create_level("eq", new_year, not new_year, global_eq_array, inp_prev_yearly_col, inp_prev_yearly_line_width, inp_ext, eq_line_style, text_size, "Prev Yearly EQ", yy, inp_show_prev_yearly_eq and yearly_ok and prev_yearly)
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//imbalance finder
color gray0 = color.new(color.gray, 0)
color yellow0 = color.new(#FFF700, 0)
bool showgreydiamond = input(defval=false, title='İmbalance back test helper' ,group='=== Information ===')
bool showib = input(defval=false, title='İmbalance bar' ,group='=== Information ===')
Imbcol = input.color(yellow0, 'Imbalance Color', inline="1" ,group='=== Information ===')
Dimcol = input.color(gray0, 'Imbalance back test diamond color', inline="1" ,group='=== Information ===')
TopImbalance = low <= open and high >= close
TopImbalancesize = low - high
if TopImbalance and showib and TopImbalancesize > 0
BOX1 = box.new(left=bar_index , top=low , right=bar_index , bottom=high )
box.set_bgcolor(BOX1, na)
box.set_border_color(BOX1, Imbcol )
//plot(TopImbalance and TopImbalancesize > 0 ? low : na , color=Imbcol)
//plot(TopImbalance and TopImbalancesize > 0 ? high : na , color=Imbcol)
BottomImbalance = high >= open and low <= close
BottomImbalancesize = low - high
if BottomImbalance and showib and BottomImbalancesize > 0
BOX2 = box.new(left=bar_index , top=low , right=bar_index , bottom=high )
box.set_bgcolor(BOX2, na )
box.set_border_color(BOX2, Imbcol )
//plot(BottomImbalance and BottomImbalancesize > 0 ? low : na , color=Imbcol)
//plot(BottomImbalance and BottomImbalancesize > 0 ? high : na , color=Imbcol)
DownImbalance = TopImbalance and TopImbalancesize > 0
plotshape(DownImbalance and showgreydiamond, style=shape.diamond, location=location.abovebar, color=Dimcol, size=size.tiny)
UpImbalance = BottomImbalance and BottomImbalancesize > 0
plotshape(UpImbalance and showgreydiamond, style=shape.diamond, location=location.belowbar, color=Dimcol, size=size.tiny)
alertcondition(DownImbalance , title='Down Imbalance', message='Down Imbalance')
alertcondition(UpImbalance , title='Up Imbalance', message='Up Imbalance')
alertcondition(DownImbalance or UpImbalance , title='Imbalance Present ', message='Imbalance Present')
// MBS
//indicator(title='Order Blocks', overlay=true)
bool msb_a_sv = input.bool (true, title='Alert MSB')
bool msb_sv = input.bool (true, title='Plot MSB lines')
color mbs_color1 = input.color(#00e1ff, title='MSB Color Bullish')
color mbs_color2 = input.color(#ff00bf, title='MSB Color Bearish')
bool box_sv = input.bool (false, title='Plot Orderblocks')
color u_s = input.color (color.rgb(255, 0, 0, 90), title='Untested Supply Color')
color t_s = input.color (color.rgb(192, 192, 192, 93), title='Tested Supply Color')
color u_d = input.color (color.rgb(0, 255, 0, 90), title='Untested Demand Color')
color t_d = input.color (color.rgb(192, 192, 192, 93), title='Tested Demand Color')
bool m_sv = input.bool (false, title='Plot Breakerblocks')
color u_b = input.color (color.new(color.blue, 90), title='Untested Breaker Color')
color t_b = input.color (color.rgb(192, 192, 192, 90), title='Tested Breaker Color')
bool ob_a_sv = input.bool (false, title='Alert Orderblock test')
bool bb_a_sv = input.bool (false, title='Alert Breakerblock test')
bool r_a_sv = input.bool (false, title='Alert New Range')
bool rt_a_sv = input.bool (false, title='Alert Range test')
var float pvh1_price = array.new_float (30, na) // high
var int pvh1_time = array.new_int (30, na)
var float pvl1_price = array.new_float (30, na) // low
var int pvl1_time = array.new_int (30, na)
var float pvh2_price = array.new_float (10, na) // higher high
var int pvh2_time = array.new_int (10, na)
var float pvl2_price = array.new_float (10, na) // lower low
var int pvl2_time = array.new_int (10, na)
var float htcmrll_price = na // high that created most recent ll
var int htcmrll_time = na
var float ltcmrhh_price = na // low that created most recent hh
var int ltcmrhh_time = na
var box long_boxes = array.new_box() // orderblocks
var box short_boxes = array.new_box()
var box m_long_boxes = array.new_box() // breakerblocks
var box m_short_boxes = array.new_box()
var line bull_bos_lines = array.new_line() // MSB lines
var line bear_bos_lines = array.new_line()
var line range_h_lines = array.new_line() // Range lines
var line range_25_lines = array.new_line()
var line range_m_lines = array.new_line()
var line range_75_lines = array.new_line()
var line range_l_lines = array.new_line()
var label la_ph2 = array.new_label() // 2nd order pivots
var label la_pl2 = array.new_label()
var float temp_pv_0 = na
var float temp_pv_1 = na
var float temp_pv_2 = na
var int temp_time = na
var float last_range_h = na
var float last_range_l = na
var line range_m = na
var line range_25 = na
var line range_75 = na
var float box_top = na
var float box_bottom = na
var int h_a_time = 0
var int l_a_time = 0
var int mh_a_time = 0
var int ml_a_time = 0
var int rh_a_time = 0
var int rl_a_time = 0
bool pvh = high < high and high > high
bool pvl = low > low and low < low
int pv1_time = bar_index
float pv1_high = high
float pv1_low = low
bool new_ph_2nd = false
bool new_pl_2nd = false
string alert = na
if barstate.isconfirmed
if pvh
array.pop(pvh1_price)
array.pop(pvh1_time)
array.unshift(pvh1_price, pv1_high)
array.unshift(pvh1_time, pv1_time)
if array.size(pvh1_price) > 2
temp_pv_0 := array.get(pvh1_price, 0)
temp_pv_1 := array.get(pvh1_price, 1)
temp_pv_2 := array.get(pvh1_price, 2)
if temp_pv_0 < temp_pv_1 and temp_pv_1 > temp_pv_2
array.pop(pvh2_price)
array.pop(pvh2_time)
array.unshift(pvh2_price, temp_pv_1)
array.unshift(pvh2_time, array.get(pvh1_time, 1))
new_ph_2nd := true
if temp_pv_1 > array.get(pvh2_price, 1)
for i = 0 to array.size(pvl2_time) - 1 by 1
temp_ltcmrhh_time = array.get(pvl2_time, i)
if temp_ltcmrhh_time < array.get(pvh2_time, 0)
ltcmrhh_price := array.get(pvl2_price, i)
ltcmrhh_time := temp_ltcmrhh_time
break
if temp_pv_0 < ltcmrhh_price
if msb_sv
array.push(bear_bos_lines, line.new(x1=ltcmrhh_time, y1=ltcmrhh_price, x2=bar_index, y2=ltcmrhh_price, color=mbs_color2, width=2))
box_top := array.get(pvh2_price, 0)
box_bottom := math.max(low , low )
array.push(short_boxes, box.new(left=array.get(pvh2_time, 0), top=box_top, right=bar_index, bottom=box_bottom, bgcolor= box_sv ? u_s : na , border_color=na, extend=extend.right))
if msb_a_sv
alert := alert + 'Bearish MSB @ ' + str.tostring(ltcmrhh_price) + ' ' + 'New Supply Zone : '+ str.tostring(box_top) + ' - ' + str.tostring(box_bottom) + ' '
ltcmrhh_price := na
if pvl
array.pop(pvl1_price)
array.pop(pvl1_time)
array.unshift(pvl1_price, pv1_low)
array.unshift(pvl1_time, pv1_time)
if array.size(pvl1_price) > 2
temp_pv_0 := array.get(pvl1_price, 0)
temp_pv_1 := array.get(pvl1_price, 1)
temp_pv_2 := array.get(pvl1_price, 2)
if temp_pv_0 > temp_pv_1 and temp_pv_1 < temp_pv_2
array.pop(pvl2_price)
array.pop(pvl2_time)
array.unshift(pvl2_price, temp_pv_1)
array.unshift(pvl2_time, array.get(pvl1_time, 1))
new_pl_2nd := true
if temp_pv_1 < array.get(pvl2_price, 1)
for i = 0 to array.size(pvh2_time) - 1 by 1
temp_htcmrll_time = array.get(pvh2_time, i)
if temp_htcmrll_time < array.get(pvl2_time, 0)
htcmrll_price := array.get(pvh2_price, i)
htcmrll_time := temp_htcmrll_time
break
if temp_pv_0 > htcmrll_price
if msb_sv
array.push(bull_bos_lines, line.new(x1=htcmrll_time, y1=htcmrll_price, x2=bar_index, y2=htcmrll_price, color=mbs_color1, width=2))
box_top := math.min(high , high )
box_bottom := array.get(pvl2_price, 0)
array.push(long_boxes, box.new(left=array.get(pvl2_time, 0), top=box_top, right=bar_index, bottom=box_bottom, bgcolor= box_sv ? u_d : na, border_color=na, extend=extend.right))
if msb_a_sv
alert := alert + 'Bullish MSB @ ' + str.tostring(htcmrll_price) + ' ' + 'New Demand Zone : '+ str.tostring(box_bottom) + ' - ' + str.tostring(box_top) + ' '
htcmrll_price := na
if array.size(short_boxes) > 0
for i = array.size(short_boxes) - 1 to 0 by 1
tbox = array.get(short_boxes, i)
top = box.get_top(tbox)
bottom = box.get_bottom(tbox)
ago = box.get_left(tbox)
if array.get(pvh1_price, 0) > bottom
if box_sv
box.set_bgcolor(tbox, t_s)
if ob_a_sv and close < bottom
if array.get(pvh1_time, 0) != h_a_time
h_a_time := array.get(pvh1_time, 0)
alert := alert + 'Supply Zone Test @ ' + str.tostring(array.get(pvh1_price, 0)) + ' (age = ' + str.tostring(bar_index-ago) + ' bars) '
if array.get(pvl1_price, 0) > top
if m_sv
box.set_bgcolor(tbox, u_b)
array.push(m_long_boxes, tbox)
else
box.delete(tbox)
array.remove(short_boxes, i)
if msb_sv
line.delete(array.get(bear_bos_lines, i))
array.remove(bear_bos_lines, i)
if array.size(long_boxes) > 0
for i = array.size(long_boxes) - 1 to 0 by 1
lbox = array.get(long_boxes, i)
top = box.get_top(lbox)
bottom = box.get_bottom(lbox)
ago = box.get_left(lbox)
if array.get(pvl1_price, 0) < top
if box_sv
box.set_bgcolor(lbox, t_d)
if ob_a_sv and close > top
if array.get(pvl1_time, 0) != l_a_time
l_a_time := array.get(pvl1_time, 0)
alert := alert + 'Demand Zone Test @ ' + str.tostring(array.get(pvl1_price, 0)) + ' (age = ' + str.tostring(bar_index-ago) + ' bars) '
if array.get(pvh1_price, 0) < bottom
if m_sv
box.set_bgcolor(lbox, u_b)
array.push(m_short_boxes, lbox)
else
box.delete(lbox)
array.remove(long_boxes, i)
if msb_sv
line.delete(array.get(bull_bos_lines, i))
array.remove(bull_bos_lines, i)
if array.size(m_short_boxes) > 0
for i = array.size(m_short_boxes) - 1 to 0 by 1
tbox = array.get(m_short_boxes, i)
top = box.get_top(tbox)
bottom = box.get_bottom(tbox)
ago = box.get_left(tbox)
if array.get(pvh1_price, 0) > bottom
box.set_bgcolor(tbox, t_b)
if bb_a_sv and close < bottom
if array.get(pvh1_time, 0) != mh_a_time
mh_a_time := array.get(pvh1_time, 0)
alert := alert + 'Breakerblock Test Up @ ' + str.tostring(array.get(pvh1_price, 0)) + ' (age = ' + str.tostring(bar_index-ago) + ' bars) '
if array.get(pvl1_price, 0) > top
box.delete(tbox)
array.remove(m_short_boxes, i)
if array.size(m_long_boxes) > 0
for i = array.size(m_long_boxes) - 1 to 0 by 1
lbox = array.get(m_long_boxes, i)
top = box.get_top(lbox)
bottom = box.get_bottom(lbox)
ago = box.get_left(lbox)
if array.get(pvl1_price, 0) < top
box.set_bgcolor(lbox, t_b)
if bb_a_sv and close > top
if array.get(pvl1_time, 0) != ml_a_time
ml_a_time := array.get(pvl1_time, 0)
alert := alert + 'Breakerblock Test Down @ ' + str.tostring(array.get(pvl1_price, 0)) + ' (age = ' + str.tostring(bar_index-ago) + ' bars) '
if array.get(pvh1_price, 0) < bottom
box.delete(lbox)
array.remove(m_long_boxes, i)
alert := not na(alert) ? (alert + 'Current price = ' + str.tostring(close) + ' ') : na
exec = not na(alert) ? true : false
if exec==true
alert(alert, alert.freq_once_per_bar_close)
CANDLESThe script is designed to display Higher Timeframe (HTF) candles on a chart, with a maximum of 6 candle sets
VWAP + Volume Spike + Momentum (Options)it is regarding vwasp stategy and how it willperform on vwap and movmentum
P-Motion Trend | QuantEdgeB⚡ Introducing P-Motion Trend (PMT) by QuantEdgeB
🧭 Overview
P-Motion Trend is a refined trend-following framework built for modern market dynamics. It combines DEMA filtering, percentile-based smoothing, and volatility-adjusted envelopes to create a clear, noise-filtered trend map directly on your chart.
This overlay indicator is engineered to detect breakout zones, trend continuation setups, and market regime shifts with maximum clarity and minimum lag.
Whether you're swing trading crypto, managing intraday FX moves, or positioning in equities — P-Motion Trend adapts, aligns, and simplifies.
🧠 Core Logic
1️⃣ DEMA Filtering Core
The input source is processed through a Double EMA to reduce lag while retaining trend sensitivity.
2️⃣ Percentile Median Smoothing
To eliminate short-lived spikes, the DEMA output is passed through a percentile median rank — effectively smoothing without distortion.
3️⃣ Volatility Envelope with EMA Basis
An exponential moving average (EMA) is applied to the smoothed median, and standard deviation bands are wrapped around it:
• ✅ Long Signal → Price closes above the upper band
• ❌ Short Signal → Price closes below the lower band
• ➖ Inside Band = Neutral
These bands expand/contract with market volatility — protecting against false breakouts in quiet regimes and adapting quickly to strong moves.
📊 Visual & Analytical Layers
• 🎯 Bar Coloring: Color-coded candles highlight trend state at a glance.
• 📈 EMA Ribbon Overlay: A dynamic ribbon of EMAs helps confirm internal momentum and detect transitions (trend decay or acceleration).
• 🔹Gradient Fill Zones: Visually communicates squeeze vs. expansion phases based on band width.
⚙️ Custom Settings
• EMA Length – Defines the core trend path (default: 21)
• SD Length – Controls volatility band smoothing (default: 30)
• SD Mult Up/Down – Sets thresholds for breakout confirmation (default: 1.5)
• DEMA Filter Source – Raw input used for trend processing
• DEMA Filter Length – Sets DEMA smoothing (default: 7)
• Median Length – Percentile-based smoothing window (default: 2)
📌 Use Cases
✅ Trend Confirmation
Use PMT to confirm whether the price action is structurally valid for trend continuation. A close above the upper band signals entry alignment.
🛡️ Reversal Guard
Avoid early reversion entries. PMT keeps you in-trend until price truly breaks structure.
🔍 Momentum Visualizer
With multiple EMA bands, the indicator also functions as a momentum envelope to spot divergence between price and smoothed trend flow.
🔚 Conclusion
P-Motion Trend is a hybrid volatility + trend system built with precision smoothing, dynamic filtering, and clean visual output. It balances agility with stability, helping you:
• Filter out price noise
• Enter with structure
• Stay in trades longer
• Exit with confidence
🧩 Summary of Benefits
• 🔹 Lag-minimized trend structure via DEMA core
• 🔹 Real-time volatility band adaptation
• 🔹 Gradient visual feedback on compression/expansion
• 🔹 EMA ribbon assists in phase detection
• 🔹 Suitable for all markets & timeframes
📌 Disclaimer: Past performance is not indicative of future results. No trading strategy can guarantee success in financial markets.
📌 Strategic Advice: Always backtest, optimize, and align parameters with your trading objectives and risk tolerance before live trading.
DEGA RMA | QuantEdgeB🧠 Introducing DEGA RMA (DGR ) by QuantEdgeB
🛠️ Overview
DEGA RMA (DGR) is a precision-engineered trend-following system that merges DEMA, Gaussian kernel smoothing, and ATR-based envelopes into a single, seamless overlay indicator. Its mission: to filter out market noise while accurately capturing directional bias using a layered volatility-sensitive trend core.
DGR excels at identifying valid breakouts, sustained momentum conditions, and trend-defining price behavior without falling into the trap of frequent signal reversals.
🔍 How It Works
1️⃣ Double Exponential Moving Average (DEMA)
The system begins by applying a DEMA to the selected price source. DEMA responds faster than a traditional EMA, making it ideal for capturing transitions in momentum.
2️⃣ Gaussian Filtering
A custom Gaussian kernel is used to smooth the DEMA signal. The Gaussian function applies symmetrical weights, centered around the most recent bar, effectively softening sharp price oscillations while preserving the underlying trend structure.
3️⃣ Recursive Moving Average (RMA) Core
The filtered Gaussian output is then processed through an RMA to generate a stable dynamic baseline. This baseline becomes the foundation for the final trend logic.
4️⃣ ATR-Scaled Breakout Zones
Upper and lower trend envelopes are calculated using a custom ATR filter built on DEMA-smoothed volatility.
• ✅ Long Signal when price closes above the upper envelope
• ❌ Short Signal when price closes below the lower envelope
• ➖ Neutral when inside the band (no signal noise)
✨ Key Features
🔹 Multi-Layer Trend Model
DEMA → Gaussian → RMA creates a signal structure that is both responsive and robust.
🔹 Volatility-Aware Entry System
Adaptive ATR bands adjust in real-time, expanding during high volatility and contracting during calm periods.
🔹 Noise-Reducing Gaussian Kernel
Sigma-adjustable kernel ensures signal smoothness without introducing excessive lag.
🔹 Clean Visual System
Candle coloring and band fills make trend state easy to read and act on at a glance.
⚙️ Custom Settings
• DEMA Source – Input source for trend core (default: close)
• DEMA Length – Length for initial smoothing (default: 30)
• Gaussian Filter Length – Determines smoothing depth (default: 4)
• Gaussian Sigma – Sharpness of Gaussian curve (default: 2.0)
• RMA Length – Core baseline smoothing (default: 12)
• ATR Length – Volatility detection period (default: 40)
• ATR Mult Up/Down – Controls the upper/lower threshold range for signals (default: 1.7)
📌 How to Use
1️⃣ Trend-Following Mode
• Go Long when price closes above the upper ATR band
• Go Short when price closes below the lower ATR band
• Remain neutral otherwise
2️⃣ Breakout Confirmation Tool
DGR’s ATR-based zone logic helps validate price breakouts and filter out false signals that occur inside compressed ranges.
3️⃣ Volatility Monitoring
Watch the ATR envelope width — a narrowing band often precedes expansion and potential directional shifts.
📌 Conclusion
DEGA RMA (DGR) is a thoughtfully constructed trend-following framework that goes beyond basic moving averages. Its Gaussian smoothing, adaptive ATR thresholds, and layered filtering logic provide a versatile solution for traders looking for cleaner signals, less noise, and real-time trend awareness.
Whether you're trading crypto, forex, or equities — DGR adapts to volatility while keeping your chart clean and actionable.
🔹 Summary
• ✅ Advanced Smoothing → DEMA + Gaussian + RMA = ultra-smooth trend core
• ✅ Volatility-Adjusted Zones → ATR envelope scaling removes whipsaws
• ✅ Fully Customizable → Tailor to any asset or timeframe
• ✅ Quant-Inspired Structure → Built for clarity, consistency, and confidence
📌 Disclaimer: Past performance is not indicative of future results. No trading strategy can guarantee success in financial markets.
📌 Strategic Advice: Always backtest, optimize, and align parameters with your trading objectives and risk tolerance before live trading.
Gaussian Smooth Trend | QuantEdgeB🧠 Introducing Gaussian Smooth Trend (GST) by QuantEdgeB
🛠️ Overview
Gaussian Smooth Trend (GST) is an advanced volatility-filtered trend-following system that blends multiple smoothing techniques into a single directional bias tool. It is purpose-built to reduce noise, isolate meaningful price shifts, and deliver early trend detection while dynamically adapting to market volatility.
GST leverages the Gaussian filter as its core engine, wrapped in a layered framework of DEMA smoothing, SMMA signal tracking, and standard deviation-based breakout thresholds, producing a powerful toolset for trend confirmation and momentum-based decision-making.
🔍 How It Works
1️⃣ DEMA Smoothing Engine
The indicator begins by calculating a Double Exponential Moving Average (DEMA), which provides a responsive and noise-resistant base input for subsequent filtering.
2️⃣ Gaussian Filter
A custom Gaussian kernel is applied to the DEMA signal, allowing the system to detect smooth momentum shifts while filtering out short-term volatility.
This is especially powerful during low-volume or sideways markets where traditional MAs struggle.
3️⃣ SMMA Layer with Z-Filtering
The filtered Gaussian signal is then passed through a custom Smoothed Moving Average (SMMA). A standard deviation envelope is constructed around this SMMA, dynamically expanding/contracting based on market volatility.
4️⃣ Signal Generation
• ✅ Long Signal: Price closes above Upper SD Band
• ❌ Short Signal: Price closes below Lower SD Band
• ➖ No trade: Price stays within the band → market indecision
✨ Key Features
🔹 Multi-Stage Trend Detection
Combines DEMA → Gaussian Kernel → SMMA → SD Bands for robust signal integrity across market conditions.
🔹 Gaussian Adaptive Filtering
Applies a tunable sigma parameter for the Gaussian kernel, enabling you to fine-tune smoothness vs. responsiveness.
🔹 Volatility-Aware Trend Zones
Price must close outside of dynamic SD envelopes to trigger signals — reducing whipsaws and increasing signal quality.
🔹 Dynamic Color-Coded Visualization
Candle coloring and band fills reflect live trend state, making the chart intuitive and fast to read.
⚙️ Custom Settings
• DEMA Source: Price stream used for smoothing (default: close)
• DEMA Length: Period for initial exponential smoothing (default: 7)
• Gaussian Length / Sigma: Controls smoothing strength of kernel filter
• SMMA Length: Final smoothing layer (default: 12)
• SD Length: Lookback period for standard deviation filtering (default: 30)
• SD Mult Up / Down: Adjusts distance of upper/lower breakout zones (default: 2.5 / 1.8)
• Color Modes: Six distinct color palettes (e.g., Strategy, Warm, Cool)
• Signal Labels: Toggle on/off entry markers ("𝓛𝓸𝓷𝓰", "𝓢𝓱𝓸𝓻𝓽")
📌 Trading Applications
✅ Trend-Following → Enter on confirmed breakouts from Gaussian-smoothed volatility zones
✅ Breakout Validation → Use SD bands to avoid false breakouts during chop
✅ Volatility Compression Monitoring → Narrowing bands often precede large directional moves
✅ Overlay-Based Confirmation → Can complement other QuantEdgeB indicators like K-DMI, BMD, or Z-SMMA
📌 Conclusion
Gaussian Smooth Trend (GST) delivers a precision-built trend model tailored for modern traders who demand both clarity and control. The layered signal architecture, combined with volatility awareness and Gaussian signal enhancement, ensures accurate entries, clean visualizations, and actionable trend structure — all in real-time.
🔹 Summary Highlights
1️⃣ Multi-stage Smoothing — DEMA → Gaussian → SMMA for deep signal integrity
2️⃣ Volatility-Aware Filtering — SD bands prevent false entries
3️⃣ Visual Trend Mapping — Gradient fills + candle coloring for clean charts
4️⃣ Highly Customizable — Adapt to your timeframe, style, and volatility
📌 Disclaimer: Past performance is not indicative of future results. No trading strategy can guarantee success in financial markets.
📌 Strategic Advice: Always backtest, optimize, and align parameters with your trading objectives and risk tolerance before live trading.
Z SMMA | QuantEdgeB📈 Introducing Z-Score SMMA (Z SMMA) by QuantEdgeB
🛠️ Overview
Z SMMA is a momentum-driven oscillator designed to track the standardized deviation of a Smoothed Moving Average (SMMA). By applying Z-score normalization, this tool dynamically adapts to price volatility, enabling traders to detect meaningful directional shifts and trend changes with enhanced clarity.
It serves both as a trend-following and mean-reversion system, identifying opportunities through standardized thresholds while remaining robust across volatile and calm market conditions.
✨ Key Features
🔹 Z-Score Normalization Engine
Applies Z-score to a custom SMMA baseline, allowing traders to compare price action relative to its recent volatility-adjusted mean.
🔹 Dynamic Trend Detection
Generates actionable long/short signals based on customizable Z-thresholds, making it adaptable across different asset classes and timeframes.
🔹 Overbought/Oversold Zones
Highlight reversion and profit-taking zones (default OB: +2 to +4, OS: -2 to -4), great for counter-trend or mean-reversion strategies.
🔹 Visual Reinforcement Tools
Includes candle coloring, gradient fills, and optional ALMA/EMA band overlays to visualize trend regime transitions.
🔍 How It Works
1️⃣ Z-Score SMMA Calculation
The core is a custom Smoothed Moving Average (SMMA) that is normalized by its standard deviation over a lookback period.
Final Formula:
Z = (SMMA - Mean) / StdDev
2️⃣ Signal Generation
• ✅ Long Bias: Z-Score > Long Threshold (default: 0)
• ❌ Short Bias: Z-Score < Short Threshold (default: 0)
3️⃣ Visual Aids
• Candle Color → Shows trend bias
• Band Fills → Highlight trend strength
• Overlays → Optional ALMA/EMA bands for structure analysis
⚙️ Custom Settings
• SMMA Length → Default: 12
• Z-Score Lookback → Default: 30
• Long Threshold → Default: 0
• Short Threshold → Default: 0
• Color Themes → Choose from 6 visual modes
• Extra Plots → Toggle advanced overlays (ALMA, EMA, bands)
• Label Display → Show/hide “𝓛𝓸𝓷𝓰” & “𝓢𝓱𝓸𝓻𝓽” markers
👥 Who Should Use It?
✅ Trend Traders → For early entries with confirmation from Z-score expansion
✅ Quantitative Analysts → Standardized deviation enables comparison across assets
✅ Mean-Reversion Traders → Use OB/OS zones to fade parabolic spikes
✅ Swing & Systematic Traders → Identify momentum shifts with optional ALMA/EMA overlays
📌 Conclusion
Z SMMA offers a smart, adaptive framework for tracking deviation from equilibrium in a quant-friendly format. Whether you're looking to follow trends or catch exhaustion points, Z SMMA provides a clear, standardized view of momentum and price extremes.
🔹 Key Takeaways:
1️⃣ Z-Score standardization ensures dynamic range awareness
2️⃣ SMMA base filters out noise, offering smoother signals
3️⃣ Color-coded visuals support faster reaction and cleaner charts
📌 Disclaimer: Past performance is not indicative of future results. No trading strategy can guarantee success in financial markets.
📌 Strategic Advice: Always backtest, optimize, and align parameters with your trading objectives and risk tolerance before
Kernel Weighted DMI | QuantEdgeB📊 Introducing Kernel Weighted DMI (K-DMI) by QuantEdgeB
🛠️ Overview
K-DMI is a next-gen momentum indicator that combines the traditional Directional Movement Index (DMI) with advanced kernel smoothing techniques to produce a highly adaptive, noise-resistant trend signal.
Unlike standard DMI that can be overly reactive or choppy in consolidation phases, K-DMI applies kernel-weighted filtering (Linear, Exponential, or Gaussian) to stabilize directional movement readings and extract a more reliable momentum signal.
✨ Key Features
🔹 Kernel Smoothing Engine
Smooths DMI using your choice of kernel (Linear, Exponential, Gaussian) for flexible noise reduction and clarity.
🔹 Dynamic Trend Signal
Generates real-time long/short trend bias based on signal crossing upper or lower thresholds (defaults: ±1).
🔹 Visual Encoding
Includes directional gradient fills, candle coloring, and momentum-based overlays for instant signal comprehension.
🔹 Multi-Mode Plotting
Optional moving average overlays visualize structure and compression/expansion within price action.
📐 How It Works
1️⃣ Directional Movement Index (DMI)
Calculates the traditional +DI and -DI differential to derive directional bias.
2️⃣ Kernel-Based Smoothing
Applies a custom-weighted average across historical DMI values using one of three smoothing methods:
• Linear → Simple tapering weights
• Exponential → Decay curve for recent emphasis
• Gaussian → Bell-shaped weight for centered precision
3️⃣ Signal Generation
• ✅ Long → Signal > Long Threshold (default: +1)
• ❌ Short → Signal < Short Threshold (default: -1)
Additional overlays signal potential compression zones or trend resumption using gradient and line fills.
⚙️ Custom Settings
• DMI Length: Default = 7
• Kernel Type: Options → Linear, Exponential, Gaussian (Def:Linear)
• Kernel Length: Default = 25
• Long Threshold: Default = 1
• Short Threshold: Default = -1
• Color Mode: Strategy, Solar, Warm, Cool, Classic, Magic
• Show Labels: Optional entry signal labels (Long/Short)
• Enable Extra Plots: Toggle MA overlays and dynamic bands
👥 Who Is It For?
✅ Trend Traders → Identify sustained directional bias with smoother signal lines
✅ Quant Analysts → Leverage advanced smoothing models to enhance data clarity
✅ Discretionary Swing Traders → Visualize clean breakouts or fades within choppy zones
✅ MA Compression Traders → Use overlay MAs to detect expansion opportunities
📌 Conclusion
Kernel Weighted DMI is the evolution of classic momentum tracking—merging traditional DMI logic with adaptable kernel filters. It provides a refined lens for trend detection, while optional visual overlays support price structure analysis.
🔹 Key Takeaways:
1️⃣ Smoothed and stabilized DMI for reliable trend signal generation
2️⃣ Optional Gaussian/exponential weighting for adaptive responsiveness
3️⃣ Custom gradient fills, dynamic MAs, and candle coloring to support visual clarity
📌 Disclaimer: Past performance is not indicative of future results. No trading strategy can guarantee success in financial markets.
📌 Strategic Advice: Always backtest, optimize, and align parameters with your trading objectives and risk tolerance before live trading.
Normalized DEMA Oscillator SD| QuantEdgeB📊 Introducing Normalized DEMA Oscillator SD (NDOSD) by QuantEdgeB
🛠️ Overview
Normalized DEMA Oscillator SD (NDOSD) is a powerful trend and momentum indicator that blends DEMA-based smoothing with a standard deviation-based normalization engine. The result is an oscillator that adapts to volatility, filters noise, and highlights both trend continuations and reversal zones with exceptional clarity.
It normalizes price momentum within an adaptive SD envelope, allowing comparisons across assets and market conditions. Whether you're a trend trader or mean-reverter, NDOSD provides the insight needed for smarter decision-making.
✨ Key Features
🔹 DEMA-Powered Momentum Core
Utilizes a Double EMA (DEMA) for smoother trend detection with reduced lag.
🔹 Normalized SD Bands
Price momentum is standardized using a dynamic 2× standard deviation range—enabling consistent interpretation across assets and timeframes.
🔹 Overbought/Oversold Detection
Includes clear OB/OS zones with shaded thresholds to identify potential reversals or trend exhaustion areas.
🔹 Visual Trend Feedback
Color-coded oscillator zones, candle coloring, and optional signal labels help traders immediately see trend direction and strength.
📐 How It Works
1️⃣ DEMA Calculation
The core of NDOSD is a smoothed price line using a Double EMA, designed to reduce false signals in choppy markets.
2️⃣ Normalization with SD
The DEMA is normalized within a volatility range using a 2x SD calculation, producing a bounded oscillator from 0–100. This transforms the raw signal into a structured format, allowing for OB/OS detection and trend entry clarity.
3️⃣ Signal Generation
• ✅ Long Signal → Oscillator crosses above the long threshold (default: 55) and price holds above the lower SD boundary.
• ❌ Short Signal → Oscillator drops below short threshold (default: 45), often within upper SD boundary context.
4️⃣ OB/OS Thresholds
• Overbought Zone: Above 100 → Caution / Consider profit-taking.
• Oversold Zone: Below 0 → Watch for accumulation setups.
⚙️ Custom Settings
• Calculation Source: Default = close
• DEMA Period: Default = 30
• Base SMA Period: Default = 20
• Long Threshold: Default = 55
• Short Threshold: Default = 45
• Color Mode: Choose from Strategy, Solar, Warm, Cool, Classic, or Magic
• Signal Labels Toggle: Show/hide Long/Short markers on chart
👥 Ideal For
✅ Trend Followers – Identify breakout continuation zones using oscillator thrust and SD structure
✅ Swing Traders – Catch mid-trend entries or mean reversion setups at OB/OS extremes
✅ Quant/Systemic Traders – Normalize signals for algorithmic integration across assets
✅ Multi-Timeframe Analysts – Easily compare trend health using standardized oscillator ranges
📌 Conclusion
Normalized DEMA Oscillator SD is a sleek and adaptive momentum toolkit that helps traders distinguish true momentum from false noise. With its fusion of DEMA smoothing and SD normalization, it works equally well in trending and range-bound conditions.
🔹 Key Takeaways:
1️⃣ Smoother momentum tracking using DEMA
2️⃣ Cross-asset consistency via SD-based normalization
3️⃣ Versatile for both trend confirmation and reversal identification
📌 Disclaimer: Past performance is not indicative of future results. No trading strategy can guarantee success in financial markets.
📌 Strategic Advice: Always backtest, optimize, and align parameters with your trading objectives and risk tolerance before live trading.
Let me know if you want a strategy script or publish-ready layout for TradingView next!
Median RSI SD| QuantEdgeB📈 Introducing Median RSI SD by QuantEdgeB
🛠️ Overview
Median RSI SD is a hybrid momentum tool that fuses two powerful techniques: Median Price Filtering and RSI-based Momentum. The result? A cleaner, more responsive oscillator designed to reduce noise and increase clarity in trend detection and potential reversals.
By applying the RSI not to raw price but to the percentile-based median, the indicator adapts better to real structural shifts in the market while filtering out temporary price spikes.
✨ Key Features
🔹 Smoothed RSI Momentum
Utilizes a percentile-based median as input to RSI, reducing volatility and enhancing signal reliability.
🔹 Volatility-Weighted SD Zones
Automatically detects overbought/oversold extremes using ±1 standard deviation bands on the median, adapting to current market volatility.
🔹 Trend Signal Overlay
A directional trend signal (Long / Short / Neutral) is derived from the RSI crossing custom thresholds, combined with position relative to SD bands.
🔹 Visual Labeling System
Optional in-chart labels for Long / Short signals and fully color-customizable theme modes.
📊 How It Works
1️⃣ Median RSI Calculation
Instead of using the close price directly, the script first computes a smoothed median via percentile ranking. RSI is then applied to this filtered stream, improving reactivity without overfitting to short-term noise.
2️⃣ Standard Deviation Filtering
Upper and lower SD bands are calculated around the median to identify extreme conditions. A position near the upper SD while RSI is below the short threshold triggers bearish bias. The reverse applies for longs.
3️⃣ Signal Generation
• ✅ Long Signal → RSI crosses above the Long Threshold (default: 65) and price holds above lower SD.
• ❌ Short Signal → RSI crosses below the Short Threshold (default: 45), typically within upper SD range.
4️⃣ Contextual Highlighting
Zone fills on the chart and RSI subgraph indicate Overbought (>75) and Oversold (<25) conditions for added clarity.
⚙️ Custom Settings
• RSI Length → Default: 21
• Median Length → Default: 10
• Long Threshold → Default: 65
• Short Threshold → Default: 45
• Color Mode → Choose from Strategy, Solar, Warm, Cool, Classic, Magic
• Signal Labels Toggle → Optional in-chart long/short labels
👥 Who Should Use It?
✅ Swing & Momentum Traders → Filter entries based on confirmed directional RSI setups.
✅ Range-Bound Traders → Use SD thresholds to spot fakeouts or exhaustion zones.
✅ Intraday Strategists → Enhanced signal clarity makes it usable even on lower timeframes.
✅ System Builders → Combine this signal with price action or confluence layers for smarter rules.
📌 Conclusion
Median RSI SD by QuantEdgeB is more than just a modified oscillator—it's a robust momentum confirmation framework designed for modern volatility. By replacing noisy price feeds with a statistically stable input and layering RSI + SD logic, this tool provides high-clarity signals without sacrificing responsiveness.
🔹 Key Takeaways:
1️⃣ Median-filtered RSI eliminates noise without lag
2️⃣ Standard deviation bands identify exhaustion zones
3️⃣ Reliable for both trend continuation and mean-reversion strategies
📌 Disclaimer: Past performance is not indicative of future results. No trading strategy can guarantee success in financial markets.
📌 Strategic Advice: Always backtest, optimize, and align parameters with your trading objectives and risk tolerance before live trading.
Linear % ST | QuantEdgeB🚀 Introducing Linear Percentile SuperTrend (Linear % ST) by QuantEdgeB
🛠️ Overview
Linear % SuperTrend (Linear % ST) by QuantEdgeB is a hybrid trend-following indicator that combines Linear Regression, Percentile Filters, and Volatility-Based SuperTrend Logic into one dynamic tool. This system is designed to identify trend shifts early while filtering out noise during choppy market conditions.
By utilizing percentile-based median smoothing and customized ATR multipliers, this tool captures both breakout momentum and pullback opportunities with precision.
✨ Key Features
🔹 Percentile-Based Median Filtering
Removes outliers and normalizes price movement for cleaner trend detection using the 50th percentile (median) of recent price action.
🔹 Linear Regression Smoothing
A smoothed baseline is computed with Linear Regression to detect the underlying trend while minimizing lag.
🔹 SuperTrend Structure with Adaptive Bands
The indicator implements an enhanced SuperTrend engine with custom ATR bands that adapt to trend direction. Bands tighten or loosen based on volatility and trend strength.
🔹 Dynamic Long/Short Conditions
Long and short signals are derived from the relationship between price and the SuperTrend threshold zones, clearly showing trend direction with optional "Long"/"Short" labels on the chart.
🔹 Multiple Visual Themes
Select from 6 built-in color palettes including Strategy, Solar, Warm, Cool, Classic, and Magic to match your personal style or strategy layout.
📊 How It Works
1️⃣ Percentile Filtering
The source price (default: close) is filtered using a nearest-rank 50th percentile over a custom lookback. This normalizes data to reflect the central tendency and removes noisy extremes.
2️⃣ Linear Regression Trend Base
A Linear Regression Moving Average (LSMA) is applied to the filtered median, forming the core trend line. This dynamic trendline provides a low-lag yet smooth view of market direction.
3️⃣ SuperTrend Engine
ATR is applied with custom multipliers (different for long and short) to create dynamic bands. The bands react to price movement and only shift direction after confirmation, preventing false flips.
4️⃣ Trend Signal Logic
• When price stays above the dynamic lower band → Bullish trend
• When price breaks below the upper band → Bearish trend
• Trend direction remains stable until violated by price.
⚙️ Custom Settings
• Percentile Length → Lookback for percentile smoothing (default: 35)
• LSMA Length → Determines the base trend via linear regression (default: 24)
• ATR Length → ATR period used in dynamic bands (default: 14)
• Long Multiplier → ATR multiplier for bullish thresholds (default: 0.8)
• Short Multiplier → ATR multiplier for bearish thresholds (default: 1.9)
✅ How to Use
1️⃣ Trend-Following Strategy
✔️ Go Long when price breaks above the lower ATR band, initiating an upward trend
✔️ Go Short when price falls below the upper ATR band, confirming bearish conditions
✔️ Remain in trend direction until the SuperTrend flips
2️⃣ Visual Confirmation
✔️ Use bar coloring and the dynamic bands to stay aligned with trend direction
✔️ Optional Long/Short labels highlight key signal flips
👥 Who Should Use Linear % ST?
✅ Swing & Position Traders → To ride trends confidently
✅ Trend Followers → As a primary directional filter
✅ Breakout Traders → For clean signal generation post-range break
✅ Quant/Systematic Traders → Integrate clean trend logic into algorithmic setups
📌 Conclusion
Linear % ST by QuantEdgeB blends percentile smoothing with linear regression and volatility bands to deliver a powerful, adaptive trend-following engine. Whether you're a discretionary trader seeking cleaner entries or a systems-based trader building logic for automation, Linear % ST offers clarity, adaptability, and precision in trend detection.
🔹 Key Takeaways:
1️⃣ Percentile + Regression = Noise-Reduced Core Trend
2️⃣ ATR-Based SuperTrend = Reliable Breakout Confirmation
3️⃣ Flexible Parameters + Color Modes = Custom Fit for Any Strategy
📈 Use it to spot emerging trends, filter false signals, and stay confidently aligned with market momentum.
📌 Disclaimer: Past performance is not indicative of future results. No trading strategy can guarantee success in financial markets.
📌 Strategic Advice: Always backtest, optimize, and align parameters with your trading objectives and risk tolerance before live trading.
Filtered QQE + EMA + Supertrend (Alternating Signals)used qqe mod + supertrend + 20 ema to build perfectly working script.
Quantile DEMA Trend | QuantEdgeB🚀 Introducing Quantile DEMA Trend (QDT) by QuantEdgeB
🛠️ Overview
Quantile DEMA Trend (QDT) is an advanced trend-following and momentum detection indicator designed to capture price trends with superior accuracy. Combining DEMA (Double Exponential Moving Average) with SuperTrend and Quantile Filtering, QDT identifies strong trends while maintaining the ability to adapt to various market conditions.
Unlike traditional trend indicators, QDT uses percentile filtering to adjust for volatility and provides dynamic thresholds, ensuring consistent signal performance across different assets and timeframes.
✨ Key Features
🔹 Trend Following with Adaptive Sensitivity
The DEMA component ensures quicker responses to price changes while reducing lag, offering a real-time reflection of market momentum.
🔹 Volatility-Adjusted Filtering
The SuperTrend logic incorporates quantile percentile filters and ATR (Average True Range) multipliers, allowing QDT to adapt to fluctuating market volatility.
🔹 Clear Signal Generation
QDT generates clear Long and Short signals using percentile thresholds, effectively identifying trend changes and market reversals.
🔹 Customizable Visual & Signal Settings
With multiple color modes and customizable settings, you can easily align the QDT indicator with your trading strategy, whether you're focused on trend-following or volatility adjustments.
📊 How It Works
1️⃣ DEMA Calculation
DEMA is used to reduce lag compared to traditional moving averages. It is calculated by applying a Double Exponential Moving Average to price data. This smoother trend-following mechanism ensures responsiveness to market movements without introducing excessive noise.
2️⃣ SuperTrend with Percentile Filtering
The SuperTrend component adapts the trend-following signal by incorporating quantile percentile filters. It identifies dynamic support and resistance levels based on historical price data:
• Upper Band: Calculated using the 75th percentile + ATR (adjusted with multiplier)
• Lower Band: Calculated using the 25th percentile - ATR (adjusted with multiplier)
These dynamic bands adjust to market conditions, filtering out noise while identifying the true direction.
3️⃣ Signal Generation
• Long Signal: Triggered when price crosses below the SuperTrend Lower Band
• Short Signal: Triggered when price crosses above the SuperTrend Upper Band
The indicator provides signals with corresponding trend direction based on these crossovers.
👁 Visual & Custom Features
• 🎨 Multiple Color Modes: Choose from "Strategy", "Solar", "Warm", "Cool", "Classic", and "Magic" color palettes to match your charting style.
• 🏷️ Long/Short Signal Labels: Optional labels for visual cueing when a long or short trend is triggered.
• 📉 Bar Color Customization: Bar colors dynamically adjust based on trend direction to visually distinguish the market bias.
👥 Who Should Use QDT?
✅ Trend Followers: Use QDT as a dynamic tool to confirm trends and capture profits in trending markets.
✅ Swing Traders: Use QDT to time entries based on confirmed breakouts or breakdowns.
✅ Volatility Traders: Identify market exhaustion or expansion points, especially during volatile periods.
✅ Systematic & Quant Traders: Integrate QDT into algorithmic strategies to enhance market detection with adaptive filtering.
⚙️ Customization & Default Settings
- DEMA Length(30): Controls the lookback period for DEMA calculation
- Percentile Length(10): Sets the lookback period for percentile filtering
- ATR Length(14): Defines the length for calculating ATR (used in SuperTrend)
- ATR Multiplier(1.2 ): Multiplier for ATR in SuperTrend calculation
- SuperTrend Length(30):Defines the length for SuperTrend calculations
📌 How to Use QDT in Trading
1️⃣ Trend-Following Strategy
✔ Enter Long positions when QDT signals a bullish breakout (price crosses below the SuperTrend lower band).
✔ Enter Short positions when QDT signals a bearish breakdown (price crosses above the SuperTrend upper band).
✔ Hold positions as long as QDT continues to provide the same direction.
2️⃣ Reversal Strategy
✔ Take profits when price reaches extreme levels (upper or lower percentile zones) that may indicate trend exhaustion or reversion.
3️⃣ Volatility-Driven Entries
✔ Use the percentile filtering to enter positions based on mean-reversion logic or breakout setups in volatile markets.
🧠 Why It Works
QDT combines the DEMA’s quick response to price changes with SuperTrend's volatility-adjusted thresholds, ensuring a responsive and adaptive indicator. The use of percentile filters and ATR multipliers helps adjust to varying market conditions, making QDT suitable for both trending and range-bound environments.
🔹 Conclusion
The Quantile DEMA Trend (QDT) by QuantEdgeB is a powerful, adaptive trend-following and momentum detection system. By integrating DEMA, SuperTrend, and quantile percentile filtering, it provides accurate and timely signals while adjusting to market volatility. Whether you are a trend follower or volatility trader, QDT offers a robust solution to identify high-probability entry and exit points.
🔹 Key Takeaways:
1️⃣ Trend Confirmation – Uses DEMA and SuperTrend for dynamic trend detection
2️⃣ Volatility Filtering – Adjusts to varying market conditions using percentile logic
3️⃣ Clear Signal Generation – Easy-to-read signals and visual cues for strategy implementation
📌 Disclaimer: Past performance is not indicative of future results. No trading strategy can guarantee success in financial markets.
📌 Strategic Advice: Always backtest, optimize, and align parameters with your trading objectives and risk tolerance before live trading.