Consolidation Range with Signals (Zeiierman)█ Overview
Consolidation Range with Signals (Zeiierman) is a precision tool for identifying and trading market consolidation zones, where price contracts into tight ranges before significant movement. It provides dynamic range detection using either ADX-based trend strength or volatility compression metrics, and offers built-in take profit and stop loss signals based on breakout dynamics.
Whether you trade breakouts, range reversals, or trend continuation setups, this indicator visualizes the balance between supply and demand with clearly defined mid-bands, breakout zones, and momentum-sensitive TP/SL placements.
█ How It Works
⚪ Multi-Method Range Detection
ADX Mode
Uses the Average Directional Index (ADX) to detect low-trend-strength environments. When ADX is below your selected threshold, price is considered to be in consolidation.
Volatility Mode
This mode detects consolidation by identifying periods of volatility compression. It evaluates whether the following metrics are simultaneously below their respective historical rolling averages:
Standard Deviation
Variance
Average True Range (ATR)
⚪ Dynamic Range Band System
Once a range is confirmed, the system builds a dynamic band structure using a volatility-based filter and price-jump logic:
Middle Line (Trend Filter): Reacts to price imbalance using adaptive jump logic.
Upper & Lower Bands: Calculated by expanding from the middle line using a configurable multiplier.
This creates a clean, visual box that reflects current consolidation conditions and adapts as price fluctuates within or escapes the zone.
⚪ SL/TP Signal Engine
On detection of a breakout from the range, the indicator generates up to 3 Take Profit levels and one Stop Loss, based on the breakout direction:
All TP/SL levels are calculated using the filtered base range and multipliers.
Cooldown logic ensures signals are not spammed bar-to-bar.
Entries are visualized with colored lines and labeled levels.
This feature is ideal for traders who want automated risk and reward reference points for range breakout plays.
█ How to Use
⚪ Breakout Traders
Use the SL/TP signals when the price breaks above or below the range bands, especially after extended sideways movement. You can customize how far TP1, TP2, and TP3 sit from the entry using your own risk/reward profile.
⚪ Mean Reversion Traders
Use the bands to locate high-probability reversion zones. These serve as reference zones for scalping or fade entries within stable consolidation phases.
█ Settings
Range Detection Method – Choose between ADX or Volatility compression to define range criteria.
Range Period – Determines how many bars are used to compute trend/volatility.
Range Multiplier – Scales the width of the consolidation zone.
SL/TP System – Optional levels that project TP1/TP2/TP3 and SL from the base price using multipliers.
Cooldown – Prevents repeated SL/TP signals from triggering too frequently.
ADX Threshold & Smoothing – Adjusts sensitivity of trend strength detection.
StdDev / Variance / ATR Multipliers – Fine-tune compression detection logic.
-----------------
Disclaimer
The content provided in my scripts, indicators, ideas, algorithms, and systems is for educational and informational purposes only. It does not constitute financial advice, investment recommendations, or a solicitation to buy or sell any financial instruments. I will not accept liability for any loss or damage, including without limitation any loss of profit, which may arise directly or indirectly from the use of or reliance on such information.
All investments involve risk, and the past performance of a security, industry, sector, market, financial product, trading strategy, backtest, or individual's trading does not guarantee future results or returns. Investors are fully responsible for any investment decisions they make. Such decisions should be based solely on an evaluation of their financial circumstances, investment objectives, risk tolerance, and liquidity needs.
Indicadores e estratégias
RSI by Harsh Bhagat (VITTAARA)This is a customised RSI indicator designed for pro traders who want to stay ahead in the market.
🚀 Key Features:
• Standard RSI with precision tuning
• Two Upper Bands: 60 & 65 for smart overbought tracking
• Two Lower Bands: 40 & 38 for sharp oversold alerts
• Dual-tone color scheme for better visual clarity
Ideal for identifying reversal zones, trend weakness, and momentum shift — with an edge.
Master Trend BUY&SELLTREND MASTER BUY&SEL
//@version=5
indicator(title="Master Trend BUY&SELL", shorttitle="MASTER TREND BUY&SELL", overlay=true)
// Color variables
upTrendColor = color.green
neutralColor = #0e0e0e
downTrendColor = color.red
fillColor = color.rgb(12, 12, 12, 70) // Color between lines
yellowColor = color.rgb(230, 214, 2)
blackTextColor = color.rgb(0, 0, 0)
blueColor = color.rgb(233, 217, 0)
whiteTextColor = color.rgb(7, 7, 7)
greenColor = color.green
redColor = color.red
// Source
source = input(defval=close, title="Source")
// Sampling Period
period = input.int(defval=100, minval=1, title="Sampling Period")
// Range Multiplier
multiplier = input.float(defval=3.0, minval=0.1, title="Range Multiplier")
// Take Profit Settings
takeProfitPips = input.float(defval=600.0, title="Take Profit (in pips)")
// Smooth Average Range
smoothRange(x, t, m) =>
adjustedPeriod = t * 2 - 1
avgRange = ta.ema(math.abs(x - x ), t)
smoothRange = ta.ema(avgRange, adjustedPeriod) * m
smoothRange
smoothedRange = smoothRange(source, period, multiplier)
// Trend Filter
trendFilter(x, r) =>
filtered = x
filtered := x > nz(filtered ) ? (x - r < nz(filtered ) ? nz(filtered ) : x - r) :
(x + r > nz(filtered ) ? nz(filtered ) : x + r)
filtered
filter = trendFilter(source, smoothedRange)
// Filter Direction
upCount = 0.0
upCount := filter > filter ? nz(upCount ) + 1 : filter < filter ? 0 : nz(upCount )
downCount = 0.0
downCount := filter < filter ? nz(downCount ) + 1 : filter > filter ? 0 : nz(downCount )
// Colors
filterColor = upCount > 0 ? upTrendColor : downCount > 0 ? downTrendColor : neutralColor
// Double Line Design
lineOffset = smoothedRange * 0.1
upperLinePlot = plot(filter + lineOffset, color=filterColor, linewidth=3, title="Upper Trend Line")
lowerLinePlot = plot(filter - lineOffset, color=filterColor, linewidth=3, title="Lower Trend Line")
fill(upperLinePlot, lowerLinePlot, color=fillColor, title="Trend Fill")
// Break Outs
longCondition = bool(na)
shortCondition = bool(na)
longCondition := (source > filter and source > source and upCount > 0) or
(source > filter and source < source and upCount > 0)
shortCondition := (source < filter and source < source and downCount > 0) or
(source < filter and source > source and downCount > 0)
initialCondition = 0
initialCondition := longCondition ? 1 : shortCondition ? -1 : initialCondition
longSignal = longCondition and initialCondition == -1
shortSignal = shortCondition and initialCondition == 1
// Take Profit Logic
var float entryPriceBuy = na
var float entryPriceSell = na
takeProfitSignalBuy = false
takeProfitSignalSell = false
if (longSignal)
entryPriceBuy := source
if (not na(entryPriceBuy) and source >= entryPriceBuy + takeProfitPips * syminfo.mintick)
takeProfitSignalBuy := true
entryPriceBuy := na
if (shortSignal)
entryPriceSell := source
if (not na(entryPriceSell) and source <= entryPriceSell - takeProfitPips * syminfo.mintick)
takeProfitSignalSell := true
entryPriceSell := na
// Alerts and Signals
plotshape(longSignal, title="Smart Buy Signal", text="Smart Buy", textcolor=color.white, style=shape.labelup, size=size.small, location=location.belowbar, color=greenColor)
plotshape(shortSignal, title="Smart Sell Signal", text="Smart Sell", textcolor=color.white, style=shape.labeldown, size=size.small, location=location.abovebar, color=redColor)
plotshape(takeProfitSignalBuy, title="Book Profit Buy", text="Book Profit", textcolor=blackTextColor, style=shape.labeldown, size=size.small, location=location.abovebar, color=yellowColor)
plotshape(takeProfitSignalSell, title="Book Profit Sell", text="Book Profit", textcolor=whiteTextColor, style=shape.labelup, size=size.small, location=location.belowbar, color=blueColor)
alertcondition(longSignal, title="Smart Buy alert on Master Trend Filter", message="Smart Buy alert on Master Trend Filter")
alertcondition(shortSignal, title="Smart Sell alert on Master Trend Filter", message="Smart Sell alert on Master Trend Filter")
alertcondition(takeProfitSignalBuy, title="Take Profit Buy alert", message="Take Profit Buy reached")
alertcondition(takeProfitSignalSell, title="Take Profit Sell alert", message="Take Profit Sell reached")
Auto Fractal [theUltimator5]This indicator is what I call the Auto Fractal. It is a unique algorithm that looks back in time, finds a segment on the chart that closest matches the recent price action, then projects the price forwards. It effectively finds chart patterns and shows you what the price did the last time the same/similar chart pattern was observed.
Creating an algorithm to match abstract curves to other abstract curves and provide a confidence score was the fundamental problem that needed to be solved in order to create this indicator, which curve matches with surprising accuracy.
The most effective method to "curve match" that I found is the Pearson Coefficient, set by a segment length and a lookback period. After the highest coefficient curve is located, the curve then gets scaled and offset to match the current price.
The past segment is drawn over the current price (orange line), giving a visualization of the two curves and how closely they match each other. The indicator then projects the price forwards in time based on the price action of the chart from the historical segment (dashed fuchsia line).
A bounding box also gets drawn around the historical segment to give you a clear visual of where the price is getting pulled from for proper analysis and ease of use.
The Pearson Coefficient % is shown in a table in the top right-hand corner of the chart and can be toggled off if desired. The values range from -100% (perfectly inverse correlation) to +100% (perfectly correlated) with 0 meaning no correlation whatsoever. The closer to +100% the value is, the better the segment match.
As with most/all of my indicators, user interface and simplicity was at the top of my priority list. I designed this to be easily readable and intuitive to both novice and veteran traders, without cluttering the chart.
Note:
This indicator is extremely heavy in terms of memory usage due to nested for loops, and takes several seconds to initially load the chart overlay. If the lookback period is increased too high (>600) then the indicator may time out and fail to load anything. If nothing loads on the chart, try reducing the lookback length and wait up to 10 seconds for lines to appear.
Directional Strength IndexThis indicator is designed to detect the dominant market direction and quantify its strength by aggregating signals across six key timeframes: 1H, 4H, 1D, 3D, 1W, and 1M.
At its core, it uses a SMEMA 'the Simple Moving Average of an EMA' as the main trend reference. This hybrid smoothing method was chosen for its balance: the EMA ensures responsiveness to recent price moves, while the SMA dampens short-term volatility. This makes the SMEMA more stable than a raw EMA and more reactive than a simple SMA, especially in noisy or volatile environments.
For each timeframe, a score between -10 and +10 is calculated. This score reflects:
- the distance of the price from the SMEMA, using ATR as a dynamic threshold
- the number of price deviations above or below the SMEMA
- the slope of the SMEMA, which adjusts the score based on momentum
These six timeframe scores are then combined into a single Global Score, using weighted averages. Three weighting profiles are available depending on your trading horizon:
- Long Term: emphasizes weekly and monthly data
- Swing Trading: gives balanced importance to all timeframes
- Short Term: prioritizes 1H and 4H action
This multi-timeframe aggregation makes the indicator adaptable to different styles while maintaining a consistent logic.
The result is displayed in a table on the chart, showing:
- the trend direction per timeframe (up, down or neutral)
- the strength score per timeframe
- the overall trend direction and strength based on the selected profile
Optional deviation bands based on ATR multiples are also plotted to provide visual context for overextensions relative to the SMEMA.
This indicator is non-repainting and built for objective, trend-based decision making.
abusuhil bullish breakAbusuhil Bullish Break is a price action-based confirmation tool that identifies a bullish reversal pattern consisting of:
Two consecutive bearish candles followed by
A strong bullish candle that closes above the high of both.
The script includes:
Optional dual MACD filter (current timeframe + higher timeframe)
Configurable stop-loss and multiple take-profit levels
Visual lines for targets and stop
Custom styling for all elements
It’s a clean, logic-driven entry confirmation tool for intraday and swing trading.
⚠️ Open-source and fully customizable.
مؤشر Abusuhil Bullish Break هو أداة تأكيد لانعكاسات الاتجاه الصاعد بناءً على حركة السعر (Price Action)، ويكتشف نموذجًا يتكون من:
شمعتين هابطتين متتاليتين
تتبعهما شمعة صاعدة قوية تغلق فوق أعلى الشمعتين السابقتين
يحتوي المؤشر على:
فلتر MACD مزدوج اختياري (للفريم الحالي وفريم أعلى)
إعدادات مخصصة للوقف والأهداف المتعددة
خطوط مرئية احترافية للأهداف والوقف
تحكم كامل في الألوان والنمط والعرض
مناسب للتداول اللحظي والسوينج.
✅ مفتوح المصدر وقابل للتعديل بالكامل.
HARSI PRO v2 - Advanced Adaptive Heikin-Ashi RSI OscillatorThis script is a fully re-engineered and enhanced version of the original Heikin-Ashi RSI Oscillator created by JayRogers. While it preserves the foundational concept and visual structure of the original indicatorusing Heikin-Ashi-style candles to represent RSI movementit introduces a range of institutional-grade engines and real-time analytics modules.
The core idea behind HARSI is to visualize the internal structure of RSI behavior using candle representations. This gives traders a clearer sense of trend continuity, exhaustion, and momentum inflection. In this upgraded version, the system is extended far beyond basic visualization into a comprehensive diagnostic and context-tracking tool.
Core Enhancements and Features
1. Heikin-Ashi RSI Candles
The base HARSI logic transforms RSI values into open, high, low, and close components, which are plotted as Heikin-Ashi-style candles. The open values are smoothed with a user-controlled bias setting, and the high/low are calculated from zero-centered RSI values.
2. Smoothed RSI Histogram and Plot
A secondary RSI plot and histogram are available for traditional RSI interpretation, optionally smoothed using a custom midpoint EMA process.
3. Dynamic Stochastic RSI Ribbon
The indicator optionally includes a smoothed Stochastic RSI ribbon with directional fill to highlight acceleration and reversal zones.
4. Real-Time Meta-State Engine
This engine determines the current market environmentneutral, breakout, or reversalbased on multiple adaptive conditions including volatility compression, momentum thrust, volume behavior, and composite reversal scoring.
5. Adaptive Overbought/Oversold Zone Engine
Instead of using fixed RSI thresholds, this engine dynamically adjusts OB/OS boundaries based on recent RSI range and normalized price volatility. This makes the OB/OS levels context-sensitive and more accurate across different instruments and regimes.
6. Composite Reversal Score Engine
A real-time score between 0 and 5 is generated using four components:
* OB/OS proximity (zone score)
* RSI slope behavior
* Volume state (burst or exhaustion)
* Trend continuation penalty based on position versus trend bias
This score allows for objective filtering of reversal zones and breakout traps.
7. Kalman Velocity Filter
A Kalman-style adaptive smoothing filter is applied to RSI for calculating velocity and acceleration. This allows for real-time detection of stalls and thrusts in RSI behavior.
8. Predictive Breakout Estimator
Uses ATR compression and RSI thrusting conditions to detect likely breakout environments. This logic contributes to the Meta-State Engine and the Breakout Risk dashboard metric.
9. Volume Acceleration Model
Real-time detection of volume bursts and fades based on VWMA baselines. Volume exhaustion warnings are used to qualify or disqualify reversals and breakouts.
10. Trend Bias and Regime Detection
Uses RSI slope, HARSI body impulse, and normalized ATR to classify the current trend state and directional bias. This forms the basis for filtering false reversals during strong trends.
11. Dashboard with Tooltips
A clean, table displays six key metrics in real time:
* Meta State
* Reversal Score
* Trend Bias
* Volume State
* Volatility Regime
* Breakout Risk
Each cell includes a descriptive tooltip explaining why the value is being shown based on internal state calculations.
How It Works Internally
* The system calculates a zero-centered RSI and builds candle structures using high, low, and smoothed open/close values.
* Volatility normalization is used throughout the script, including ATR-based thresholds and dynamic scaling of OB/OS zones.
* Momentum is filtered through smoothed slope calculations and HARSI body size measurements.
* Volume activity is compared against VWMA using configurable multipliers to detect institutional-level activity or exhaustion.
* Each regime detection module contributes to a centralized metaState classifier that determines whether the environment is conducive to reversal, breakout, or neutral action.
* All major signal and context values are continuously updated in a dashboard table with logic-driven color coding and tooltips.
Based On and Credits
This script is based on the original Heikin-Ashi RSI Oscillator by JayRogers . All visual elements from the original version, including candle plotting and color configurations, have been retained and extended. Significant backend enhancements were added by AresIQ for the 2025 release. The script remains open-source under the original attribution license. Credit to JayRogers is preserved and required for any derivative versions.
Key Levels with Alerts
Introducing the "Key Levels with Alerts" Indicator
This powerful and fully customizable indicator for the TradingView platform helps you easily identify and monitor crucial **daily, weekly, and monthly price levels** directly on your chart. Beyond just visual representation, the indicator offers advanced alert capabilities to notify you of any price breaks at these significant areas.
Key Levels Identified by the Indicator
This indicator calculates and displays six vital price levels based on the previous day's, week's, and month's closed candles:
1. **PDH (Previous Day High):** The highest price of the previous day.
2. **PDL (Previous Day Low):** The lowest price of the previous day.
3. **PWH (Previous Week High):** The highest price of the previous week.
4. **PWL (Previous Week Low):** The lowest price of the previous week.
5. **PMH (Previous Month High):** The highest price of the previous month.
6. **PML (Previous Month Low):** The lowest price of the previous month.
Core Features
* **Visual Line Display:** Each of these six levels is plotted as a **horizontal line** on your chart. These lines start from the current candle and extend forward for a specified number of candles (defaulting to 20 candles).
* **Complete Style Customization:** For every level (PDH, PDL, PWH, PWL, PMH, PML), you can **independently customize** the line's color, width, and style (solid, dashed, dotted) directly through the indicator's settings. This feature allows you to easily differentiate between the various levels.
* **Toggleable Labels:** You can choose whether to display text labels like "PDH", "PDL", "PWH", "PWL", "PMH", "PML" at the end of each line. The style of these labels will also automatically match their corresponding line colors.
* **Line Visibility Control:** Beyond just labels, you can also independently **show or hide the lines themselves** for PDH, PDL, PWH, PWL, PMH, and PML.
* **Price Break Alerts:** This is one of the indicator's most important features. You can set up alerts for each of these levels:
* **PDH Break Alert:** Triggers when the price moves above the **Previous Day High**.
* **PDL Break Alert:** Triggers when the price moves below the **Previous Day Low**.
* **PWH Break Alert:** Triggers when the price moves above the **Previous Week High**.
* **PWL Break Alert:** Triggers when the price moves below the **Previous Week Low**.
* **PMH Break Alert:** Triggers when the price moves above the **Previous Month High**.
* **PML Break Alert:** Triggers when the price moves below the **Previous Month Low**.
* **Clear Alert Messages:** Each alert message includes the **symbol or ticker name** (e.g., ` `) so you can quickly identify which asset the alert pertains to and which level has been broken.
* **Enable/Disable Alerts:** You have the flexibility to enable or disable each PDH, PDL, PWH, PWL, PMH, and PML alert independently via the indicator's settings.
Why This Indicator Is Useful
Daily, weekly, and monthly High and Low levels often act as **key support and resistance areas**. Traders use these levels to identify potential entry and exit points, set stop-loss and take-profit targets, and understand overall market sentiment. This indicator, with its clear visualization and timely alerts, helps you effectively leverage this crucial information in your trading strategies.
Range Filter - B&S Signals+OB+SND// This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
// Credits to the original Script - Range Filter DonovanWall
// This version is the old version of the Range Filter with less settings to tinker with
//@version=5
indicator(title='Range Filter - B&S; Signals+OB+SND', shorttitle='RF - B&S; Signals+OB+SND', overlay=true, max_labels_count = 500, max_boxes_count = 500, max_lines_count = 500)
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
//Functions
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
//Range Size Function
rng_size(x, qty, n) =>
// AC = Cond_EMA(abs(x - x ), 1, n)
wper = n * 2 - 1
avrng = ta.ema(math.abs(x - x ), n)
AC = ta.ema(avrng, wper) * qty
rng_size = AC
rng_size
//Range Filter Function
rng_filt(x, rng_, n) =>
r = rng_
var rfilt = array.new_float(2, x)
array.set(rfilt, 1, array.get(rfilt, 0))
if x - r > array.get(rfilt, 1)
array.set(rfilt, 0, x - r)
if x + r < array.get(rfilt, 1)
array.set(rfilt, 0, x + r)
rng_filt1 = array.get(rfilt, 0)
hi_band = rng_filt1 + r
lo_band = rng_filt1 - r
rng_filt = rng_filt1
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
//Inputs
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
//Range Source
rng_src = input(defval=close, title='Swing Source')
//Range Period
rng_per = input.int(defval=200, minval=1, title='Swing Period')
//Range Size Inputs
rng_qty = input.float(defval=7.5, minval=0.0000001, title='Swing Multiplier')
//Bar Colors
use_barcolor = input(defval=true, title='Bar Colors On/Off')
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
//Definitions
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
//Range Filter Values
= rng_filt(rng_src, rng_size(rng_src, rng_qty, rng_per), rng_per)
//Direction Conditions
var fdir = 0.0
fdir := filt > filt ? 1 : filt < filt ? -1 : fdir
upward = fdir == 1 ? 1 : 0
downward = fdir == -1 ? 1 : 0
//Trading Condition
longCond = rng_src > filt and rng_src > rng_src and upward > 0 or rng_src > filt and rng_src < rng_src and upward > 0
shortCond = rng_src < filt and rng_src < rng_src and downward > 0 or rng_src < filt and rng_src > rng_src and downward > 0
CondIni = 0
CondIni := longCond ? 1 : shortCond ? -1 : CondIni
longCondition = longCond and CondIni == -1
shortCondition = shortCond and CondIni == 1
//Colors
filt_color = upward ? #2adf06e5 : downward ? #ec0606e0 : #cccccc
bar_color = upward and rng_src > filt ? rng_src > rng_src ? #76ff05 : #76ff05 : downward and rng_src < filt ? rng_src < rng_src ? #ff0505 : #ff0505 : #109404
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
//Outputs
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
//Filter Plot
filt_plot = plot(filt, color=filt_color, linewidth=3, title='Filter', transp=67)
//Band Plots
h_band_plot = plot(h_band, color=color.new(#05ff9b, 100), title='High Band')
l_band_plot = plot(l_band, color=color.new(#ff0583, 100), title='Low Band')
//Band Fills
fill(h_band_plot, filt_plot, color=#00b36b00, title='High Band Fill')
fill(l_band_plot, filt_plot, color=#b8005c00, title='Low Band Fill')
//Bar Color
barcolor(use_barcolor ? bar_color : na)
//
// ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
// ---------------------------------------------- Order Blocks ------------------------------------------------
// Order Blocks
const color colup = #089981
const color coldn = #f23645
const string tm = " Use Length to adjust cordinate of the orderblocks Use whole candle body"
const string tn = "Mitigation method for when to trigger order blocks"
const string tj = "Order block Metrics text size"
const string ta = 'Display internal buy & sell activity'
const string tsorder = 'Show Last number of orderblocks'
const string gv = "Volumetric Order Blocks"
obshow = input.bool (false , "Show Last" , tsorder, '1', gv)
oblast = input.int (3 , "" , 0, 50, 1 , inline = '1', group = gv)
obupcs = input.color (color.new(colup, 90), "" , inline = '1', group = gv)
obdncs = input.color (color.new(coldn, 90), "" , inline = '1', group = gv)
obshowactivity = input.bool (true , "Show Buy/Sell Activity ", ta, '2', gv)
obactup = input.color (color.new(colup, 50), "" , inline = '2', group = gv)
obactdn = input.color (color.new(coldn, 50), "" , inline = '2', group = gv)
obmode = input.string("Length" , "Construction " , , tm, '3', gv)
len = input.int (5 , "" , 1, 20, 1 , inline = '3', group = gv)
obmiti = input.string("Close" , "Mitigation Method" , , tn, group = gv)
obtxt = input.string("Normal" , "Metric Size" , , tj, group = gv)
showmetric = input.bool (false , "Show Metrics" , group = gv)
showline = input.bool (false , "Show Mid-Line" , group = gv)
overlap = input.bool (true , "Hide Overlap" , group = gv, tooltip = "Most recent order block will be preserved")
bull = input.bool(true , "Buy signal" , inline = "Inside" , group = "ANY ALERT")
bear = input.bool(true , "Sell Signal" , inline = "Formed" , group = "ANY ALERT")
blcreated = input.bool(false , "Bullish OB Formed " , inline = "Formed" , group = "ANY ALERT")
brcreated = input.bool(false , "Bearish OB Formed" , inline = "Formed" , group = "ANY ALERT")
blmitigated = input.bool(false , "Bullish OB Mitigated " , inline = "Mitigated" , group = "ANY ALERT")
brmitigated = input.bool(false , "Bearish OB Mitigated" , inline = "Mitigated" , group = "ANY ALERT")
blinside = input.bool(true , "Price Inside Bullish OB" , inline = "Inside" , group = "ANY ALERT")
brinside = input.bool(true , "Price Inside Bearish OB" , inline = "Inside" , group = "ANY ALERT")
type bar
float o = open
float h = high
float l = low
float c = close
float v = volume
int i = bar_index
int t = time
type ob
float top
float btm
float avg
int loc
color css
float vol
int dir
int move
int blPOS
int brPOS
int xlocbl
int xlocbr
type alert
bool created = false
bool inside = false
bool mitigated = false
type cross
bool reset = false
bar b = bar .new()
alert blal = alert.new()
alert bral = alert.new()
var cross blIS = cross.new()
var cross brIS = cross.new()
method txSz(string s) =>
out = switch s
"Tiny" => size.tiny
"Small" => size.small
"Normal" => size.normal
"Large" => size.large
"Huge" => size.huge
out
method display(ob id, ob full, int i) =>
box.new (top = id.top, bottom = id.btm, left = id.loc, right = b.t , border_color = na, bgcolor = id.css, xloc = xloc.bar_time)
box.new (top = id.top, bottom = id.btm, left = b.t , right = b.t + 1 , border_color = na, bgcolor = id.css, xloc = xloc.bar_time, extend = extend.right)
if obshowactivity
box.new(top = id.top, bottom = id.avg, left = id.loc, right = id.xlocbl, border_color = na, bgcolor = obactup, xloc = xloc.bar_time)
box.new(top = id.avg, bottom = id.btm, left = id.loc, right = id.xlocbr, border_color = na, bgcolor = obactdn, xloc = xloc.bar_time)
if showline
line.new(
x1 = id.loc
, x2 = b.t
, y1 = id.avg
, y2 = id.avg
, color = color.new(id.css, 0)
, xloc = xloc.bar_time
, style = line.style_dashed
)
if showmetric
if i == math.min(oblast - 1, full.size() - 1)
float tV = 0
float dV = array.new()
seq = math.min(oblast - 1, full.size() - 1)
for j = 0 to seq
cV = full.get(j)
tV += cV.vol
if j == seq
for y = 0 to seq
dV.push(
math.floor(
(full.get(y).vol / tV) * 100)
)
id = full.get(y)
label.new(
b.i + 1
, id.avg
, textcolor = color.new(id.css, 0)
, style = label.style_label_left
, size = obtxt.txSz()
, color = #ffffff00
, text =
str.tostring(
math.round(full.get(y).vol, 3), format = format.volume) + " (" + str.tostring(dV.get(y)) + "%)"
)
method overlap(ob id) =>
if id.size() > 1
for i = id.size() - 1 to 1
stuff = id.get(i)
current = id.get(0)
switch
stuff.btm > current.btm and stuff.btm < current.top => id.remove(i)
stuff.top < current.top and stuff.btm > current.btm => id.remove(i)
stuff.top > current.top and stuff.btm < current.btm => id.remove(i)
stuff.top < current.top and stuff.top > current.btm => id.remove(i)
method umt(ob metric) =>
switch metric.dir
1 =>
switch metric.move
1 => metric.blPOS := metric.blPOS + 1, metric.move := 2
2 => metric.blPOS := metric.blPOS + 1, metric.move := 3
3 => metric.brPOS := metric.brPOS + 1, metric.move := 1
-1 =>
switch metric.move
1 => metric.brPOS := metric.brPOS + 1, metric.move := 2
2 => metric.brPOS := metric.brPOS + 1, metric.move := 3
3 => metric.blPOS := metric.blPOS + 1, metric.move := 1
if (b.t - b.t ) == (b.t - b.t )
metric.xlocbl := metric.loc + (b.t - b.t ) * metric.blPOS
metric.xlocbr := metric.loc + (b.t - b.t ) * metric.brPOS
fnOB() =>
var ob blob = array.new()
var ob brob = array.new()
var int dir = 0
up = ta.highest ( len )
dn = ta.lowest ( len )
pv = ta.pivothigh(b.v, len, len)
dir := b.h > up ? -1 : b.l < dn ? 1 : dir
atr = ta.atr(len)
btmP = obmode == "Length" ? (b.h - 1 * atr ) < b.l ? b.l : (b.h - 1 * atr ) : b.l
topP = obmode == "Length" ? (b.l + 1 * atr ) > b.h ? b.h : (b.l + 1 * atr ) : b.h
if pv and dir == 1
blob.unshift(
ob.new(topP, b.l , math.avg(topP, b.l ), b.t , obupcs, b.v , b.c > b.o ? 1 : -1, 1, 0, 0, b.t ))
blal.created := true
blIS.reset := false
if pv and dir == -1
brob.unshift(
ob.new(
b.h
, btmP
, math.avg(btmP, b.h )
, b.t
, obdncs
, b.v
, b.c > b.o ? 1 : -1
, 1
, 0
, 0
, b.t
)
)
bral.created := true
brIS.reset := false
if blob.size() > 0 and barstate.isconfirmed
for in blob
for j = 0 to len - 1
if obmiti == "Close" ? math.min(b.c , b.o ) < ob.btm : obmiti == "Wick" ? b.l < ob.btm : obmiti == "Avg" ? b.l < ob.avg : na
blob.remove(i)
blal.mitigated := true
break
if brob.size() > 0 and barstate.isconfirmed
for in brob
for j = 0 to len - 1
if obmiti == "Close" ? math.max(b.c , b.o ) > ob.top : obmiti == "Wick" ? b.h > ob.top : obmiti == "Avg" ? b.h > ob.avg : na
brob.remove(i)
bral.mitigated := true
break
if blob.size() > 0
for in blob
metric.umt()
if brob.size() > 0
for in brob
metric.umt()
if overlap
blob.overlap()
brob.overlap()
if barstate.isconfirmed
if blob.size() > 0
ob = blob.get(0)
if low < ob.top and blIS.reset == false
blal.inside := true
blIS.reset := true
if brob.size() > 0
ob = brob.get(0)
if high > ob.btm and brIS.reset == false
bral.inside := true
brIS.reset := true
if barstate.islast
for bx in box.all
bx.delete()
for ln in line.all
ln.delete()
// for lb in label.all //Razzere Fixed!
// lb.delete() //Razzere Fixed!
if blob.size() > 0
for i = 0 to math.min(oblast - 1, blob.size() - 1)
blob.get(i).display(blob, i)
if brob.size() > 0
for i = 0 to math.min(oblast - 1, brob.size() - 1)
brob.get(i).display(brob, i)
if obshow
fnOB()
if bull and longCondition
alert("Buy Signal")
if bear and shortCondition
alert("Sell Signal")
if blinside and blal.inside
alert("Price Inside Bullish OB")
if blcreated and blal.created
alert("Bullish OB Formed")
if blmitigated and blal.mitigated
alert("Bullish OB Mitigated")
if brinside and bral.inside
alert("Price Inside Bearish OB")
if brcreated and bral.created
alert("Bearish OB Formed")
if brmitigated and bral.mitigated
alert("Bearish OB Mitigated")
// Risk Management
levels = input.bool(true, "Show TP/SL Levels" , group = "Risk Management" , inline = "MMDB2")
lvlLines = input.bool(false, "Show Lines ", inline="levels", group = "Risk Management")
linesStyle = input.string("SOLID", "", , inline="levels", group = "Risk Management")
lvlDistance = input.int(105, "Distance", 1, inline="levels2", group = "Risk Management")
lvlDecimals = input.int(2, " Decimals", 1, 8, inline="levels2", group = "Risk Management")
atrRisk = input.int(5, "Risk % ", 1, group = "Risk Management" , inline="levels3")
atrLen = input.int(14, " ATR Length", 1, group = "Risk Management" , inline="levels3")
decimals = lvlDecimals == 1 ? "#.#" : lvlDecimals == 2 ? "#.##" : lvlDecimals == 3 ? "#.###" : lvlDecimals == 4 ? "#.####" : lvlDecimals == 5 ? "#.#####" : lvlDecimals == 6 ? "#.######" : lvlDecimals == 7 ? "#.#######" : "#.########"
trigger2 = longCondition ? 1 : 0
countBull = ta.barssince(longCondition)
countBear = ta.barssince(shortCondition)
trigger = nz(countBull, bar_index) < nz(countBear, bar_index) ? 1 : 0
atrBand = ta.atr(atrLen) * atrRisk
atrStop = trigger == 1 ? low - atrBand : high + atrBand
lastTrade(close) => ta.valuewhen(longCondition or shortCondition, close, 0)
entry = levels ? label.new(time, close, "ENTRY " + str.tostring(lastTrade(close), decimals), xloc.bar_time, yloc.price, #e0ad06, label.style_label_left, color.white, size.normal) : na
label.set_x(entry, label.get_x(entry) + math.round(ta.change(time) * lvlDistance))
label.set_y(entry, lastTrade(close))
label.delete(entry )
stop_y = lastTrade(atrStop)
stop = levels ? label.new(time, close, "SL " + str.tostring(stop_y, decimals), xloc.bar_time, yloc.price, #ff00008c, label.style_label_left, color.white, size.normal) : na
label.set_x(stop, label.get_x(stop) + math.round(ta.change(time) * lvlDistance))
label.set_y(stop, stop_y)
label.delete(stop )
tp1Rl_y = (lastTrade(close)-lastTrade(atrStop))*1 + lastTrade(close)
tp1Rl = levels ? label.new(time, close, "1:1 TP " + str.tostring(tp1Rl_y, decimals), xloc.bar_time, yloc.price, #00cf4b8c, label.style_label_left, color.white, size.normal ) : na
label.set_x(tp1Rl, label.get_x(tp1Rl) + math.round(ta.change(time) * lvlDistance))
label.set_y(tp1Rl, tp1Rl_y)
label.delete(tp1Rl )
tp2RL_y = (lastTrade(close)-lastTrade(atrStop))*2 + lastTrade(close)
tp2RL = levels ? label.new(time, close, "2:1 TP " + str.tostring(tp2RL_y, decimals), xloc.bar_time, yloc.price, #00cf4b8c, label.style_label_left, color.white, size.normal) : na
label.set_x(tp2RL, label.get_x(tp2RL) + math.round(ta.change(time) * lvlDistance))
label.set_y(tp2RL, tp2RL_y)
label.delete(tp2RL )
tp3RL_y = (lastTrade(close)-lastTrade(atrStop))*3 + lastTrade(close)
tp3RL = levels ? label.new(time, close, "3:1 TP " + str.tostring(tp3RL_y, decimals), xloc.bar_time, yloc.price, #00cf4b8c, label.style_label_left, color.white, size.normal) : na
label.set_x(tp3RL, label.get_x(tp3RL) + math.round(ta.change(time) * lvlDistance))
label.set_y(tp3RL, tp3RL_y)
label.delete(tp3RL )
style = linesStyle == "SOLID" ? line.style_solid : linesStyle == "DASHED" ? line.style_dashed : line.style_dotted
lineEntry = levels and lvlLines ? line.new(bar_index - (trigger == 0 ? countBull : countBear), lastTrade(close), bar_index + lvlDistance, lastTrade(close), xloc.bar_index, extend.none, #e0ad06, style, 2) : na, line.delete(lineEntry )
lineStop = levels and lvlLines ? line.new(bar_index - (trigger == 0 ? countBull : countBear), stop_y, bar_index + lvlDistance, stop_y, xloc.bar_index, extend.none, #ff00008c, style, 2) : na, line.delete(lineStop )
lineTp1Rl = levels and lvlLines ? line.new(bar_index - (trigger == 0 ? countBull : countBear), tp1Rl_y, bar_index + lvlDistance, tp1Rl_y, xloc.bar_index, extend.none, #00cf4b8c, style, 2) : na, line.delete(lineTp1Rl )
lineTp2RL = levels and lvlLines ? line.new(bar_index - (trigger == 0 ? countBull : countBear), tp2RL_y, bar_index + lvlDistance, tp2RL_y, xloc.bar_index, extend.none, #00cf4b8c, style, 2) : na, line.delete(lineTp2RL )
lineTp3RL = levels and lvlLines ? line.new(bar_index - (trigger == 0 ? countBull : countBear), tp3RL_y, bar_index + lvlDistance, tp3RL_y, xloc.bar_index, extend.none, #00cf4b8c, style, 2) : na, line.delete(lineTp3RL )
//Plot Buy and Sell Labels
plotshape(longCondition, title='Buy Signal', text='Buy ▲+ ', textcolor=color.white, style=shape.labelup, size=size.normal, location=location.belowbar, color=#00cf4b8c)
plotshape(shortCondition, title='Sell Signal', text='Sell ▼+', textcolor=color.white, style=shape.labeldown, size=size.normal, location=location.abovebar, color=#ff00008c)
//Alerts
alertcondition(longCondition, title='Buy Alert', message='BUY')
alertcondition(shortCondition, title='Sell Alert', message='SELL')
//
// ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
// ---------------------------------------------- SR ------------------------------------------------
//
show_current_sr = input.bool(true, title = "Show Current TF S/R", group = "Setting")
swing_length = input.int(10, title = 'Swing Length', group = 'Setting', minval = 1, maxval = 50)
history_of_demand_to_keep = input.int(20, title = 'Lookback', minval = 5, maxval = 50, group = "Setting")
box_width = input.float(10, title = 'S/R Range', group = 'Setting', minval = 1, maxval = 10, step = 0.5)
string group3 = "TF Setting"
enableHtf1 = input.bool(false, group = group3, inline = "htf1", title = "")
htf1 = input.timeframe("W", "TF1", group = group3, inline = "htf1")
enableHtf2 = input.bool(false, group = group3, inline = "htf2", title = "")
htf2 = input.timeframe("D", "TF2", group = group3, inline = "htf2")
enableHtf3 = input.bool(false, group = group3, inline = "htf3", title = "")
htf3 = input.timeframe("240", "TF3", group = group3, inline = "htf3")
enableHtf4 = input.bool(false, group = group3, inline = "htf4", title = "")
htf4 = input.timeframe("180", "TF4", group = group3, inline = "htf4")
enableHtf5 = input.bool(false, group = group3, inline = "htf5", title = "")
htf5 = input.timeframe("120", "TF5", group = group3, inline = "htf5")
enableHtf6 = input.bool(false, group = group3, inline = "htf6", title = "")
htf6 = input.timeframe("60", "TF6", group = group3, inline = "htf6")
enableHtf7 = input.bool(false, group = group3, inline = "htf7", title = "")
htf7 = input.timeframe("45", "TF7", group = group3, inline = "htf7")
enableHtf8 = input.bool(true, group = group3, inline = "htf8", title = "")
htf8 = input.timeframe("30", "TF8", group = group3, inline = "htf8")
enableHtf9 = input.bool(false, group = group3, inline = "htf9", title = "")
htf9 = input.timeframe("15", "TF9", group = group3, inline = "htf9")
supply_color = input.color(#f236468a, title = 'Support Zone', group = 'Color Settings', inline = '3')
supply_outline_color = input.color(#f236468a, title = 'BoS', group = 'Color Settings', inline = '3')
demand_color = input.color(#2962ff8a, title = 'Resistance Zone', group = 'Color Settings', inline = '4')
demand_outline_color = input.color(#2962ff8a, title = 'BoR', group = 'Color Settings', inline = '4')
// bos_label_color = input.color(color.white, title = 'Fracture Zone', group = 'Color Settings', inline = '5')
poi_label_color = input.color(#b9b9b9, title = 'S/R Zone Label', group = 'Color Settings', inline = '7')
type zone_with_strength
box zone
int count = 0
string tf
// FUNCTION TO ADD NEW AND REMOVE LAST IN ARRAY
array_add_pop(array, new_value_to_add) =>
array.unshift(array, new_value_to_add)
array.pop(array)
// FUNCTION MAKE SURE SUPPLY ISNT OVERLAPPING
check_overlapping(new_poi, box_array, atr) =>
atr_threshold = atr * 2
okay_to_draw = true
for i = 0 to array.size(box_array) - 1
zone_with_strength zws = array.get(box_array, i)
if not na(zws)
box b = zws.zone
top = box.get_top(b)
bottom = box.get_bottom(b)
poi = (top + bottom) / 2
upper_boundary = poi + atr_threshold
lower_boundary = poi - atr_threshold
if new_poi >= lower_boundary and new_poi <= upper_boundary
okay_to_draw := false
break
else
okay_to_draw := true
okay_to_draw
// FUNCTION TO DRAW SUPPLY OR DEMAND ZONE
support_resistance(value_array, bn_array, box_array, label_array, count_array, box_type, atr, tf_label, tfbarindex, is_htf) =>
atr_buffer = atr * (box_width / 10)
box_left = is_htf ? bar_index : array.get(bn_array, 0)
box_right = bar_index
var float box_top = 0.00
var float box_bottom = 0.00
var float poi = 0.00
if box_type == 1
box_top := array.get(value_array, 0)
box_bottom := box_top - atr_buffer
poi := (box_top + box_bottom) / 2
else if box_type == -1
box_bottom := array.get(value_array, 0)
box_top := box_bottom + atr_buffer
poi := (box_top + box_bottom) / 2
okay_to_draw = check_overlapping(poi, box_array, atr)
// okay_to_draw = true
//delete oldest box, and then create a new box and add it to the array
if box_type == 1 and okay_to_draw
zone_with_strength last = array.get(box_array, array.size(box_array) - 1)
if not na(last)
box.delete(last.zone)
box b = box.new(left = box_left, top = box_top, right = bar_index, bottom = box_bottom, border_color = supply_outline_color,
bgcolor = color.new(supply_color, 80), extend = extend.none, text = tf_label, text_halign = text.align_right, text_valign = text.align_center, text_color = poi_label_color, text_size = size.small, xloc = xloc.bar_index)
zone_with_strength zws = zone_with_strength.new(b, 0, tf_label)
array_add_pop(box_array, zws)
else if box_type == -1 and okay_to_draw
zone_with_strength last = array.get(box_array, array.size(box_array) - 1)
if not na(last)
box.delete(last.zone)
box b = box.new(left = box_left, top = box_top, right = bar_index, bottom = box_bottom, border_color = demand_outline_color,
bgcolor = color.new(demand_color, 80), extend = extend.none, text = tf_label, text_halign = text.align_right, text_valign = text.align_center, text_color = poi_label_color, text_size = size.small, xloc = xloc.bar_index)
zone_with_strength zws = zone_with_strength.new(b, 0, tf_label)
array_add_pop(box_array, zws)
// FUNCTION TO CHANGE SUPPLY/DEMAND TO A BOS IF BROKEN
sd_to_bos(box_array, bos_array, count_array, label_array, zone_type, tfclose, tfbarindex) =>
for i = 0 to array.size(box_array) - 1
zone_with_strength zws = array.get(box_array, i)
if not na(zws)
box b = zws.zone
level_to_break_top = box.get_top(b)
level_to_break_bottom = box.get_bottom(b)
// if ta.crossover(close, level_to_break)
if (zone_type == 1 and close >= level_to_break_top) or (zone_type == -1 and close <= level_to_break_bottom)
copied_zone = zone_with_strength.copy(zws)
box cz = copied_zone.zone
mid = (box.get_top(b) + box.get_bottom(b)) / 2
line bosline = line.new(box.get_left(cz), mid, bar_index, mid, xloc.bar_index, extend.none, zone_type == 1 ? supply_outline_color : demand_outline_color, line.style_dotted)
array_add_pop(bos_array, bosline)
// box bos = array.get(bos_array, 0)
// box.set_top(bos, mid)
// box.set_bottom(bos, mid)
// box.set_right(bos, bar_index)
// box.set_extend(bos, extend.none)
// box.set_text(bos, '')
// box.set_text_color( bos, bos_label_color)
// box.set_text_size(bos, size.small)
// box.set_text_halign(bos, text.align_center)
// box.set_text_valign(bos, text.align_center)
box.delete(b)
array.set(box_array, i, na)
// array.remove(box_array, i)
// box.delete(array.get(label_array, i))
// FUNCTION MANAGE CURRENT BOXES BY CHANGING ENDPOINT
extend_box_endpoint(box_array, count_array, tfbarindex, tfhigh, tflow) =>
for i = 0 to array.size(box_array) - 1
zone_with_strength zws = array.get(box_array, i)
if not na(zws)
box b = zws.zone
top = box.get_top(b)
bottom = box.get_bottom(b)
count = zws.count
if (high >= bottom and high <= top) or (low >= bottom and low <= top)
count := count + 1
zws.count := count
// count := count + 1
// zws.count := count
box.set_right(b, bar_index + 40)
box.set_text(b, str.format("{0} / {1}", count, zws.tf))
zws.zone := b
array.set(box_array, i, zws)
//
//END FUNCTIONS
//
//
// CALCULATIONS FOR SUPPORT AND RESISTANCE
//
calculateSR(swing_high_values, swing_low_values, swing_high_bns, swing_low_bns, supply_zone, demand_zone, current_supply_touch_count, current_demand_touch_count, current_supply_poi, current_demand_poi, supply_bos, demand_bos, series1, series2, tf_label, tfbarindex, tfclose, atr, is_htf, swing_high, swing_low, swing_index) =>
// NEW SWING HIGH
if not na(swing_high)
//MANAGE SWING HIGH VALUES
array_add_pop(swing_high_values, swing_high)
array_add_pop(swing_high_bns, swing_index)
support_resistance(swing_high_values, swing_high_bns, supply_zone, current_supply_poi, current_supply_touch_count, 1, atr, tf_label, tfbarindex, is_htf)
// NEW SWING LOW
else if not na(swing_low)
//MANAGE SWING LOW VALUES
array_add_pop(swing_low_values, swing_low)
array_add_pop(swing_low_bns, swing_index)
support_resistance(swing_low_values, swing_low_bns, demand_zone, current_demand_poi, current_demand_touch_count, -1, atr, tf_label, tfbarindex, is_htf)
sd_to_bos(supply_zone, supply_bos, current_supply_touch_count, current_supply_poi, 1, tfclose, tfbarindex)
sd_to_bos(demand_zone, demand_bos, current_demand_touch_count, current_demand_poi, -1, tfclose, tfbarindex)
extend_box_endpoint(supply_zone, current_supply_touch_count, tfbarindex, series1, series2)
extend_box_endpoint(demand_zone, current_demand_touch_count, tfbarindex, series1, series2)
var swing_high_values = array.new_float(5,0.00)
var swing_low_values = array.new_float(5,0.00)
var swing_high_bns = array.new_int(5,0)
var swing_low_bns = array.new_int(5,0)
// ARRAYS FOR SUPPORT / RESISTANCE POI LABELS
var current_supply_poi = array.new_box(history_of_demand_to_keep, na)
var current_demand_poi = array.new_box(history_of_demand_to_keep, na)
var supply_zones = array.new(history_of_demand_to_keep, na)
var demand_zones = array.new(history_of_demand_to_keep, na)
var touches_for_supply = array.new_int(history_of_demand_to_keep, 0)
var touches_for_demand = array.new_int(history_of_demand_to_keep, 0)
// ARRAYS FOR BOS
var supply_bos = array.new_line(5, na)
var demand_bos = array.new_line(5, na)
var swing_high_values1 = array.new_float(5,0.00)
var swing_low_values1 = array.new_float(5,0.00)
var swing_high_bns1 = array.new_int(5,0)
var swing_low_bns1 = array.new_int(5,0)
// ARRAYS FOR SUPPORT / RESISTANCE
var supply_zones1 = array.new(history_of_demand_to_keep, na)
var demand_zones1 = array.new(history_of_demand_to_keep, na)
var touches_for_supply1 = array.new_int(history_of_demand_to_keep, 0)
var touches_for_demand1 = array.new_int(history_of_demand_to_keep, 0)
// ARRAYS FOR SUPPORT / RESISTANCE POI LABELS
var current_supply_poi1 = array.new_box(history_of_demand_to_keep, na)
var current_demand_poi1 = array.new_box(history_of_demand_to_keep, na)
// ARRAYS FOR BOS
var supply_bos1 = array.new_line(5, na)
var demand_bos1 = array.new_line(5, na)
var swing_high_values2 = array.new_float(5,0.00)
var swing_low_values2 = array.new_float(5,0.00)
var swing_high_bns2 = array.new_int(5,0)
var swing_low_bns2 = array.new_int(5,0)
// ARRAYS FOR SUPPORT / RESISTANCE
var supply_zones2 = array.new(history_of_demand_to_keep, na)
var demand_zones2 = array.new(history_of_demand_to_keep, na)
var touches_for_supply2 = array.new_int(history_of_demand_to_keep, 0)
var touches_for_demand2 = array.new_int(history_of_demand_to_keep, 0)
// ARRAYS FOR SUPPORT / RESISTANCE POI LABELS
var current_supply_poi2 = array.new_box(history_of_demand_to_keep, na)
var current_demand_poi2 = array.new_box(history_of_demand_to_keep, na)
// ARRAYS FOR BOS
var supply_bos2 = array.new_line(5, na)
var demand_bos2 = array.new_line(5, na)
var swing_high_values3 = array.new_float(5,0.00)
var swing_low_values3 = array.new_float(5,0.00)
var swing_high_bns3 = array.new_int(5,0)
var swing_low_bns3 = array.new_int(5,0)
// ARRAYS FOR SUPPORT / RESISTANCE
var supply_zones3 = array.new(history_of_demand_to_keep, na)
var demand_zones3 = array.new(history_of_demand_to_keep, na)
var touches_for_supply3 = array.new_int(history_of_demand_to_keep, 0)
var touches_for_demand3 = array.new_int(history_of_demand_to_keep, 0)
// ARRAYS FOR SUPPORT / RESISTANCE POI LABELS
var current_supply_poi3 = array.new_box(history_of_demand_to_keep, na)
var current_demand_poi3 = array.new_box(history_of_demand_to_keep, na)
// ARRAYS FOR BOS
var supply_bos3 = array.new_line(5, na)
var demand_bos3 = array.new_line(5, na)
var swing_high_values4 = array.new_float(5,0.00)
var swing_low_values4 = array.new_float(5,0.00)
var swing_high_bns4 = array.new_int(5,0)
var swing_low_bns4 = array.new_int(5,0)
// ARRAYS FOR SUPPORT / RESISTANCE
var supply_zones4 = array.new(history_of_demand_to_keep, na)
var demand_zones4 = array.new(history_of_demand_to_keep, na)
var touches_for_supply4 = array.new_int(history_of_demand_to_keep, 0)
var touches_for_demand4 = array.new_int(history_of_demand_to_keep, 0)
// ARRAYS FOR SUPPORT / RESISTANCE POI LABELS
var current_supply_poi4 = array.new_box(history_of_demand_to_keep, na)
var current_demand_poi4 = array.new_box(history_of_demand_to_keep, na)
// ARRAYS FOR BOS
var supply_bos4 = array.new_line(5, na)
var demand_bos4 = array.new_line(5, na)
var swing_high_values5 = array.new_float(5,0.00)
var swing_low_values5 = array.new_float(5,0.00)
var swing_high_bns5 = array.new_int(5,0)
var swing_low_bns5 = array.new_int(5,0)
// ARRAYS FOR SUPPORT / RESISTANCE
var supply_zones5 = array.new(history_of_demand_to_keep, na)
var demand_zones5 = array.new(history_of_demand_to_keep, na)
var touches_for_supply5 = array.new_int(history_of_demand_to_keep, 0)
var touches_for_demand5 = array.new_int(history_of_demand_to_keep, 0)
// ARRAYS FOR SUPPORT / RESISTANCE POI LABELS
var current_supply_poi5 = array.new_box(history_of_demand_to_keep, na)
var current_demand_poi5 = array.new_box(history_of_demand_to_keep, na)
// ARRAYS FOR BOS
var supply_bos5 = array.new_line(5, na)
var demand_bos5 = array.new_line(5, na)
var swing_high_values6 = array.new_float(5,0.00)
var swing_low_values6 = array.new_float(5,0.00)
var swing_high_bns6 = array.new_int(5,0)
var swing_low_bns6 = array.new_int(5,0)
// ARRAYS FOR SUPPORT / RESISTANCE
var supply_zones6 = array.new(history_of_demand_to_keep, na)
var demand_zones6 = array.new(history_of_demand_to_keep, na)
var touches_for_supply6 = array.new_int(history_of_demand_to_keep, 0)
var touches_for_demand6 = array.new_int(history_of_demand_to_keep, 0)
// ARRAYS FOR SUPPORT / RESISTANCE POI LABELS
var current_supply_poi6 = array.new_box(history_of_demand_to_keep, na)
var current_demand_poi6 = array.new_box(history_of_demand_to_keep, na)
// ARRAYS FOR BOS
var supply_bos6 = array.new_line(5, na)
var demand_bos6 = array.new_line(5, na)
var swing_high_values7 = array.new_float(5,0.00)
var swing_low_values7 = array.new_float(5,0.00)
var swing_high_bns7 = array.new_int(5,0)
var swing_low_bns7 = array.new_int(5,0)
// ARRAYS FOR SUPPORT / RESISTANCE
var supply_zones7 = array.new(history_of_demand_to_keep, na)
var demand_zones7 = array.new(history_of_demand_to_keep, na)
var touches_for_supply7 = array.new_int(history_of_demand_to_keep, 0)
var touches_for_demand7 = array.new_int(history_of_demand_to_keep, 0)
// ARRAYS FOR SUPPORT / RESISTANCE POI LABELS
var current_supply_poi7 = array.new_box(history_of_demand_to_keep, na)
var current_demand_poi7 = array.new_box(history_of_demand_to_keep, na)
// ARRAYS FOR BOS
var supply_bos7 = array.new_line(5, na)
var demand_bos7 = array.new_line(5, na)
var swing_high_values8 = array.new_float(5,0.00)
var swing_low_values8 = array.new_float(5,0.00)
var swing_high_bns8 = array.new_int(5,0)
var swing_low_bns8 = array.new_int(5,0)
// ARRAYS FOR SUPPORT / RESISTANCE
var supply_zones8 = array.new(history_of_demand_to_keep, na)
var demand_zones8 = array.new(history_of_demand_to_keep, na)
var touches_for_supply8 = array.new_int(history_of_demand_to_keep, 0)
var touches_for_demand8 = array.new_int(history_of_demand_to_keep, 0)
// ARRAYS FOR SUPPORT / RESISTANCE POI LABELS
var current_supply_poi8 = array.new_box(history_of_demand_to_keep, na)
var current_demand_poi8 = array.new_box(history_of_demand_to_keep, na)
// ARRAYS FOR BOS
var supply_bos8 = array.new_line(5, na)
var demand_bos8 = array.new_line(5, na)
var swing_high_values9 = array.new_float(5,0.00)
var swing_low_values9 = array.new_float(5,0.00)
var swing_high_bns9 = array.new_int(5,0)
var swing_low_bns9 = array.new_int(5,0)
// ARRAYS FOR SUPPORT / RESISTANCE
var supply_zones9 = array.new(history_of_demand_to_keep, na)
var demand_zones9 = array.new(history_of_demand_to_keep, na)
var touches_for_supply9 = array.new_int(history_of_demand_to_keep, 0)
var touches_for_demand9 = array.new_int(history_of_demand_to_keep, 0)
// ARRAYS FOR SUPPORT / RESISTANCE POI LABELS
var current_supply_poi9 = array.new_box(history_of_demand_to_keep, na)
var current_demand_poi9 = array.new_box(history_of_demand_to_keep, na)
// ARRAYS FOR BOS
var supply_bos9 = array.new_line(5, na)
var demand_bos9 = array.new_line(5, na)
atr = ta.atr(50)
if show_current_sr
cur_tf_label = timeframe.isintraday ? str.tostring(timeframe.in_seconds() / 60, "#.## MIN") : timeframe.period
swing_high = ta.pivothigh(swing_length, swing_length)
swing_low = ta.pivotlow(swing_length, swing_length)
swing_index = bar_index
calculateSR(swing_high_values, swing_low_values, swing_high_bns, swing_low_bns, supply_zones, demand_zones, touches_for_supply, touches_for_demand, current_supply_poi, current_demand_poi, supply_bos, demand_bos, high, low, cur_tf_label, bar_index, close, atr, false, swing_high, swing_low, swing_index)
// SUPPORT / RESISTANCE FOR HTF1
= request.security(syminfo.tickerid, htf1, [high, low, close, bar_index, ta.atr(50), timeframe.isintraday ? str.tostring(timeframe.in_seconds() / 60, "#.## MIN") : timeframe.period, ta.pivothigh(swing_length, swing_length), ta.pivotlow(swing_length, swing_length), bar_index ])
// SUPPORT / RESISTANCE FOR HTF2
= request.security(syminfo.tickerid, htf2, [high, low, close, bar_index, ta.atr(50), timeframe.isintraday ? str.tostring(timeframe.in_seconds() / 60, "#.## MIN") : timeframe.period, ta.pivothigh(swing_length, swing_length), ta.pivotlow(swing_length, swing_length), bar_index ])
// SUPPORT / RESISTANCE FOR HTF3
= request.security(syminfo.tickerid, htf3, [high, low, close, bar_index, ta.atr(50), timeframe.isintraday ? str.tostring(timeframe.in_seconds() / 60, "#.## MIN") : timeframe.period, ta.pivothigh(swing_length, swing_length), ta.pivotlow(swing_length, swing_length), bar_index ])
// SUPPORT / RESISTANCE FOR HTF4
= request.security(syminfo.tickerid, htf4, [high, low, close, bar_index, ta.atr(50), timeframe.isintraday ? str.tostring(timeframe.in_seconds() / 60, "#.## MIN") : timeframe.period, ta.pivothigh(swing_length, swing_length), ta.pivotlow(swing_length, swing_length), bar_index ])
// SUPPORT / RESISTANCE FOR HTF5
= request.security(syminfo.tickerid, htf5, [high, low, close, bar_index, ta.atr(50), timeframe.isintraday ? str.tostring(timeframe.in_seconds() / 60, "#.## MIN") : timeframe.period, ta.pivothigh(swing_length, swing_length), ta.pivotlow(swing_length, swing_length), bar_index ])
// SUPPORT / RESISTANCE FOR HTF6
= request.security(syminfo.tickerid, htf6, [high, low, close, bar_index, ta.atr(50), timeframe.isintraday ? str.tostring(timeframe.in_seconds() / 60, "#.## MIN") : timeframe.period, ta.pivothigh(swing_length, swing_length), ta.pivotlow(swing_length, swing_length), bar_index ])
// SUPPORT / RESISTANCE FOR HTF7
= request.security(syminfo.tickerid, htf7, [high, low, close, bar_index, ta.atr(50), timeframe.isintraday ? str.tostring(timeframe.in_seconds() / 60, "#.## MIN") : timeframe.period, ta.pivothigh(swing_length, swing_length), ta.pivotlow(swing_length, swing_length), bar_index ])
// SUPPORT / RESISTANCE FOR HTF8
= request.security(syminfo.tickerid, htf8, [high, low, close, bar_index, ta.atr(50), timeframe.isintraday ? str.tostring(timeframe.in_seconds() / 60, "#.## MIN") : timeframe.period, ta.pivothigh(swing_length, swing_length), ta.pivotlow(swing_length, swing_length), bar_index ])
// SUPPORT / RESISTANCE FOR HTF9
= request.security(syminfo.tickerid, htf9, [high, low, close, bar_index, ta.atr(50), timeframe.isintraday ? str.tostring(timeframe.in_seconds() / 60, "#.## MIN") : timeframe.period, ta.pivothigh(swing_length, swing_length), ta.pivotlow(swing_length, swing_length), bar_index ])
if enableHtf1 and htf1 != ""
calculateSR(swing_high_values1, swing_low_values1, swing_high_bns1, swing_low_bns1, supply_zones1, demand_zones1, touches_for_supply1, touches_for_demand1, current_supply_poi1, current_demand_poi1, supply_bos1, demand_bos1, high1, low1, timeframe1, barindex1, close1, atr1, true, swing_high1, swing_low1, swing_index1)
if enableHtf2 and htf2 != ""
calculateSR(swing_high_values2, swing_low_values2, swing_high_bns2, swing_low_bns2, supply_zones2, demand_zones2, touches_for_supply2, touches_for_demand2, current_supply_poi2, current_demand_poi2, supply_bos2, demand_bos2, high2, low2, timeframe2, barindex2, close2, atr2, true, swing_high2, swing_low2, swing_index2)
if enableHtf3 and htf3 != ""
calculateSR(swing_high_values3, swing_low_values3, swing_high_bns3, swing_low_bns3, supply_zones3, demand_zones3, touches_for_supply3, touches_for_demand3, current_supply_poi3, current_demand_poi3, supply_bos3, demand_bos3, high3, low3, timeframe3, barindex3, close3, atr3, true, swing_high3, swing_low3, swing_index3)
if enableHtf4 and htf4 != ""
calculateSR(swing_high_values4, swing_low_values4, swing_high_bns4, swing_low_bns4, supply_zones4, demand_zones4, touches_for_supply4, touches_for_demand4, current_supply_poi4, current_demand_poi4, supply_bos4, demand_bos4, high4, low4, timeframe4, barindex4, close4, atr4, true, swing_high4, swing_low4, swing_index4)
if enableHtf5 and htf5 != ""
calculateSR(swing_high_values5, swing_low_values5, swing_high_bns5, swing_low_bns5, supply_zones5, demand_zones5, touches_for_supply5, touches_for_demand5, current_supply_poi5, current_demand_poi5, supply_bos5, demand_bos5, high5, low5, timeframe5, barindex5, close5, atr5, true, swing_high5, swing_low5, swing_index5)
if enableHtf6 and htf6 != ""
calculateSR(swing_high_values6, swing_low_values6, swing_high_bns6, swing_low_bns6, supply_zones6, demand_zones6, touches_for_supply6, touches_for_demand6, current_supply_poi6, current_demand_poi6, supply_bos6, demand_bos6, high6, low6, timeframe6, barindex6, close6, atr6, true, swing_high6, swing_low6, swing_index6)
if enableHtf7 and htf7 != ""
calculateSR(swing_high_values7, swing_low_values7, swing_high_bns7, swing_low_bns7, supply_zones7, demand_zones7, touches_for_supply7, touches_for_demand7, current_supply_poi7, current_demand_poi7, supply_bos7, demand_bos7, high7, low7, timeframe7, barindex7, close7, atr7, true, swing_high7, swing_low7, swing_index7)
if enableHtf8 and htf8 != ""
calculateSR(swing_high_values8, swing_low_values8, swing_high_bns8, swing_low_bns8, supply_zones8, demand_zones8, touches_for_supply8, touches_for_demand8, current_supply_poi8, current_demand_poi8, supply_bos8, demand_bos8, high8, low8, timeframe8, barindex8, close8, atr8, true, swing_high8, swing_low8, swing_index8)
if enableHtf9 and htf9 != ""
calculateSR(swing_high_values9, swing_low_values9, swing_high_bns9, swing_low_bns9, supply_zones9, demand_zones9, touches_for_supply9, touches_for_demand9, current_supply_poi9, current_demand_poi9, supply_bos9, demand_bos9, high9, low9, timeframe9, barindex9, close9, atr9, true, swing_high9, swing_low9, swing_index9)
Stochastic Swing PointUsing Stochastic to define any swing points.
When Stochastic is OB or OS this indicator will find a high and low to create a label on it.
Default setting is 9 3 3 OB 80 OS 20
for educational purpose only
Support and Resistance MTFSupport and Resistance MTF
Support and Resistance MTF is a powerful tool that automatically detects and visualizes key support and resistance levels based on pivot highs and lows, using a higher timeframe of your choice. It is designed for traders who focus on price action and market structure, and want an adaptive, clean, and customizable indicator that helps identify important market zones.
The script uses configurable pivot logic to identify levels, with user-defined parameters for pivot strength and timeframe. Once a support or resistance level is detected, it is displayed on the chart either as a horizontal line, a shaded box, or both, depending on your display settings. You can fully customize the visual appearance including color, transparency, and line thickness. Levels are automatically extended into the future, and optionally into the past, to give better context.
Each level is monitored for breakout behavior. If price breaks through a level, it can change its role — a former resistance may become support, and vice versa. After a certain number of breakouts (which you define), the level is considered invalid and is automatically removed from the chart. This helps to maintain a clean visual layout and ensures only relevant levels are shown.
The indicator supports multi-timeframe analysis, allowing you to overlay higher-timeframe structure directly on your lower-timeframe trading chart. It is also compatible with Heikin Ashi candles internally for reference, without affecting your main chart type.
Support and Resistance MTF is ideal for traders looking to align intraday setups with higher-timeframe zones, manage risk around structural levels, or simply highlight market turning points in a clear and automated way. Built with Pine Script v5 and optimized for performance, it is both powerful and lightweight.
⚙️ Input Parameters – Description
[Time-Frame
Defines the higher timeframe used for detecting support and resistance levels. For example, you can set this to 1h, 4h, or D to visualize significant levels from a broader market perspective on a lower-timeframe chart.
Left / Right (Pivot Left / Pivot Right)
These parameters control the sensitivity of the pivot detection. A pivot high/low is confirmed if it is higher/lower than the defined number of candles to its left and right. Higher values reduce noise but may miss smaller turning points.
Extend Left
When enabled, the drawn levels (lines and/or boxes) are extended to the left side of the chart, allowing you to see the historical alignment of these levels.
Max Breaks Before Delete
Defines how many times a level can be broken by price before it is removed from the chart. This helps to avoid clutter from outdated or invalidated levels and keeps your chart relevant to current price action.
Draw Lines Only
If enabled, the indicator will draw only horizontal lines for support and resistance zones, omitting the colored background boxes. Useful for a cleaner chart appearance.
Line Width Broken Level
Sets the thickness of the support/resistance lines. Thicker lines can emphasize key levels, especially after a breakout.
Transparency Boxes
Controls the transparency (0–100) of the background boxes representing the zones. A higher value makes the boxes more transparent, lower values make them more opaque.
Transparency Lines
Controls the transparency (0–100) of the horizontal support and resistance lines. This allows for visual fine-tuning based on chart background and personal preference.
Support (Color, Group: Display)
Lets you choose the color used for support zones and lines. By default, it's green, but you can change it to fit your theme or visual preference.
Resistance (Color, Group: Display)
Defines the color for resistance zones and lines. The default is red, but it can be customized freely.
ZLTSv3Using AlgoAlpha's Zero Lag trend signals. Focused on shrinking the size of the table and indicator name to have more viewing of the chart.
Tie it with other indicator based around TCG AI Tools. The modification I made to that indicator is to show multi timeframe rsi's in addition to using it for the 12/26 ema trend ribbon and notifying when bb and rsi go to extremes.
I hope these help others on their journey to profitability.
Interpolated Median Volatility LSMA | OttoThis indicator combines trend-following and volatility analysis by enhancing traditional LSMA with percentile-based linear interpolation applied to both the Least Squares Moving Average (LSMA) and standard deviation. Rather than relying on raw values, it uses the interpolated median (50th percentile) to smooth out noise while preserving sensitivity to significant price shifts. This approach produces a cleaner trend signal that remains responsive to real market changes, adapts to evolving volatility conditions, and improves the accuracy of breakout detection.
Core Concept
The indicator builds on these core components:
LSMA (Least Squares Moving Average): A linear regression-based moving average that fits line using user selected source over user defined period. It offers a smoother and more reactive trend signal compared to standard moving averages.
Standard Deviation shows how much price varies from the mean. In this indicator, it’s used to measure market volatility.
Volatility Bands: Instead of traditional Bollinger-style bands, this script calculates custom upper and lower bands using percentile-based linear interpolation on both the LSMA and standard deviation. This method produces smoother bands that filter out noise while remaining adaptive to meaningful price movements, making them more aligned with real market behavior and helping reduce false signals.
Percentile interpolation estimates a specific percentile (like the median — the 50th percentile) from a set of values — even when that percentile doesn't fall exactly on one data point. Instead of selecting a single nearest value, it calculates a smoothed value between nearby points. In this script, it’s used to find the median of past LSMA and standard deviation values, reducing the impact of outliers and smoothing the trend and volatility signals for more robust results.
Signal Logic: A long signal is identified when close price goes above the upper band, and a short signal when close price goes below the lower band.
⚙️ Inputs
Source: The price source used in calculations
LSMA Length: Period for calculating LSMA
Standard Deviation Length: Period for calculating volatility
Percentile Length: Period used for interpolating percentile values of LSMA and standard deviation
Multiplier: Controls the width of the bands by scaling the interpolated standard deviation
📈 Visual Output
Colored LSMA Line: Changes color based on signal (green for bullish, purple for bearish)
Upper & Lower Bands: Volatility bands calculated using interpolated values (green for bullish, purple for bearish)
Bar Coloring: Price bars are colored to reflect signal state (green for bullish, purple for bearish)
Optional Candlestick Overlay: Enhances visual context by coloring candles to match the signal state (green for bullish, purple for bearish)
How to Use
Add the indicator to your chart and look for signals when close price goes above or below the bands.
Long Signal: close Price goes above the upper band
Short Signal: close Price goes below the lower band
🔔 Alerts:
This script supports alert conditions for long and short signals. You can set alerts based on band crossovers to be notified of potential entries/exits.
⚠️ Disclaimer:
This indicator is intended for educational and informational purposes only. Trading/investing involves risk, and past performance does not guarantee future results. Always test and evaluate strategies before applying them in live markets. Use at your own risk.
Contrarian Crowd OscillatorEver enter a trade because it looks super bullish or bearish and immediately goes the other way?
The Contrarian Crowd Oscillator identifies dangerous market sentiment extremes by synthesizing multiple technical indicators into a single powerful contrarian signal. Stop getting trapped in crowded trades and start profiting from crowd psychology!
What This Indicator Does
This oscillator combines 6 different technical perspectives (RSI, Stochastic, Williams %R, CCI, ROC, and MFI) to measure market consensus and identify when sentiment becomes dangerously one-sided. It answers the critical question: "Is everyone thinking the same thing right now?"
Why This Works
Market psychology is predictable. When everyone becomes extremely bullish or bearish, they create unsustainable conditions:
Extreme Bullishness: No buyers left to push prices higher
Extreme Bearishness: No sellers left to push prices lower
High Consensus: Crowded trades become vulnerable to sudden reversals
This oscillator quantifies these psychological extremes and gives you the edge to trade against the crowd when they're most likely to be wrong.
NDOG & NWOG Indicatorndicator automatically identifies and displays New Day Opening Gaps (NDOG) and New Week Opening Gaps (NWOG) directly on your chart. It focuses on gaps based on specific session times in the New York (NY) timezone.
Key Features:
NDOG: Identifies the gap between the NY 4:59 PM (daily close) and the NY 6:00 PM (daily open).
NWOG: Identifies the gap between the Friday NY 4:59 PM (weekly close) and the Sunday NY 6:00 PM (weekly open).
Draws customizable lines for the high and low levels of each gap.
Option to show an additional mid-level line for each gap.
Includes options for line colors, styles, and width.
Allows filtering gaps by a minimum size.
Control the maximum number of recent NDOGs and NWOGs displayed.
Optionally shows text labels on the lines and a summary table on the chart.
This tool can help traders visualize potential areas of interest related to these specific opening gaps.
Note: Calculations are based on the "America/New_York" timezone.
Disclaimer: Trading involves risk and may not be suitable for all investors. This indicator is provided for informational and educational purposes only and does not constitute financial advice or a recommendation to trade. Use at your own risk.
Disha-Author(VAKA)Hourly Indicator which tells whether the hour is bullish or bearish based on 5/10/15 min candles on each hour if its AM -- and for PM its 10/15/20 min candles
TREND BUY-SELLTREND BUY SELL
//@version=5
indicator("TREND BUY-SELL", overlay = true)
// Get user input
// Dashboard
showDashboard = input(true, "Smart Panel", group = 'Dashboard Settings')
locationDashboard = input.string("Bottom Right", "Location", , group = 'Dashboard Settings', inline = 'agfh1')
sizeDashboard = input.string("Small", "Size", , group = 'Dashboard Settings', inline = 'agfh1')
// Signals
nbuysell = input.bool(true, 'Show Signals', inline = "BSNM",group='BUY AND SELL SIGNALS SETTINGS')
nsensitivity = input.float(defval=2, title="Sensitivity", minval=1, maxval=20, group='BUY AND SELL SIGNALS SETTINGS')
smartsignalsonly = input.bool(false, 'Smart Signals Only',group='BUY AND SELL SIGNALS SETTINGS')
barcoloringmode = input.string("Trend", "Bar Coloring", , inline="levels", group = 'BUY AND SELL SIGNALS SETTINGS')
//candlecolor = input.bool(true, 'Buy/Sell Signal', inline = "BSNM",group='BUY/SELL SIGNAL')
ema200con = ta.ema(close,200)
// Risk Management
levels = input.bool(false, "Take Profit/ Stop-Loss Areas" , group = "RISK MANAGEMENT SETTINGS" , inline = "MMDB2")
lvlLines = true
linesStyle = "DASHED"
lvlDistance = input.int(20, "Distance", 1, inline="levels2", group = "RISK MANAGEMENT SETTINGS")
lvlDecimals = input.int(2, " Decimals", 1, 8, inline="levels2", group = "RISK MANAGEMENT SETTINGS")
atrRisk = input.int(1, "Risk % ", 1, group = "RISK MANAGEMENT SETTINGS" , inline="levels3")
atrLen = input.int(14, " ATR Length", 1, group = "RISK MANAGEMENT SETTINGS" , inline="levels3")
decimals = lvlDecimals == 1 ? "#.#" : lvlDecimals == 2 ? "#.##" : lvlDecimals == 3 ? "#.###" : lvlDecimals == 4 ? "#.####" : lvlDecimals == 5 ? "#.#####" : lvlDecimals == 6 ? "#.######" : lvlDecimals == 7 ? "#.#######" : "#.########"
// Trend Features
LongTrendAverage = input(false, 'Trend Cloud', group='INDICATOR OVERLAY', inline = '1')
TrendFollower = input(false, 'Trend Follower', group='INDICATOR OVERLAY', inline = '1')
ShowComulus = input(false, 'Comulus Cloud', group='INDICATOR OVERLAY', inline = '2')
CirrusCloud = input(false, 'Cirrus Cloud', group='INDICATOR OVERLAY', inline = '2')
ShowSmartTrail = input(false,'Smart Trail', group='INDICATOR OVERLAY', inline = '3')
Showtrendlines = input(false,'Trend Lines', group='INDICATOR OVERLAY', inline = '3')
showsr = input(false, title="Support & Resistance", group = 'INDICATOR OVERLAY', inline = '4')
// Input settings
history_of_demand_to_keep = 20
show_zigzag = false
show_price_action_labels = false
swing_length = 8
box_width = 4
box_extend_option = "Both"
res = ''
s1 = request.security(syminfo.tickerid, res, showsr, gaps=barmerge.gaps_on)
demand_color = #0395ff4d
supply_color = #ff00024d
// Signal Generation
supertrend(_close, factor, atrLen) =>
atr = ta.atr(atrLen)
upperBand = _close + factor * atr
lowerBand = _close - factor * atr
prevLowerBand = nz(lowerBand )
prevUpperBand = nz(upperBand )
lowerBand := lowerBand > prevLowerBand or close < prevLowerBand ? lowerBand : prevLowerBand
upperBand := upperBand < prevUpperBand or close > prevUpperBand ? upperBand : prevUpperBand
int direction = na
float superTrend = na
prevSuperTrend = superTrend
if na(atr )
direction := 1
else if prevSuperTrend == prevUpperBand
direction := close > upperBand ? -1 : 1
else
direction := close < lowerBand ? 1 : -1
superTrend := direction == -1 ? lowerBand : upperBand
// SMA
ocAvg = math.avg(open, close)
sma4 = ta.sma(close, 50)
sma5 = ta.sma(close, 200)
sma9 = ta.sma(close, 13)
psar = ta.sar(0.02, 0.02, 0.2)
//*in Easy Words Super Trend + SMA = Signals
= supertrend(close, nsensitivity*2, 11)
source = close, period = 150
// Colors
green = #0395ff, green2 = #0395ff
red = #ff0002, red2 = #ff0002
adxlen = 15
dilen = 15
dirmov(len) =>
up = ta.change(high)
down = -ta.change(low)
plusDM = na(up) ? na : up > down and up > 0 ? up : 0
minusDM = na(down) ? na : down > up and down > 0 ? down : 0
truerange = ta.rma(ta.tr, len)
plus = fixnan(100 * ta.rma(plusDM, len) / truerange)
minus = fixnan(100 * ta.rma(minusDM, len) / truerange)
adx(dilen, adxlen) =>
= dirmov(dilen)
sum = plus + minus
adx = 100 * ta.rma(math.abs(plus - minus) / (sum == 0 ? 1 : sum), adxlen)
adx
sig = adx(dilen, adxlen)
// range ADX threshold
sidewaysThreshold = 15
// boolean expression to see if the ADX is below tehe sideways threshold
bool isSideways = sig < sidewaysThreshold
// adding the option to color the bars when in a trading range
useBarColor = true
bColor = isSideways ? color.new(#4b148d, 0) : na
//barcolor(isSideways and barcoloringmode == "Trend" ? bColor : na)
trendbarcolor = isSideways and barcoloringmode == "Trend" ? color.new(#4b148d, 0) : close > supertrend ? #0395ff : #ff0002
barcolor(trendbarcolor)
// High Lows
y1 = low - (ta.atr(30) * 2), y1B = low - ta.atr(30)
y2 = high + (ta.atr(30) * 2), y2B = high + ta.atr(30)
bull = ta.crossover(close, supertrend) and close >= sma9
bear = ta.crossunder(close, supertrend) and close <= sma9
// Plots
windowsize = 100
offset = 0.9
sigma = 6
//plot(ta.alma(source, windowsize, offset, sigma))
windowsize2 = 310
offset2 = 0.85
sigma2 = 32
//plot(ta.alma(source, windowsize2, offset2, sigma2))
// Chart Features
smoothrng(x, t, m) =>
wper = t * 2 - 1
avrng = ta.ema(math.abs(x - x ), t)
smoothrng = ta.ema(avrng, wper) * m
smoothrng
smrng = smoothrng(close, 22, 6)
rngfilt(x, r) =>
rngfilt = x
rngfilt := x > nz(rngfilt ) ? x - r < nz(rngfilt ) ? nz(rngfilt ) : x - r : x + r > nz(rngfilt ) ? nz(rngfilt ) : x + r
rngfilt
filt = rngfilt(close, smrng)
// ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
upward = 0.0
upward := filt > filt ? nz(upward ) + 1 : filt < filt ? 0 : nz(upward )
downward = 0.0
downward := filt < filt ? nz(downward ) + 1 : filt > filt ? 0 : nz(downward )
filtcolor = upward > 0 ? color.new(#00e2ff, 50) : downward > 0 ? color.new(#fe0100, 50) : color.new(#56328f, 0)
plot(TrendFollower ? filt : na, color=filtcolor, linewidth=1, title='Trend Tracer')
// Trend Cloud
tclength = 600
hullma = ta.wma(2*ta.wma(close, tclength/2)-ta.wma(close, tclength), math.floor(math.sqrt(tclength)))
plot(LongTrendAverage ? hullma : na, 'Trend Cloud', linewidth=4, color=close > hullma ? color.new(#00e2ff, 65) : color.new(#fe0100, 65))
// Comulus Cloud
candle = ta.alma(source, windowsize2, offset2, sigma2)
reach = ta.alma(source, windowsize, offset, sigma)
candlep = plot(ShowComulus ? candle : na, color=color.new(color.white, 100))
reachp = plot(ShowComulus ? reach : na, color=color.new(color.white, 100))
fill(reachp, candlep, color= candle > reach ? color.new(#fe0100, 85) : color.new(#00e2ff, 85))
// Chart Features
x1 = 22
x2 = 9
x3 = 15
x4 = 5
smoothrngX1(x, t, m) =>
wper = t * 2 - 1
avrng = ta.ema(math.abs(x - x ), t)
smoothrngX1 = ta.ema(avrng, wper) * m
smoothrngX1
smrngx1x = smoothrngX1(close, x1, x2)
smrngx1x2 = smoothrngX1(close, x3, x4)
rngfiltx1x1(x, r) =>
rngfiltx1x1 = x
rngfiltx1x1 := x > nz(rngfiltx1x1 ) ? x - r < nz(rngfiltx1x1 ) ? nz(rngfiltx1x1 ) : x - r : x + r > nz(rngfiltx1x1 ) ? nz(rngfiltx1x1 ) : x + r
rngfiltx1x1
filtx1 = rngfiltx1x1(close, smrngx1x)
filtx12 = rngfiltx1x1(close, smrngx1x2)
// ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
upwardx1 = 0.0
upwardx1 := filtx1 > filtx1 ? nz(upwardx1 ) + 1 : filtx1 < filtx1 ? 0 : nz(upwardx1 )
downwardx1 = 0.0
downwardx1 := filtx1 < filtx1 ? nz(downwardx1 ) + 1 : filtx1 > filtx1 ? 0 : nz(downwardx1 )
filtx1colorx1 = color.rgb(0, 187, 212, 100)
xxx1 = plot(CirrusCloud ? filtx1 : na, color=filtx1colorx1, linewidth=1, title='Trend Tracer', editable = false)
xxx2 = plot(CirrusCloud ? filtx12 : na, color=filtx1colorx1, linewidth=1, title='Trend Tracer', editable = false)
fill(xxx1, xxx2, color= filtx1 > filtx12 ? color.new(#fd0205, 65) : color.new(#0395fc, 65))
buy = bull and nbuysell and smartsignalsonly == false ? label.new(bar_index, y1, close > ema200con ? "Smart Buy" : "Buy", xloc.bar_index, yloc.price, #0395fc, label.style_label_up, color.white, size.normal) : na
sell = bear and nbuysell and smartsignalsonly == false ? label.new(bar_index, y2, close < ema200con ? "Smart Sell" : "Sell", xloc.bar_index, yloc.price, #fd0205, label.style_label_down, color.white, size.normal) : na
SmartBuy = bull and nbuysell and close > ema200con and smartsignalsonly == true ? label.new(bar_index, y1, close > ema200con ? "Smart Buy" : "Buy", xloc.bar_index, yloc.price, #0395fc, label.style_label_up, color.white, size.normal) : na
SmartSell = bear and nbuysell and close < ema200con and smartsignalsonly == true ? label.new(bar_index, y2, close < ema200con ? "Smart Sell" : "Sell", xloc.bar_index, yloc.price, #fd0205, label.style_label_down, color.white, size.normal) : na
// Other initializations
avg_volume = ta.sma(volume, 20)
very_weak_multiplier = 0.5
weak_multiplier = 1
strong_multiplier = 1.5
// Rejection handling
var int demandRejections = array.new_int(history_of_demand_to_keep, 0)
var int supplyRejections = array.new_int(history_of_demand_to_keep, 0)
var int demandCreationBars = array.new_int(history_of_demand_to_keep, na)
var int supplyCreationBars = array.new_int(history_of_demand_to_keep, na)
var box current_demand_box = array.new_box(history_of_demand_to_keep, na)
var box current_supply_box = array.new_box(history_of_demand_to_keep, na)
f_check_demand_rejections() =>
for i = 0 to history_of_demand_to_keep - 1
if not na(array.get(demandCreationBars, i))
if bar_index - array.get(demandCreationBars, i) > 15 and bar_index - array.get(demandCreationBars, i) % 15 == 0
label.new(bar_index, high, "Checking demand rejection", color=#fd0205)
dBox = array.get(current_demand_box, i)
if (na(dBox))
continue
withinBox = (high >= box.get_bottom(dBox) and high <= box.get_top(dBox)) or (close >= box.get_bottom(dBox) and close <= box.get_top(dBox))
bearishCandlesCount = math.sum(close < open ? 1 : 0, 15)
if withinBox and bearishCandlesCount >= 7
label.new(bar_index, low, "Bearish count > 7", color=#0395fc)
array.set(demandRejections, i, array.get(demandRejections, i) + 1)
f_check_supply_rejections() =>
for i = 0 to history_of_demand_to_keep - 1
if not na(array.get(supplyCreationBars, i))
if bar_index - array.get(supplyCreationBars, i) > 15 and bar_index - array.get(supplyCreationBars, i) % 15 == 0
label.new(bar_index, low, "Checking supply rejection", color=#fd0205)
sBox = array.get(current_supply_box, i)
if (na(sBox))
continue
withinBox = (low <= box.get_top(sBox) and low >= box.get_bottom(sBox)) or (close <= box.get_top(sBox) and close >= box.get_bottom(sBox))
bullishCandlesCount = math.sum(close > open ? 1 : 0, 15)
if withinBox and bullishCandlesCount >= 7
label.new(bar_index, high, "Bullish count > 7", color=#0395fc)
array.set(supplyRejections, i, array.get(supplyRejections, i) + 1)
f_array_add_pop(array, new_value_to_add) =>
array.unshift(array, new_value_to_add)
array.pop(array)
f_sh_sl_labels(array, swing_type) =>
var string label_text = na
if swing_type == 1
if array.get(array, 0) >= array.get(array, 1)
label_text := 'HH'
else
label_text := 'LH'
label.new(bar_index - swing_length, array.get(array,0), text = label_text, style=label.style_label_down, textcolor = color.white, color = color.new(color.white, 100), size = size.tiny)
else if swing_type == -1
if array.get(array, 0) >= array.get(array, 1)
label_text := 'HL'
else
label_text := 'LL'
label.new(bar_index - swing_length, array.get(array,0), text = label_text, style=label.style_label_up, textcolor = color.white, color = color.new(color.white, 100), size = size.tiny)
f_check_overlapping(new_poi, box_array, atr) =>
atr_threshold = atr * 2
okay_to_draw = true
for i = 0 to array.size(box_array) - 1
top = box.get_top(array.get(box_array, i))
bottom = box.get_bottom(array.get(box_array, i))
poi = (top + bottom) / 2
upper_boundary = poi + atr_threshold
lower_boundary = poi - atr_threshold
if new_poi >= lower_boundary and new_poi <= upper_boundary
okay_to_draw := false
break
else
okay_to_draw := true
okay_to_draw
f_supply_demand(value_array, bn_array, box_array, label_array, box_type, atr) =>
atr_buffer = atr * (box_width / 10)
box_left = array.get(bn_array, 0)
box_right = bar_index + 20
var float box_top = 0.00
var float box_bottom = 0.00
var float poi = 0.00
if box_type == 1
box_top := array.get(value_array, 0)
box_bottom := box_top - atr_buffer
poi := (box_top + box_bottom) / 2
else if box_type == -1
box_bottom := array.get(value_array, 0)
box_top := box_bottom + atr_buffer
poi := (box_top + box_bottom) / 2
okay_to_draw = f_check_overlapping(poi, box_array, atr)
swing_volume = volume
var string strength_text = ""
highest_volume_last_20 = ta.highest(volume, 20)
volume_percentage = math.round(swing_volume / highest_volume_last_20 * 100)
volume_percentage := math.min(volume_percentage, 100) // Cap the volume percentage to 100
var extend_option = extend.right
if box_extend_option == "Right"
extend_option := extend.right
else if box_extend_option == "Both"
extend_option := extend.both
if box_type == 1 and okay_to_draw and s1
box.delete( array.get(box_array, array.size(box_array) - 5) )
f_array_add_pop(box_array, box.new( left = box_left, top = box_top, right = box_right, bottom = box_bottom, border_color = #fd020580, border_width=1,
bgcolor = supply_color, extend = extend_option, text = strength_text, text_halign = text.align_right, text_valign = text.align_center, text_color = color.white, text_size = size.small, xloc = xloc.bar_index))
box.delete( array.get(label_array, array.size(label_array) - 5) )
f_array_add_pop(label_array, box.new( left = box_left, top = poi, right = box_right, bottom = poi, border_color = #fd020580, border_width=1, border_style=line.style_dotted,
bgcolor = color.new(color.black,100), extend = extend_option, text = '', text_halign = text.align_left, text_valign = text.align_center, text_color = color.white, text_size = size.small, xloc = xloc.bar_index))
else if box_type == -1 and okay_to_draw and s1
box.delete( array.get(box_array, array.size(box_array) - 5) )
f_array_add_pop(box_array, box.new( left = box_left, top = box_top, right = box_right, bottom = box_bottom, border_color = #0395fc80, border_width=1,
bgcolor = demand_color, extend = extend_option, text = strength_text, text_halign = text.align_right, text_valign = text.align_center, text_color = color.white, text_size = size.small, xloc = xloc.bar_index))
box.delete( array.get(label_array, array.size(label_array) - 5) )
f_array_add_pop(label_array, box.new( left = box_left, top = poi, right = box_right, bottom = poi, border_color = #0395fc80, border_width=1, border_style=line.style_dotted,
bgcolor = color.new(color.black,100), extend = extend_option, text = '', text_halign = text.align_left, text_valign = text.align_center, text_color = color.white, text_size = size.small, xloc = xloc.bar_index))
f_sd_to_bos(box_array, bos_array, label_array, zone_type) =>
if zone_type == 1
for i = 0 to array.size(box_array) - 1
level_to_break = box.get_top(array.get(box_array,i))
if close >= level_to_break
box.delete(array.get(box_array, i))
box.delete(array.get(label_array, i))
if zone_type == -1
for i = 0 to array.size(box_array) - 1
level_to_break = box.get_bottom(array.get(box_array,i))
if close <= level_to_break
box.delete(array.get(box_array, i))
box.delete(array.get(label_array, i))
f_extend_box_endpoint(box_array) =>
for i = 0 to array.size(box_array) - 1
box.set_right(array.get(box_array, i), bar_index + 30) // Extend only 20 bars
atr567 = ta.atr(50)
swing_high = ta.pivothigh(high, swing_length, swing_length)
swing_low = ta.pivotlow(low, swing_length, swing_length)
var swing_high_values = array.new_float(5,0.00)
var swing_low_values = array.new_float(5,0.00)
var swing_high_bns = array.new_int(5,0)
var swing_low_bns = array.new_int(5,0)
var current_supply_poi = array.new_box(history_of_demand_to_keep, na)
var current_demand_poi = array.new_box(history_of_demand_to_keep, na)
var supply_bos = array.new_box(5, na)
var demand_bos = array.new_box(5, na)
if not na(swing_high)
f_array_add_pop(swing_high_values, swing_high)
f_array_add_pop(swing_high_bns, bar_index )
if show_price_action_labels
f_sh_sl_labels(swing_high_values, 1)
f_supply_demand(swing_high_values, swing_high_bns, current_supply_box, current_supply_poi, 1, atr567)
else if not na(swing_low)
f_array_add_pop(swing_low_values, swing_low)
f_array_add_pop(swing_low_bns, bar_index )
if show_price_action_labels
f_sh_sl_labels(swing_low_values, -1)
f_supply_demand(swing_low_values, swing_low_bns, current_demand_box, current_demand_poi, -1, atr567)
f_sd_to_bos(current_supply_box, supply_bos, current_supply_poi, 1)
f_sd_to_bos(current_demand_box, demand_bos, current_demand_poi, -1)
f_extend_box_endpoint(current_supply_box)
f_extend_box_endpoint(current_demand_box)
// Inside the main execution, after the box is drawn, check for rejections
if not na(swing_low)
f_array_add_pop(swing_low_values, swing_low)
f_array_add_pop(swing_low_bns, bar_index )
if show_price_action_labels
f_sh_sl_labels(swing_low_values, -1)
f_supply_demand(swing_low_values, swing_low_bns, current_demand_box, current_demand_poi, -1, atr567)
f_check_demand_rejections()
if not na(swing_high)
f_array_add_pop(swing_high_values, swing_high)
f_array_add_pop(swing_high_bns, bar_index )
if show_price_action_labels
f_sh_sl_labels(swing_high_values, 1)
f_supply_demand(swing_high_values, swing_high_bns, current_supply_box, current_supply_poi, 1, atr567)
f_check_supply_rejections()
trigger2 = bull ? 1 : 0
countBull = ta.barssince(bull)
countBear = ta.barssince(bear)
trigger = nz(countBull, bar_index) < nz(countBear, bar_index) ? 1 : 0
atrBand = ta.atr(atrLen) * atrRisk
atrStop = trigger == 1 ? low - atrBand : high + atrBand
currentposition = countBull > countBear ? 'Sell' : 'Buy'
lastTrade(close) => ta.valuewhen(bull or bear , close, 0)
entry = levels ? label.new(time, close, "ENTRY " + str.tostring(lastTrade(close), decimals), xloc.bar_time, yloc.price, color.orange, label.style_label_left, color.white, size.normal) : na
label.set_x(entry, label.get_x(entry) + math.round(ta.change(time) * lvlDistance))
label.set_y(entry, lastTrade(close))
label.delete(entry )
stop_y = lastTrade(atrStop)
stop = levels ? label.new(time, close, "SL " + str.tostring(stop_y, decimals), xloc.bar_time, yloc.price, red2, label.style_label_left, color.white, size.normal) : na
label.set_x(stop, label.get_x(stop) + math.round(ta.change(time) * lvlDistance))
label.set_y(stop, stop_y)
label.delete(stop )
tp1Rl_y = (lastTrade(close)-lastTrade(atrStop))*1 + lastTrade(close)
tp1Rl = levels ? label.new(time, close, "1:1 TP " + str.tostring(tp1Rl_y, decimals), xloc.bar_time, yloc.price, green2, label.style_label_left, color.white, size.normal ) : na
label.set_x(tp1Rl, label.get_x(tp1Rl) + math.round(ta.change(time) * lvlDistance))
label.set_y(tp1Rl, tp1Rl_y)
label.delete(tp1Rl )
tp2RL_y = (lastTrade(close)-lastTrade(atrStop))*2 + lastTrade(close)
tp2RL = levels ? label.new(time, close, "2:1 TP " + str.tostring(tp2RL_y, decimals), xloc.bar_time, yloc.price, green2, label.style_label_left, color.white, size.normal) : na
label.set_x(tp2RL, label.get_x(tp2RL) + math.round(ta.change(time) * lvlDistance))
label.set_y(tp2RL, tp2RL_y)
label.delete(tp2RL )
tp3RL_y = (lastTrade(close)-lastTrade(atrStop))*3 + lastTrade(close)
tp3RL = levels ? label.new(time, close, "3:1 TP " + str.tostring(tp3RL_y, decimals), xloc.bar_time, yloc.price, green2, label.style_label_left, color.white, size.normal) : na
label.set_x(tp3RL, label.get_x(tp3RL) + math.round(ta.change(time) * lvlDistance))
label.set_y(tp3RL, tp3RL_y)
label.delete(tp3RL )
style = linesStyle == "SOLID" ? line.style_solid : linesStyle == "DASHED" ? line.style_dashed : line.style_dotted
lineEntry = levels and lvlLines ? line.new(bar_index - (trigger == 0 ? countBull : countBear), lastTrade(close), bar_index + lvlDistance, lastTrade(close), xloc.bar_index, extend.none, color.orange, style, 2) : na, line.delete(lineEntry )
lineStop = levels and lvlLines ? line.new(bar_index - (trigger == 0 ? countBull : countBear), stop_y, bar_index + lvlDistance, stop_y, xloc.bar_index, extend.none, #fe0100, style, 2) : na, line.delete(lineStop )
lineTp1Rl = levels and lvlLines ? line.new(bar_index - (trigger == 0 ? countBull : countBear), tp1Rl_y, bar_index + lvlDistance, tp1Rl_y, xloc.bar_index, extend.none, green2, style, 2) : na, line.delete(lineTp1Rl )
lineTp2RL = levels and lvlLines ? line.new(bar_index - (trigger == 0 ? countBull : countBear), tp2RL_y, bar_index + lvlDistance, tp2RL_y, xloc.bar_index, extend.none, green2, style, 2) : na, line.delete(lineTp2RL )
lineTp3RL = levels and lvlLines ? line.new(bar_index - (trigger == 0 ? countBull : countBear), tp3RL_y, bar_index + lvlDistance, tp3RL_y, xloc.bar_index, extend.none, green2, style, 2) : na, line.delete(lineTp3RL )
alertcondition(bull, title='Buy Signal', message = "BUY")
alertcondition(bear, title='Buy Signal', message = "BUY")
//import protradingart/pta_plot/6 as pp
//pp.peakprofit(bull, bear)
//
////////////////////////////////////////////////////////////////////////////////////////////////
// Functions
// Functions
f_chartTfInMinutes() =>
float _resInMinutes = timeframe.multiplier * (
timeframe.isseconds ? 1. / 60 :
timeframe.isminutes ? 1. :
timeframe.isdaily ? 60. * 24 :
timeframe.isweekly ? 60. * 24 * 7 :
timeframe.ismonthly ? 60. * 24 * 30.4375 : na)
// Get components
vosc = ta.obv - ta.ema(ta.obv, 20)
bs = ta.ema(nz(math.abs((open - close) / (high - low) * 100)), 3)
ema = ta.ema(close, 200)
emaBull = close > ema
equal_tf(res) => str.tonumber(res) == f_chartTfInMinutes()
higher_tf(res) => str.tonumber(res) > f_chartTfInMinutes()
too_small_tf(res) => (timeframe.isweekly and res=="1") or (timeframe.ismonthly and str.tonumber(res) < 10)
securityNoRep(sym, res, src) =>
bool bull = na
bull := equal_tf(res) ? src : bull
bull := higher_tf(res) ? request.security(sym, res, src, barmerge.gaps_off, barmerge.lookahead_on) : bull
bull_array = request.security_lower_tf(syminfo.tickerid, higher_tf(res) ? str.tostring(f_chartTfInMinutes()) : too_small_tf(res) ? (timeframe.isweekly ? "3" : "10") : res, src)
if array.size(bull_array) > 1 and not equal_tf(res) and not higher_tf(res)
bull := array.pop(bull_array)
array.clear(bull_array)
bull
TF1Bull = securityNoRep(syminfo.tickerid, "1" , emaBull)
//TF3Bull = securityNoRep(syminfo.tickerid, "3" , emaBull)
TF5Bull = securityNoRep(syminfo.tickerid, "5" , emaBull)
//TF10Bull = securityNoRep(syminfo.tickerid, "10" , emaBull)
TF15Bull = securityNoRep(syminfo.tickerid, "15" , emaBull)
TF30Bull = securityNoRep(syminfo.tickerid, "30" , emaBull)
TF60Bull = securityNoRep(syminfo.tickerid, "60" , emaBull)
//TF120Bull = securityNoRep(syminfo.tickerid, "120" , emaBull)
TF240Bull = securityNoRep(syminfo.tickerid, "240" , emaBull)
//TF720Bull = securityNoRep(syminfo.tickerid, "720" , emaBull)
TFDBull = securityNoRep(syminfo.tickerid, "1440", emaBull)
indicatorTF = "Chart"
// Functions
sqz(bbLen, bbMult, kcLen, kcMult, source) =>
upperBB = ta.sma(source, bbLen) + ta.stdev(source, bbLen) * bbMult
lowerBB = ta.sma(source, bbLen) - ta.stdev(source, bbLen) * bbMult
upperKC = ta.sma(source, kcLen) + ta.sma(ta.tr, kcLen) * kcMult
lowerKC = ta.sma(source, kcLen) - ta.sma(ta.tr, kcLen) * kcMult
sqzOn = lowerBB > lowerKC and upperBB < upperKC
sqzOff = lowerBB < lowerKC and upperBB > upperKC
qqe(rsiLen, rsiSmooth, factor, source, bbLen, bbMult) =>
rsiMa = ta.ema(ta.rsi(source, rsiLen), rsiSmooth)
delta = ta.ema(ta.ema(math.abs(ta.mom(rsiMa, 1)), rsiLen * 2 - 1), rsiLen * 2 - 1) * factor
longBand = 0.0, longBand := rsiMa > longBand and rsiMa > longBand ? math.max(longBand , rsiMa - delta) : rsiMa - delta
shortBand = 0.0, shortBand := rsiMa < shortBand and rsiMa < shortBand ? math.min(shortBand , rsiMa + delta) : rsiMa + delta
cross1 = ta.cross(rsiMa, shortBand )
cross2 = ta.cross(rsiMa, longBand )
trend = 0.0, trend := cross1 ? 1 : cross2 ? -1 : nz(trend , 1)
fastDelta = trend == 1 ? longBand : shortBand
_hist = rsiMa - 50
_line = fastDelta - 50
= ta.bb(_line, bbLen, bbMult)
// Get components
cond(_offset) =>
top = ta.highest(high, 10)
bot = ta.lowest(low, 10)
osc = ta.ema(hlc3, 5) - ta.ema(ohlc4, 20)
oscRis = osc > osc
oscFal = osc < osc
oscA0 = osc > 0
oscB0 = osc < 0
oscTop = oscFal and oscRis
oscBot = oscRis and oscFal
bullR = oscB0 and oscBot and ((osc > ta.valuewhen(oscB0 and oscBot, osc, 1) and bot < ta.valuewhen(oscB0 and oscBot, bot, 1)))
bearR = oscA0 and oscTop and ((osc < ta.valuewhen(oscA0 and oscTop, osc, 1) and top > ta.valuewhen(oscA0 and oscTop, top, 1)))
bullH = oscB0 and oscBot and ((osc < ta.valuewhen(oscB0 and oscBot, osc, 1) and bot > ta.valuewhen(oscB0 and oscBot, bot, 1)))
bearH = oscA0 and oscTop and ((osc > ta.valuewhen(oscA0 and oscTop, osc, 1) and top < ta.valuewhen(oscA0 and oscTop, top, 1)))
= sqz(20, 2, 20, 2, close)
= qqe(6, 6, 3, close, 50, 0.001)
= qqe(6, 5, 1.618, close, 50, 1)
= ta.dmi(14, 14)
[osc , oscRis , oscFal , oscA0 , oscB0 , oscTop , oscBot , bullR , bearR , bullH , bearH , sqzOn , sqzOff , _hist1 , upper1 , lower1 , _hist2 , _line2 , tvr ]
tf = indicatorTF == "Chart" ? timeframe.period : indicatorTF == "1 minute" ? "1" : indicatorTF == "3 minutes" ? "3" : indicatorTF == "5 minutes" ? "5" : indicatorTF == "10 minutes" ? "10" : indicatorTF == "15 minutes" ? "15" : indicatorTF == "30 minutes" ? "30" : indicatorTF == "45 minutes" ? "45" : indicatorTF == "1 hour" ? "60" : indicatorTF == "2 hours" ? "120" : indicatorTF == "3 hours" ? "180" : indicatorTF == "4 hours" ? "240" : indicatorTF == "12 hours" ? "720" : indicatorTF == "1 day" ? "1D" : indicatorTF == "1 week" ? "1W" : indicatorTF == "1 month" ? "1M" : na
= request.security(syminfo.tickerid, tf, cond(indicatorTF != "Chart" and barstate.isrealtime ? 1 : 0))
//colorTVR = tvr < 15 ? #F6525F : tvr > 15 and tvr < 25 ? #B2B5BE : #66BB6A
// Plots
//plot(Presets == "Money Moves TrendVR" ? tvr : na, "", colorTVR, editable=false)
TrendText = "Trending"
if tvr < 15 and tvr < 25
TrendText := "No trend"
if tvr > 15 and tvr < 25
TrendText := "Ranging"
//------------------------------------------------------------------------------------------------------- Volatitiry
//Calculates Volatility for Dashboard
atrr = 3 * ta.atr(10)
stdAtr = 2 * ta.stdev(atrr, 20)
smaAtr = ta.sma(atrr, 20)
topAtrDev = smaAtr + stdAtr
bottomAtrDev = smaAtr - stdAtr
calcDev = (atrr - bottomAtrDev) / (topAtrDev - bottomAtrDev)
percentVol = 40 * calcDev + 30
AvrLength = 21
PercentFilter = 144
xAavrVolume = ta.rma(volume, AvrLength)
nResLess = volume * 100 / xAavrVolume < PercentFilter ? 0 : volume
nRes = nResLess
clr = close < open ? #b2b5be : #00dbff
//plot(nRes, color=clr, style=plot.style_columns, title='Volume Filter', transp=20)
VolitiText = "Inactive"
if nRes
VolitiText := "Active"
//////////////////////////////////////////
ema69 = ta.ema(close, 9)
totalSentTxt = ema69 > ema69 ? 'Bullish' : ema69 < ema69 ? 'Bearish' : 'Flat'
// INputs
//Timezones
tz_incr = 0
use_exchange = false
//------------------------------------------------------------------------------
//Settings
//-----------------------------------------------------------------------------{
//Session A
NYSes = true
NYTxt = 'New York'
NYTime = '1300-2200'
//Session B
LDSes = true
sesb_txt = 'London'
sesb_ses = '0700-1600'
//Session C
show_sesc = true
sesc_txt = 'Tokyo'
sesc_ses = '0000-0900'
//Session D
show_sesd = true
sesd_txt = 'Sydney'
sesd_ses = '2100-0600'
//-----------------------------------------------------------------------------}
//Sessions
//-----------------------------------------------------------------------------{
tff = timeframe.period
var tz = use_exchange ? syminfo.timezone :
str.format('UTC{0}{1}', tz_incr >= 0 ? '+' : '-', math.abs(tz_incr))
is_sesa = math.sign(nz(time(tff, NYTime, tz)))
is_sesb = math.sign(nz(time(tff, sesb_ses, tz)))
is_sesc = math.sign(nz(time(tff, sesc_ses, tz)))
is_sesd = math.sign(nz(time(tff, sesd_ses, tz)))
////////////////////////////////////////////
SessionText = "Default"
if is_sesd
SessionText := sesd_txt
if is_sesc
SessionText := sesc_txt
if is_sesb
SessionText := sesb_txt
if is_sesa
SessionText := NYTxt
if is_sesd and is_sesc
SessionText := "Sydney/Tokyo"
if is_sesb and is_sesc
SessionText := "Tokyo/London"
if is_sesb and is_sesa
SessionText := "London/Newyork"
if is_sesa and is_sesd
SessionText := "Newyork/Sydney"
//-----------------------------------------------------------------------------}
//Overlays color.green : color.red
//
var dashboard_loc = locationDashboard == "Top Right" ? position.top_right : locationDashboard == "Middle Right" ? position.middle_right : locationDashboard == "Bottom Right" ? position.bottom_right : locationDashboard == "Top Center" ? position.top_center : locationDashboard == "Middle Center" ? position.middle_center : locationDashboard == "Bottom Center" ? position.bottom_center : locationDashboard == "Top Left" ? position.top_left : locationDashboard == "Middle Left" ? position.middle_left : position.bottom_left
var dashboard_size = sizeDashboard == "Large" ? size.large : sizeDashboard == "Normal" ? size.normal : sizeDashboard == "Small" ? size.small : size.tiny
var dashboard = showDashboard ? table.new(dashboard_loc, 3, 8, color.rgb(30, 34, 45 , 60), #3d384300, 2, color.rgb(30, 34, 45 , 60), 1) : na
dashboard_cell(column, row, txt, signal=false) => table.cell(dashboard, column, row, txt, 0, 0, signal ? #000000 : color.white, text_size=dashboard_size)
dashboard_cell_bg(column, row, col) => table.cell_set_bgcolor(dashboard, column, row, col)
if barstate.islast and showDashboard
// MTF Trend
dashboard_cell(0, 0 , "MTF")
dashboard_cell(0, 1 , "M1") , dashboard_cell_bg(0, 1 , TF1Bull ? #0395fc : #fd0205)
dashboard_cell(0, 2 , "M5") , dashboard_cell_bg(0, 2 , TF5Bull ? #0395fc : #fd0205)
dashboard_cell(0, 3 , "M15") , dashboard_cell_bg(0, 3 , TF15Bull ? #0395fc : #fd0205)
dashboard_cell(0, 4 , "M30") , dashboard_cell_bg(0, 4 , TF30Bull ? #0395fc : #fd0205)
dashboard_cell(0, 5 , "1H") , dashboard_cell_bg(0, 5 , TF60Bull ? #0395fc : #fd0205)
dashboard_cell(0, 6 , "4H") , dashboard_cell_bg(0, 6 , TF240Bull ? #0395fc : #fd0205)
dashboard_cell(0, 7 , "D1") , dashboard_cell_bg(0, 7 , TFDBull ? #0395fc : #fd0205)
// Middel part
dashboard_cell(1, 0 , "💎 Diamond Algo 💎")
dashboard_cell(1, 1 , "👉 Current Position ")
dashboard_cell(1, 2 , "🔎 Current Sensitivity ")
dashboard_cell(1, 3 , "🔥 Market State ")
dashboard_cell(1, 4 , "⚠️ Volatility ")
dashboard_cell(1, 5 , "🏦 Institutional Activity ")
dashboard_cell(1, 6 , "🕒 Current Session (UTC) ")
dashboard_cell(1, 7 , "🌊 Trend Pressure ")
// End part
dashboard_cell(2, 0 , "AlgoPoint")
dashboard_cell(2, 1 , str.tostring(currentposition))
dashboard_cell(2, 2 , str.tostring(nsensitivity))
dashboard_cell(2, 3 , TrendText)
dashboard_cell(2, 4 , str.tostring(percentVol, '##.##') + '%')
dashboard_cell(2, 5 , VolitiText)
dashboard_cell(2, 6 , SessionText)
dashboard_cell(2, 7 , totalSentTxt)
// Other Features
// inputs //
//{
trailType = 'modified'
ATRPeriod = 14
ATRFactor = 6
smoothing = 8
norm_o = request.security(ticker.new(syminfo.prefix, syminfo.ticker), timeframe.period, open)
norm_h = request.security(ticker.new(syminfo.prefix, syminfo.ticker), timeframe.period, high)
norm_l = request.security(ticker.new(syminfo.prefix, syminfo.ticker), timeframe.period, low)
norm_c = request.security(ticker.new(syminfo.prefix, syminfo.ticker), timeframe.period, close)
//}
//////// FUNCTIONS //////////////
//{
// Wilders ma //
Wild_ma(_src, _malength) =>
_wild = 0.0
_wild := nz(_wild ) + (_src - nz(_wild )) / _malength
_wild
/////////// TRUE RANGE CALCULATIONS /////////////////
HiLo = math.min(norm_h - norm_l, 1.5 * nz(ta.sma(norm_h - norm_l, ATRPeriod)))
HRef = norm_l <= norm_h ? norm_h - norm_c : norm_h - norm_c - 0.5 * (norm_l - norm_h )
LRef = norm_h >= norm_l ? norm_c - norm_l : norm_c - norm_l - 0.5 * (norm_l - norm_h)
trueRange = trailType == 'modified' ? math.max(HiLo, HRef, LRef) : math.max(norm_h - norm_l, math.abs(norm_h - norm_c ), math.abs(norm_l - norm_c ))
//}
/////////// TRADE LOGIC ////////////////////////
//{
loss = ATRFactor * Wild_ma(trueRange, ATRPeriod)
Up = norm_c - loss
Dn = norm_c + loss
TrendUp = Up
TrendDown = Dn
Trend = 1
TrendUp := norm_c > TrendUp ? math.max(Up, TrendUp ) : Up
TrendDown := norm_c < TrendDown ? math.min(Dn, TrendDown ) : Dn
Trend := norm_c > TrendDown ? 1 : norm_c < TrendUp ? -1 : nz(Trend , 1)
trail = Trend == 1 ? TrendUp : TrendDown
ex = 0.0
ex := ta.crossover(Trend, 0) ? norm_h : ta.crossunder(Trend, 0) ? norm_l : Trend == 1 ? math.max(ex , norm_h) : Trend == -1 ? math.min(ex , norm_l) : ex
//}
// //////// PLOT TP and SL /////////////
////// FIBONACCI LEVELS ///////////
//{
state = Trend == 1 ? 'long' : 'short'
fib1Level = 61.8
fib2Level = 78.6
fib3Level = 88.6
f1 = ex + (trail - ex) * fib1Level / 100
f2 = ex + (trail - ex) * fib2Level / 100
f3 = ex + (trail - ex) * fib3Level / 100
l100 = trail + 0
fill(plot(ShowSmartTrail ? (ta.sma(trail, smoothing)) : na, 'Trailingstop', style=plot.style_line, color=Trend == 1 ? color.new(#2157f9, 0) : Trend == -1 ? color.new(#ff1100, 0) : na),
plot( ShowSmartTrail ? (ta.sma(f2, smoothing)) : na, 'Fib 2', style=plot.style_line, display=display.none),
color=state == 'long' ? color.new(#2157f9, 80) : state == 'short' ? color.new(#ff1100, 80) : na)
//}
// Trend Lines
shortPeriod = 30
longPeriod = 100
if barstate.islast
float lowest_y2 = 60000
float lowest_x2 = 0
float highest_y2 = 0
float highest_x2 = 0
for i = 1 to shortPeriod by 1
if low < lowest_y2
lowest_y2 := low
lowest_x2 := i
lowest_x2
if high > highest_y2
highest_y2 := high
highest_x2 := i
highest_x2
float lowest_y1 = 60000
float lowest_x1 = 0
float highest_y1 = 0
float highest_x1 = 0
for j = shortPeriod + 1 to longPeriod by 1
if low < lowest_y1
lowest_y1 := low
lowest_x1 := j
lowest_x1
if high > highest_y1
highest_y1 := high
highest_x1 := j
highest_x1
sup = Showtrendlines == true ? line.new(x1=bar_index , y1=lowest_y1, x2=bar_index , y2=lowest_y2, extend=extend.right, width=2, color=#0598ff) : na
res = Showtrendlines == true ? line.new(x1=bar_index , y1=highest_y1, x2=bar_index , y2=highest_y2, extend=extend.right, width=2, color=#fe0101) : na
line.delete(sup )
line.delete(res )
if ta.crossunder(close, line.get_price(sup, bar_index ))
alert('break down trendline', freq=alert.freq_once_per_bar_close)
if ta.crossover(close, line.get_price(res, bar_index ))
alert('break upper trendline', freq=alert.freq_once_per_bar_close)
// Alerts
buyalert = input(true, "Buy Alert", group = 'Alerts')
sellalert = input(true, "Sell Alert", group = 'Alerts')
if bull and buyalert
alert("Buy Alert",alert.freq_once_per_bar_close)
if bear and sellalert
alert("Sell Alert",alert.freq_once_per_bar_close)
DECODE Global Liquidity IndexDECODE Global Liquidity Index 🌊
The DECODE Global Liquidity Index is a powerful tool designed to track and aggregate global liquidity by combining data from the world's 13 largest economies. It offers a comprehensive view of financial liquidity, providing crucial insights into the underlying currents that can influence asset prices and market trends.
The economies covered are: United States, China, European Union, Japan, India, United Kingdom, Brazil, Canada, Russia, South Korea, Australia, Mexico, and Indonesia. The European Union accounts for major individual economies within the EU like Germany, France, Italy, Spain, Netherlands, Poland, etc.
Key Features:
1. Customizable Liquidity Sources
Include Global M2: You can opt to include the M2 money supply from the 13 listed economies. M2 is a broad measure of money supply that includes cash, checking deposits, savings deposits, money market securities, mutual funds, and other time deposits. (Note: Australia uses M3 as its primary measure, which is included when M2 is selected for Australia).
Include Central Bank Balance Sheets (CBBS): Alternatively, or in addition, you can include the total assets held by the central banks of these economies. Central bank balance sheets expand or contract based on monetary policy operations like quantitative easing (QE) or tightening (QT).
Combined View: If you select both M2 and CBBS, and data is available for both, the indicator will display an average of the two aggregated values. If only one source type is selected, or if data for one type is unavailable despite both being selected, the indicator will display the single available and selected component. This provides flexibility in how you define and analyze global liquidity.
2. Lead/Lag Analysis (Forward Projection):
Lead Offset (Days): This feature allows you to project the liquidity index forward by a specified number of days.
Why it's useful: Global liquidity changes can often be a leading indicator for various asset classes, particularly those sensitive to risk appetite, like Bitcoin or growth stocks. These assets might lag shifts in liquidity. By applying a lead (e.g., 90 days), you can shift the liquidity data forward on your chart to more easily visualize potential correlations and identify if current asset price movements might be responding to past changes in liquidity.
3. Rate of Change (RoC) Oscillator:
Year-over-Year % View: Instead of viewing aggregate liquidity, you can switch to a Year-over-Year (YoY%) Rate of Change (ROC) oscillator.
Why it's useful:
Momentum Identification: The ROC highlights the speed and direction of liquidity changes. Positive values indicate liquidity is increasing compared to a year ago, while negative values show it's decreasing.
Turning Points: Oscillators make it easier to spot potential accelerations, decelerations, or reversals in liquidity trends. A cross above the zero line can signal strengthening liquidity momentum, while a cross below can signal weakening momentum.
Cycle Analysis: It helps in assessing the cyclical nature of liquidity provision and its potential impact on market cycles.
This indicator aims to provide a clear, customizable, and insightful measure of global liquidity to aid traders and investors in their market analysis.
DanFX - Smart Money Conceptssupport and resistance zones with volume. also detects liquidity sweep, ChoCH and BoS great for support and resistance traders
Fuerza de tendencia / Trend StrengthTrend Strength Indicator – Multimetric Scanner
This indicator evaluates the strength of a bullish trend using 11 widely trusted technical signals. It aggregates price behavior, moving averages, RSI momentum, and Ichimoku Cloud position into a single table with intuitive checkmarks.
Included conditions:
Higher highs and higher lows
RSI trending up
Price above EMA21, SMA50, and SMA200
EMA21 above SMA50 and SMA200
SMA50 above SMA200
Price above the Ichimoku Cloud
Each fulfilled condition adds a point to the Trend Strength Score (0 to 11). This visual summary helps traders quickly assess whether an asset is aligned with a strong upward trend.
Includes language support for English and Spanish.
Indicador de Fuerza de Tendencia – Escáner Multicriterio
Este indicador evalúa la fuerza de una tendencia alcista utilizando 11 señales técnicas ampliamente reconocidas. Resume el comportamiento del precio, medias móviles, impulso del RSI y posición respecto a la Nube de Ichimoku en una tabla con íconos claros.
Condiciones evaluadas:
Máximos y mínimos alcistas
RSI en alza
Precio sobre EMA21, SMA50 y SMA200
EMA21 sobre SMA50 y SMA200
SMA50 sobre SMA200
Precio sobre la Nube de Ichimoku
Cada condición cumplida suma un punto al Puntaje de Fuerza de Tendencia (de 0 a 11). Esta tabla visual permite evaluar rápidamente si un activo presenta una tendencia sólida al alza.
Incluye soporte de idioma inglés y español.
23/35 SR Channels (Hitchhikers Guide To Goldbach)This indicator highlights potential short-term support and resistance zones based on the 23rd and 35th minute of each hour. At each of these time points, it draws a zone from the high to the low of the candle, extending it forward for a fixed number of bars.
Key features:
🔸 Orange zones mark the 23-minute candle
🔹 Blue zones mark the 35-minute candle
📏 Zones extend for a customizable number of bars (channelLength)
🔄 Existing zones are removed if they overlap significantly with a new one
🏷️ Optional labels show when a 23 or 35 zone is created
This tool is ideal for traders looking to identify time-based micro-structures and intraday reaction zones.
Momentum Fusion v1Momentum Fusion v1
Overview
Momentum Fusion v1 (MFusion) is a multi-oscillator indicator that combines several components to analyze market momentum and trend strength. It incorporates modified versions of classic indicators such as PVI (Positive Volume Index), NVI (Negative Volume Index), MFI (Money Flow Index), RSI, Stochastic, and Bollinger Bands Oscillator. The indicator displays a histogram that changes color based on momentum strength and includes "FUSION🔥" signal labels when extreme values are reached.
Indicator Settings
Parameters:
EMA Length – Smoothing period for the moving average (default: 255).
Smoothing Period – Internal calculation smoothing parameter (default: 15).
BB Multiplier – Standard deviation multiplier for Bollinger Bands (default: 2.0).
Show verde / marron / media lines – Toggles the display of auxiliary lines.
Show FUSION🔥 label – Enables/disables signal labels.
Indicator Components
1. PVI (Positive Volume Index)
Formula:
pvi := volume > volume ? nz(pvi ) + (close - close ) / close * sval : nz(pvi )
Description:
PVI increases when volume rises compared to the previous bar and accounts for price percentage change. The stronger the price movement with increasing volume, the higher the PVI value.
2. NVI (Negative Volume Index)
Formula:
nvi := volume < volume ? nz(nvi ) + (close - close ) / close * sval : nz(nvi )
Description:
NVI tracks price movements during declining volume. If the price rises on low volume, it may indicate a "stealth" trend.
3. Money Flow Index (MFI)
Formula:
100 - 100 / (1 + up / dn)
Description:
An oscillator measuring money flow strength. Values above 80 suggest overbought conditions, while values below 20 indicate oversold conditions.
4. Stochastic Oscillator
Formula:
k = 100 * (close - lowest(low, length)) / (highest(high, length) - lowest(low, length))
Description:
A classic stochastic oscillator showing price position relative to the selected period's range.
5. Bollinger Bands Oscillator
Formula:
(tprice - BB midline) / (upper BB - lower BB) * 100
Description:
Indicates the price position relative to Bollinger Bands in percentage terms.
Key Lines & Histogram
1. Verde (Green Line)
Calculation:
verde = marron + oscp (normalized PVI)
Interpretation:
Higher values indicate stronger bullish momentum. A FUSION🔥 signal appears when the value reaches 750+.
2. Marron (Brown Line)
Calculation:
marron = (RSI + MFI + Bollinger Osc + Stochastic / 3) / 2
Interpretation:
A composite oscillator combining multiple indicators. Higher values suggest overbought conditions.
3. Media (Red Line)
Calculation:
media = EMA of marron with smoothing period
Interpretation:
Acts as a signal line for trend confirmation.
4. Histogram
Calculation:
histo = verde - marron
Colors:
Bright green (>100) – Strong bullish momentum.
Light green (>0) – Moderate bullish momentum.
Orange (<0) – Bearish momentum.
Red (<-100) – Strong bearish momentum.
Signals & Alerts
1. FUSION🔥 (Strong Momentum)
Condition:
verde >= 750
Visualization:
A "FUSION🔥" label appears below the chart.
Alert:
Can be set to trigger notifications when the condition is met.
2. Background Aura
Condition:
verde > 850
Visualization:
The chart background turns teal, indicating extreme momentum.
Usage Recommendations
FUSION🔥 Signal – Can be used as a long entry point when confirmed by other indicators.
Histogram:
1. Green bars – Potential long entry.
2. Red/orange bars – Potential short entry.
3. Media & Marron Crossover – Can serve as an additional trend filter.
4. Suitable for a 5-15 minute time frame
Conclusion
Momentum Fusion v1 is a powerful tool for momentum analysis, combining multiple indicators into a unified system. It is suitable for:
Trend traders (catching strong movements).
Scalpers (identifying short-term impulses).
Swing traders (filtering entry points).
The indicator features customizable settings and visual signals, making it adaptable to various trading styles.