RSI Candlestick Oscillator [LuxAlgo]The RSI Candlestick Oscillator displays a traditional Relative Strength Index (RSI) as candlesticks. This indicator references OHLC data to locate each candlestick point relative to the current RSI Value, leading to a more accurate representation of the Open, High, Low, and Close price of each candlestick in the context of RSI.
In addition to the candlestick display, Divergences are detected from the RSI candlestick highs and lows and can be displayed over price on the chart.
🔶 USAGE
Translating candlesticks into the RSI oscillator is not a new concept and has been attempted many times before. This indicator stands out because of the specific method used to determine the candlestick OHLC values. When compared to other RSI Candlestick indicators, you will find that this indicator clearly and definitively correlates better to the on-chart price action.
Traditionally, the RSI indicator is simply one running value based on (typically) the close price of the chart. By introducing high, low, and open values into the oscillator, we can better gauge the specific price action throughout the intrabar movements.
Interactions with the RSI levels can now take multiple forms, whether it be a full-bodied breakthrough or simply a wick test. Both can provide a new analysis of price action alongside RSI.
An example of wick interactions and full-bodied interactions can be seen below.
As a result of the candlestick display, divergences become simpler to spot. Since the candlesticks on the RSI closely resemble the candlesticks on the chart, when looking for divergence between the chart and RSI, it is more obvious when the RSI and price are diverging.
The divergences in this indicator not only show on the RSI oscillator, but also overlay on the price chart for clearer understanding.
🔹 Filtering Divergence
With the candlesticks generating high and low RSI values, we can better sense divergences from price, since these points are generally going to be more dramatic than the (close) RSI value.
This indicator displays each type of divergence:
Bullish Divergence
Bearish Divergence
Hidden Bullish Divergence
Hidden Bearish Divergence
From these, we get many less-than-useful indications, since every single divergence from price is not necessarily of great importance.
The Divergence Filter disregards any divergence detected that does not extend outside the RSI upper or lower values.
This does not replace good judgment, but this filter can be helpful in focusing attention towards the extremes of RSI for potential reversal spotting from divergence.
🔶 DETAILS
In order to get the desired results for a display that resembles price action while following RSI, we must scale. The scaling is the most important part of this indicator.
To summarize the process:
Identify a range on Price and RSI
Consider them as equal to create a scaling factor
Use the scaling factor to locate RSI's "Price equivalent" Upper, Lower, & Mid on the Chart
Use those prices (specifically the RSI Mid) to check how far each OHLC value lies from it
Use those differences to translate the price back to the RSI Oscillator, pinning the OHLC values at their relative location to our anchor (RSI Mid)
🔹 RSI Channel
To better understand, and for your convenience, the indicator includes the option to display the RSI Channel on the chart. This channel helps to visualize where the scaled RSI values are relative to price.
If you analyze the RSI channel, you are likely to notice that the price movement throughout the channel matches the same movement witnessed in the RSI Oscillator below. This makes sense since they are the exact same thing displayed on different scales.
🔹 Scaling the Open
While the scaling method used is important, and provides a very close view of the real price bar's relative locations on the RSI oscillator… It is designed for a single purpose.
The scaling does NOT make the price candles display perfectly on the RSI oscillator.
The largest place where this is noticeable is with the opening of each candle.
For this reason, we have included a setting that modifies the opening of each RSI candle to be more accurate to the chart's price candles.
This setting positions the current bar's opening RSI candlestick value accurately relative to the price's open location to the previous closing price. As seen below.
🔶 SETTINGS
🔹 RSI Candles
RSI Length: Sets the Length for the RSI Oscillator.
Overbought/Oversold Levels: Sets the Overbought and Oversold levels for the RSI Oscillator.
Scale Open for Chart Accuracy: As described above, scales the open of each candlestick bar to more accurately portray the chart candlesticks.
🔹 Divergence
Show on Chart: Choose to display divergence line on the chart as well as on the Oscillator.
Divergence Length: Sets the pivot width for divergence detection. Normal Fractal Pivot Detection is used.
Divergence Style: Change color and line style for Regular and Hidden divergences, as well as toggle their display.
Divergence Filter: As described above, toggle on or off divergence filtering.
🔹 RSI Channel
Toggle: Display RSI Channel on Chart.
Color: Change RSI Channel Color
Indicatori e strategie
Dynamic Trend Bands [ChartPrime]The Dynamic Trend Bands is a versatile trend-following indicator that uses a double-smoothed Hull Moving Average (HMA) to detect market trends, combined with dynamic bands that provide insight into potential momentum shifts and volatility-based price zones.
⯁ KEY FEATURES
Double HMA Trend Filter
Utilizes a double-smoothed HMA for a smoother and more responsive trend line, reducing noise while highlighting clear market trends.
float base = ta.hma(ta.hma(close, length - 10), length)
Dynamic Volatility Bands
Plots upper and lower bands based on volatility, positioned above the price in a downtrend and below the price in an uptrend.
Momentum Shift Detection
Highlights bars in orange when a potential momentum shift occurs:
- During a downtrend, if the high breaks above the upper band.
- During an uptrend, if the low breaks below the lower band.
Customizable Band Appearance
Users can adjust the size, distance, and colors of the bands, as well as choose whether to display the mid-band line and fill the area between bands.
Timeframe Flexibility
Allows selection of different calculation timeframes, enabling traders to adapt the indicator to various trading strategies.
⯁ HOW TO USE
Identify Trend Direction
Use the double HMA line to confirm the prevailing trend:
- Above the bands: downtrend.
- Below the bands: uptrend.
Spot Potential Momentum Shifts
Watch for orange-highlighted bars signaling potential reversals or weakening trends.
Optimize Entries and Exits
Enter trades on trend continuation signals while using band breaks to spot potential reversal zones.
Customize to Fit Your Strategy
Adjust the bands’ size, distance, and calculation timeframe to suit scalping, swing, or position trading.
⯁ CONCLUSION
The Dynamic Trend Bands is an all-in-one tool that helps traders assess trend strength, detect momentum shifts, and identify key price zones. Its customizable features make it adaptable for various trading styles and market conditions.
Gold Certificate vs Gram Gold – Price Difference📌 Gold Certificate vs Gram Gold – Price Deviation Indicator
✅ Overview
This indicator is designed to analyze and visualize the price discrepancy between the Turkish Gold Certificate (BIST:ALTIN) and the international Gram Gold price (FX_IDC:XAUTRYG).
It helps investors identify whether the certificate is overvalued (premium) or undervalued (discount) compared to its theoretical price.
📐 What Does It Calculate?
In theory:
1 BIST Gold Certificate = 1/100 of Gram Gold price
However, in practice, this parity is rarely exact due to:
Local supply & demand
Limited liquidity in BIST
Investor sentiment
Timezone differences and market hours
This indicator calculates:
The % difference between actual certificate price and its theoretical value
The 100-day average of that difference for baseline comparison
🔍 Why Is This Useful?
Understanding the premium/discount level is crucial for:
Gold investors in Turkey who want to avoid buying overpriced certificates
Arbitrage traders seeking deviation opportunities between spot gold and certificate price
Long-term holders who want to enter at fair value or during discounts
Fundamental analysts who evaluate local sentiment divergence from international price
📊 What Does It Display?
% Price Difference
How much the certificate is trading above or below its theoretical price
100-Day Moving Average of the Difference
Historical baseline to understand if the current gap is excessive
Status Tag (Color-coded):
🔶 Expensive → Current difference is higher than 100-day average
🟢 Cheap → Current difference is below 0%
🔸 Normal → Within average range
Market Warning
A reminder to switch to a 24-hour chart like XAUTRYG when BIST is closed, as stale data may lead to misleading signals.
Multi-language Support
All interface text can be displayed in either Turkish or English, based on user selection in the settings.
⚙️ How to Use
Add the indicator to any chart
For the most accurate readings, open it on a 24/7 active symbol (e.g., XAUTRYG)
Watch the table in the top-right corner to track:
Current % Difference
100-Day Average
Market Status (Expensive, Cheap, Normal)
Pay attention to overbought conditions (e.g. +10%) as a signal to avoid buying
💡 Practical Example:
If:
Gram Gold = 2000 TRY
Theoretical ALTIN = 2000 / 100 = 20 TRY
But BIST:ALTIN is trading at 22.50 TRY → +12.5% premium
This tool would mark the certificate as 🔶 Expensive, showing that local traders are paying significantly more than the real value of gold.
🚨 Note:
Values may temporarily distort when BIST is closed and global gold continues to move.
This is not a buy/sell signal tool, but a valuation tool to assist in decision-making and timing.
🙌 Final Words
This indicator is ideal for:
Retail traders
Portfolio managers
Gold ETF analysts
Long-term investors
Use it to avoid overpaying during high-premium periods and to detect favorable buying windows.
If you find it useful, please like, save, and share!
Feel free to leave feedback or suggestions in the comments.
Uptrick: Dynamic Z-Score DeviationOverview
Uptrick: Dynamic Z‑Score Deviation is a trading indicator built in Pine Script that combines statistical filters and adaptive smoothing to highlight potential reversal points in price action. It combines a hybrid moving average, dual Z‑Score analysis on both price and RSI, and visual enhancements like slope‑based coloring, ATR‑based shadow bands, and dynamically scaled reversal signals.
Introduction
Statistical indicators like Z‑Scores measure how far a value deviates from its average relative to the typical variation (standard deviation). Standard deviation quantifies how dispersed a set of values is around its mean. A Z‑Score of +2 indicates a value two standard deviations above the mean, while -2 is two below. Traders use Z‑Scores to spot unusually high or low readings that may signal overbought or oversold conditions.
Moving averages smooth out price data to reveal trends. The Arnaud Legoux Moving Average (ALMA) reduces lag and noise through weighted averaging. A Zero‑Lag EMA (approximated here using a time‑shifted EMA) seeks to further minimize delay in following price. The RSI (Relative Strength Index) is a momentum oscillator that measures recent gains against losses over a set period.
ATR (Average True Range) gauges market volatility by averaging the range between high and low over a lookback period. Shadow bands built using ATR give a visual mood of volatility around a central trend line. Together, these tools inform a dynamic but statistically grounded view of market extremes.
Purpose
The main goal of this indicator is to help traders spot short‑term reversal opportunities on lower timeframes. By requiring both price and momentum (RSI) to exhibit statistically significant deviations from their norms, it filters out weak setups and focuses on higher‑probability mean‑reversion zones. Reversal signals appear when price deviates far enough from its hybrid moving average and RSI deviates similarly in the same direction. This makes it suitable for discretionary traders seeking clean entry cues in volatile environments.
Originality and Uniqueness
Uptrick: Dynamic Z‑Score Deviation distinguishes itself from standard reversal or mean‑reversion tools by combining several elements into a single framework:
A composite moving average (ALMA + Zero‑Lag EMA) for a smooth yet responsive baseline
Dual Z‑Score filters on price and RSI rather than relying on a single measure
Adaptive visual elements, including slope‑aware coloring, multi‑layer ATR shadows, and signal sizing based on combined Z‑Score magnitude
Most indicators focus on one aspect—price envelopes or RSI thresholds—whereas Uptrick: Dynamic Z‑Score Deviation requires both layers to align before signaling. Its visual design aids quick interpretation without overwhelming the chart.
Why these indicators were merged
Every component in Uptrick: Dynamic Z‑Score Deviation has a purpose:
• ALMA: provides a smooth moving average with reduced lag and fewer false crossovers than a simple SMA or EMA.
• Zero‑Lag EMA (ZLMA approximation): further reduces the delay relative to price by applying a time shift to EMA inputs. This keeps the composite MA closer to current price action.
• RSI and its EMA filter: RSI measures momentum. Applying an EMA filter on RSI smooths out false spikes and confirms genuine overbought or oversold momentum.
• Dual Z‑Scores: computing Z‑Scores on both the distance between price and the composite MA, and on smoothed RSI, ensures that signals only fire when both price and momentum are unusually stretched.
• ATR bands: using ATR‑based shadow layers visualizes volatility around the MA, guiding traders on potential support and resistance zones.
At the end, these pieces merge into a single indicator that detects statistically significant mean reversions while staying adaptive to real‑time volatility and momentum.
Calculations
1. Compute ALMA over the chosen MA length, offset, and sigma.
2. Approximate ZLMA by applying EMA to twice the price minus the price shifted by the MA length.
3. Calculate the composite moving average as the average of ALMA and ZLMA.
4. Compute raw RSI and smooth it with ALMA. Apply an EMA filter to raw RSI to reduce noise.
5. For both price and smoothed RSI, calculate the mean and standard deviation over the Z‑Score lookback period.
6. Compute Z‑Scores:
• z_price = (current price − composite MA mean) / standard deviation of price deviations
• z_rsi = (smoothed RSI − mean RSI) / standard deviation of RSI
7. Determine reversal conditions: both Z‑Scores exceed their thresholds in the same direction, RSI EMA is in oversold/overbought zones (below 40 or above 60), and price movement confirms directionality.
8. Compute signal strength as the sum of the absolute Z‑Scores, then classify into weak, medium, or strong.
9. Calculate ATR over the chosen period and multiply by layer multipliers to form shadow widths.
10.Derive slope over the chosen slope length and color the MA line and bars based on direction, optionally smoothing color transitions via EMA on RGB channels.
How this indicator actually works
1. The script begins by smoothing price data with ALMA and approximating a zero‑lag EMA, then averaging them for the main MA.
2. RSI is calculated, then smoothed and filtered.
3. Using a rolling window, the script computes statistical measures for both price deviations and RSI.
4. Z‑Scores tell how far current values lie from their recent norms.
5. When both Z‑Scores cross configured thresholds and momentum conditions align, reversal signals are flagged.
6. Signals are drawn with size and color reflecting strength.
7. The MA is plotted with dynamic coloring; ATR shadows are layered beneath to show volatility envelopes.
8. Bars can be colored to match MA slope, reinforcing trend context.
9. Alert conditions allow automated notifications when signals occur.
Inputs
Main Length: Main MA Length. Sets the period for ALMA and ZLMA.
RSI Length: RSI Length. Determines the lookback for momentum calculations.
Z-Score Lookback: Z‑Score Lookback. Window for mean and standard deviation computations.
Price Z-Score Threshold: Price Z‑Score Threshold. Minimum deviation required for price.
RSI Z-Score threshold: RSI Z‑Score Threshold. Minimum deviation required for momentum.
RSI EMA Filter Length: RSI EMA Filter Length. Smooths raw RSI readings.
ALMA Offset: Controls ALMA’s focal point in the window.
ALMA Sigma: Adjusts ALMA’s smoothing strength.
Show Reversal Signals : Toggle to display reversal signal markers.
Slope Sensitivity: Length for slope calculation. Higher values smooth slope changes.
Use Bar Coloring: Enables coloring of price bars based on MA slope.
Show MA Shadow: Toggle for ATR‑based shadow bands.
Shadow Layer Count: Number of shadow layers (1–4).
Base Shadow ATR Multiplier: Multiplier for ATR when sizing the first band.
Smooth Color Transitions (boolean): Smooths RGB transitions for line and shadows, if enabled.
ATR Length for Shadow: ATR Period for computing volatility bands.
Use Dynamic Signal Size: Toggles dynamic scaling of reversal symbols.
Features
Moving average smoothing: a hybrid of ALMA and Zero‑Lag EMA that balances responsiveness and noise reduction.
Slope coloring: MA line and optionally price bars change color based on trend direction; color transitions can be smoothed for visual continuity.
ATR shadow layers: translucent bands around the MA show volatility envelopes; up to four concentric layers help gauge distance from normal price swings.
Dual Z‑Score filters: price and momentum must both deviate beyond thresholds to trigger signals, reducing false positives.
Dynamic signal sizing: reversal markers scale in size based on the combined Z‑Score magnitude, making stronger signals more prominent.
Adaptive visuals: optional smoothing of color channels creates gradient effects on lines and fills for a polished look.
Alert conditions: built‑in buy and sell alerts notify traders when reversal setups emerge.
Conclusion
Uptrick: Dynamic Z‑Score Deviation delivers a structured way to identify short‑term reversal opportunities by fusing statistical rigor with adaptive smoothing and clear visual cues. It guides traders through multiple confirmation layers—hybrid moving average, dual Z‑Score analysis, momentum filtering, and volatility envelopes—while keeping the chart clean and informative.
Disclaimer
This indicator is provided for informational and educational purposes only and does not constitute financial advice. Trading carries risk and may not be suitable for all participants. Past performance is not indicative of future results. Always do your own analysis and risk management before making trading decisions.
Simple Momentum IndicatorThis helps you see if price is gaining bullish or bearish strength.
HOW TO USE:
A line above 0 = bullish momentum (price is rising)
A line below 0 = bearish momentum (price is falling)
A flat line around 0 = neutral , range-bound price
Color: green (bullish) or red (bearish)
Optional background color to match momentum direction
SITUATIONS OF:
1. Confirm Reversals
If you get a rejection john wick + engulfing candle,
Check if momentum is flipping at the same time
If yes = stronger reversal confirmation
2. Avoid Range Traps
If momentum is flat around 0, avoid trades — it’s not trending
Wait until momentum clearly breaks above/below 0
Best Timeframes to Use
5m / 15m = for scalping and fast intraday moves
1H / 4H = for cleaner, swing-trade confirmation
Works great when the market is volatile, like:
London / New York session
Breakout after consolidation
-Chris (973) 37733023
Million Moves Algø v4.3//...................../´¯¯/)
//...................,/¯.../
//.................../..../
//.............../´¯/'..'/´¯¯`·¸
//.........../'/.../..../....../¨¯\
//..........('(....´...´... ¯~/'..')
//...........\..............'...../
//............\....\.........._.·´
//.............\..............(
//..............\..............\
//----
//---------
// Telegram Join Us >> t.me
//@version=5
indicator("Million Moves Algø v4.3",overlay = true,max_labels_count = 500)
bullColor = #e43a72
bearColor = #00ffcc
sigsensiviti = input.float(2.5, "Sensivity", tooltip = "Changes the signal display frequency",group = "Main Settings")
signaltype = input.string("All Signals","Signals", ,tooltip = "Changes the Signal Typr" ,group = "Main Settings",display = display.none)
factor = 11//input.int(11, "Factor")
trend_ribbon = input.bool(true, "Trend Ribbon        ",inline = '1', group="Trend Settings")
trend_cloud = input.bool(true, "Trend Cloud",inline = '1', group="Trend Settings",tooltip = "")
chaos_trend = input.bool(true, "Chaos Trend Line  ",inline = '2', group="Trend Settings")
order_blocks = input.bool(false, "Order Block",inline = '2', group="Trend Settings",tooltip = "")
moving_avarg = input.bool(true, "Moving Average  ",inline = '3', group="Trend Settings")
ma_value = input.int(200, "",inline = '3', group="Trend Settings",tooltip = "")
candlestick_color = input.bool(true, "Candlestik Colors  ",inline = '4', group="Advance Settings")
candletype = input.string("CleanScalper","", ,tooltip = "" ,inline = '4',group="Advance Settings",display = display.none)
over_rsi = input.bool(true, "Show Overbought/OverSold", group="Advance Settings",tooltip = "")
c_break = input.bool(false, "Show Channel Breakouts", group="Advance Settings",tooltip = "")
signals_show = input.bool(true, "Turn Signals Off", group="Advance Settings",tooltip = "")
dashboard = "Million Moves DASHBOARD Settings"
showDashboard = input.bool(true,"Dashboard On/Off",tooltip = "Changes the size of the dashboard" ,group = dashboard,display = display.none)
dashboardLocation = input.string("Bottom Right","Dashboard Location", , inline = "3",tooltip = "Changes dashboard positions" ,group = dashboard,display = display.none)
dashboardSize = input.string("Small","Dashboard Size       ", , inline = "4",tooltip = "Changes the size of the dashboard" ,group = dashboard,display = display.none)
riskmanage = input.bool(false, "On/Off -Strength  ",inline = '1', group="Enable Stop-loss/take-profit areas")
tpstrength = input.float(1,"",tooltip = "" ,inline = '1',group="Enable Stop-loss/take-profit areas",display = display.none)
TP1 = input.bool(true, "TP 1Â Â ",inline = '2', group="Enable Stop-loss/take-profit areas")
TP2 = input.bool(true, "TP 2Â Â ",inline = '2', group="Enable Stop-loss/take-profit areas")
TP3 = input.bool(true, "TP 3Â Â ",inline = '2', group="Enable Stop-loss/take-profit areas")
// MainMA
emaLength = ma_value//input.int(title="EMA Length", defval=200, minval=2)
emaSource = close
ema = ta.ema(emaSource, emaLength)
ema2 = ta.ema(emaSource, emaLength)
plot(moving_avarg? ema : na, color=close > ema and close > ema ? color.green : color.red, linewidth=4,editable = false)
// Signals
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 := 2
else if prevSuperTrend == prevUpperBand
direction := close > upperBand ? -1 : 1
else
direction := close < lowerBand ? 1 : -1
superTrend := direction == -1 ? lowerBand : upperBand
sma1 = ta.sma(close, 8)
sma2 = ta.sma(close, 9)
sma3 = ta.sma(close, 13)
= supertrend(open, sigsensiviti, factor)
Cbull = ta.crossover(close, supertrend) and close >= sma3
Cbear = ta.crossunder(close, supertrend) and close <= sma3
bull = ta.crossover(close, supertrend) and close >= sma3 and not(close > ema and close > ema)
bear = ta.crossunder(close, supertrend) and close <= sma3 and not(not(close > ema and close > ema))
Sbull = ta.crossover(close, supertrend) and close >= sma3 and (close > ema and close > ema)
Sbear = ta.crossunder(close, supertrend) and close <= sma3 and not(close > ema and close > ema)
countbull = ta.barssince(Cbull)
countbear = ta.barssince(Cbear)
Trigger = nz(countbull, bar_index) < nz(countbear, bar_index) ? 1 : 0
plotshape(signals_show?signaltype =="Smart Signals"? na : bull:na, title = "Buy", text = 'Buy', style = shape.labelup, location = location.belowbar, color= bearColor,textcolor = color.black, size = size.normal,editable = false)
plotshape(signals_show?signaltype =="Smart Signals"? na : bear:na, title = "Sell", text = 'Sell', style = shape.labeldown, color= bullColor,textcolor = color.white, size = size.normal,editable = false)
plotshape(signals_show?Sbull:na, title = "Buy", text = 'Smart Buy', style = shape.labelup, location = location.belowbar, color= bearColor,textcolor = color.black, size = size.normal,editable = false)
plotshape(signals_show?Sbear:na, title = "Sell", text = 'Smart Sell', style = shape.labeldown, color= bullColor,textcolor = color.white, size = size.normal,editable = false)
// Trends
HighestTrend = ta.ema(close, 20)
LowestTrend = ta.ema(close, 55)
Trend01 = ta.ema(close,50)
Trend02 = ta.ema(close,45)
Trend03 = ta.ema(close,40)
Trend04 = ta.ema(close,35)
Trend05 = ta.ema(close,30)
Trend06 = ta.ema(close,25)
var bool uptrend = false
buySignal = ta.crossover(HighestTrend, LowestTrend)
sellSignal = ta.crossunder(HighestTrend, LowestTrend)
uptrend := buySignal ? true : sellSignal ? false : uptrend
plot(trend_ribbon?HighestTrend:na, color = uptrend ? color.new(bearColor,80) : color.new(bullColor,80),editable = false)
plot(trend_ribbon?Trend01:na, color = uptrend ? color.new(bearColor,20) : color.new(bullColor,20), editable = false)
plot(trend_ribbon?Trend02:na, color = uptrend ? color.new(bearColor,30) : color.new(bullColor,30), editable = false)
plot(trend_ribbon?Trend03:na, color = uptrend ? color.new(bearColor,40) : color.new(bullColor,40), editable = false)
plot(trend_ribbon?Trend04:na, color = uptrend ? color.new(bearColor,50) : color.new(bullColor,50), editable = false)
plot(trend_ribbon?Trend05:na, color = uptrend ? color.new(bearColor,60) : color.new(bullColor,60), editable = false)
plot(trend_ribbon?Trend06:na, color = uptrend ? color.new(bearColor,70) : color.new(bullColor,70), editable = false)
plot(trend_ribbon?LowestTrend:na, color = uptrend ? color.new(bearColor,10) : color.new(bullColor,10), editable = false)
// Dashboard
indicatorTF = "Chart"
// -- MTF Function
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)
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
// Checking Trend
di_length = 14
adx_smoothing = 14
bullish_threshold_multiplier = 1.2
bearish_threshold_multiplier = 0.8
= ta.dmi(di_length, adx_smoothing)
median_adx = ta.sma(_adx, 14)
bullish_threshold = median_adx * bullish_threshold_multiplier
bearish_threshold = median_adx * bearish_threshold_multiplier
detectADXTrend() =>
isBullish = _adx > bullish_threshold
isBearish = _adx < bearish_threshold
trendQuality = isBullish ? 1 : isBearish ? -1 : 0
// Wywołanie funkcji
adxTrend = detectADXTrend()
// MTF
TF1Bull = securityNoRep(syminfo.tickerid, "1" , adxTrend)
TF3Bull = securityNoRep(syminfo.tickerid, "3" , adxTrend)
TF5Bull = securityNoRep(syminfo.tickerid, "5" , adxTrend)
TF10Bull = securityNoRep(syminfo.tickerid, "10" , adxTrend)
TF15Bull = securityNoRep(syminfo.tickerid, "15" , adxTrend)
TF30Bull = securityNoRep(syminfo.tickerid, "30" , adxTrend)
TF60Bull = securityNoRep(syminfo.tickerid, "60" , adxTrend)
TF120Bull = securityNoRep(syminfo.tickerid, "120" , adxTrend)
TF240Bull = securityNoRep(syminfo.tickerid, "240" , adxTrend)
TF720Bull = securityNoRep(syminfo.tickerid, "720" , adxTrend)
TFDBull = securityNoRep(syminfo.tickerid, "1440", adxTrend)
// -- Volatility
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
string VolStatus = percentVol < 35 ? "Very Low" :percentVol < 50 ? "Low" :percentVol < 70 ? "High" :"Very High"
// Set RSI parameters
rsiLength = 14
rsiSource = close
rsiValue = ta.rsi(rsiSource, rsiLength)
bullishThreshold = 50
rsiColor = rsiValue > bullishThreshold ? color.green : color.red
table_position = dashboardLocation == 'Bottom Left' ? position.bottom_left
: dashboardLocation == 'Top Right' ? position.top_right
: position.bottom_right
table_size = dashboardSize == 'Tiny' ? size.tiny
: dashboardSize == 'Small' ? size.small
: size.normal
tb = table.new(table_position, 18, 8
, bgcolor = #11172565
, border_color = #373a4600
, border_width = 1
, frame_color = #000000
, frame_width = 1)
if showDashboard
if barstate.islast
table.cell(tb, 0, 0, '  Million Moves Dashboard                                ', text_color = color.white,text_halign = text.align_left, text_size = table_size,bgcolor = #18233a)
table.merge_cells(tb, 0, 0, 3, 0)
tb.cell(0, 2, "âš ï¸ Volatility", text_color = color.white, text_size = table_size, text_halign = text.align_center)
tb.cell(1, 2, VolStatus, text_color = color.white, text_size = table_size, text_halign = text.align_center)
tb.cell(2, 2, "ðŸ³ï¸„1¤7 RSI", text_color = color.white, text_size = table_size, text_halign = text.align_center)
tb.cell(3, 2, str.tostring(rsiValue,"#.##"), text_color = rsiColor, text_size = table_size, text_halign = text.align_center)
tb.cell(0, 3, "Timeframe", text_color = #b0b2b9, text_size = table_size, text_halign = text.align_center)
tb.cell(1, 3, "Trend", text_color = #b0b2b9, text_size = table_size, text_halign = text.align_center)
tb.cell(2, 3, "Timeframe", text_color = #b0b2b9, text_size = table_size, text_halign = text.align_center)
tb.cell(3, 3, "Trend", text_color = #b0b2b9, text_size = table_size, text_halign = text.align_center)
tb.cell(0, 4, "3 Minute", text_color = color.white, text_size = table_size, text_halign = text.align_center)
tb.cell(1, 4, TF3Bull?"Bullish":"Bearish", text_color = TF3Bull?color.green:color.red, text_size = table_size, text_halign = text.align_center)
tb.cell(2, 4, "2 Hour", text_color = color.white, text_size = table_size, text_halign = text.align_center)
tb.cell(3, 4, TF120Bull?"Bullish":"Bearish", text_color = TF120Bull?color.green:color.red, text_size = table_size, text_halign = text.align_center)
tb.cell(0, 5, "5 Minute", text_color = color.white, text_size = table_size, text_halign = text.align_center)
tb.cell(1, 5, TF5Bull?"Bullish":"Bearish", text_color = TF5Bull?color.green:color.red, text_size = table_size, text_halign = text.align_center)
tb.cell(2, 5, "4 Hour", text_color = color.white, text_size = table_size, text_halign = text.align_center)
tb.cell(3, 5, TF240Bull?"Bullish":"Bearish", text_color = TF240Bull?color.green:color.red, text_size = table_size, text_halign = text.align_center)
tb.cell(0, 6, "15 Minute", text_color = color.white, text_size = table_size, text_halign = text.align_center)
tb.cell(1, 6, TF15Bull?"Bullish":"Bearish", text_color = TF15Bull?color.green:color.red, text_size = table_size, text_halign = text.align_center)
tb.cell(2, 6, "12 Hour", text_color = color.white, text_size = table_size, text_halign = text.align_center)
tb.cell(3, 6, TF720Bull?"Bullish":"Bearish", text_color = TF720Bull?color.green:color.red, text_size = table_size, text_halign = text.align_center)
tb.cell(0, 7, "1 Hour", text_color = color.white, text_size = table_size, text_halign = text.align_center)
tb.cell(1, 7, TF60Bull?"Bullish":"Bearish", text_color = TF60Bull?color.green:color.red, text_size = table_size, text_halign = text.align_center)
tb.cell(2, 7, "Daily", text_color = color.white, text_size = table_size, text_halign = text.align_center)
tb.cell(3, 7, TFDBull?"Bullish":"Bearish", text_color = TFDBull?color.green:color.red, text_size = table_size, text_halign = text.align_center)
// bgcolor
// Define the RSI
rsi_Source = close
rsi_Period = 14
rsi_ = ta.rsi(rsi_Source, rsi_Period)
// Define thresholds for high and highest bullish/bearish levels
highBull = 75
highestBull = 85
highBear = 25
highestBear = 15
// Background color based on RSI level
bgColor = rsi_ > highestBull ? color.rgb(0, 255, 204, 86) : rsi_ > highBull ? #00ffcc10 :rsi_ < highestBear ? #e43a7333 : rsi_ < highBear ? color.rgb(228, 58, 115, 93) : na // High Bear - Light Red
bgcolor(over_rsi?bgColor:na, title="RSI Background")
//Ema Cloud
ema150 = ta.ema(close, 150)
ema250 = ta.ema(close, 250)
fill(plot(trend_cloud? ema150: na, "", na, editable=false), plot(trend_cloud? ema250: na, "", na, editable=false), ema150 > ema250 ? color.new(color.green, 70) : ema150 < ema250 ? color.new(color.red, 70) : na)
// Bar color
src = close
len = 14//input.int(14, minval=1, title='RSI Length')
up = ta.rma(math.max(ta.change(src), 0), len)
down = ta.rma(-math.min(ta.change(src), 0), len)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - 100 / (1 + up / down)
tierLow = rsi <= 45
tierMid = rsi > 45 and rsi <= 55
tierHigh = rsi > 55
color colorVar = na
colorVar := tierLow ? #db3943 : // Red for low RSI
tierMid ? #9900CA : // Purple for mid RSI
tierHigh ? #30b56a : // Green for high RSI
na
if (tierMid)
colorVar := rsi <= 50 ? #9900ca : #b200ff // Gradient between the mid values
if (tierHigh)
colorVar := rsi <= 65 ? #30b56a : #30b56a // Gradient between high values
green = #00DD00
red = #DD0000
barcolor(candlestick_color?candletype=="CleanScalper"?colorVar:candletype=="Trend Ribbon"?uptrend?green:red:close > ema and close > ema ? green : red:na)
// Define finer tiers for a more nuanced gradient
tierLow1 = rsi <= 30
tierLow2 = rsi > 30 and rsi <= 45
tierHigh2 = rsi > 65 and rsi <= 75
tierHigh3 = rsi > 55
color upTier = na
color downTier = na
downTier := tierLow1 ? #e43a72 : tierLow2 ? #e6002352 : color(na)
upTier := tierHigh2 ? #00ffcc : tierHigh3 ? #00ffcc65 :color(na)
// Cloud
k_length = 0.425
uphighColor = #ca009e4d
uplowColor = #ca009e27
downhighColor = #b300ff2f
downlowColor = #9700ca10
= ta.kc(close, 10, 10.5*k_length)
= ta.kc(close, 10, 9.5*k_length)
= ta.kc(close, 10, 8*k_length)
= ta.kc(close, 10, 3*k_length)
middleLineValue = ta.ema((upperKC1 + lowerKC1) / 2, 50)
middleLineColor = middleLineValue > middleLineValue ? color.green : color.red
middleLine = plot(middleLineValue, "Middle Line", color=middleLineColor,linewidth=2, editable=false)
k1 = plot(ta.ema(upperKC1, 50), "", color = downTier, style=plot.style_circles,linewidth = 2, editable=false)
k2 = plot(ta.ema(upperKC2, 50), "", na, editable=false)
k3 = plot(ta.ema(upperKC3, 50), "", na, editable=false)
k4 = plot(ta.ema(upperKC4, 50), "", na, editable=false)
k5 = plot(ta.ema(lowerKC4, 50), "", na, editable=false)
k6 = plot(ta.ema(lowerKC3, 50), "", na, editable=false)
k7 = plot(ta.ema(lowerKC2, 50), "", na, editable=false)
k8 = plot(ta.ema(lowerKC1, 50), "", color = upTier, style=plot.style_circles,linewidth = 2, editable=false)
fill(k1, k2, uphighColor , editable=false)
fill(k2, k3, uplowColor , editable=false)
//fill(k3, k4, color.new(red2, 90) , editable=false)
//fill(k5, k6, color.new(green2, 90) , editable=false)
fill(k6, k7, downlowColor , editable=false)
fill(k7, k8, downhighColor, editable=false)
//Tralling Step
amplitude = 3//input(title='Amplitude', defval=2)
channelDeviation = 2//input(title='Channel Deviation', defval=2)
showArrows = false//input(title='Show Arrows', defval=true)
showChannels = false//input(title='Show Channels', defval=true)
src5 = close
len_a = 14
up_a = ta.rma(math.max(ta.change(src5), 0), len_a)
var int trend = 0
var int nextTrend = 0
var float maxLowPrice = nz(low , low)
var float minHighPrice = nz(high , high)
var float up1 = 0.0
var float down1 = 0.0
float atrHigh = 0.0
float atrLow = 0.0
float arrowUp = na
float arrowDown = na
atr2 = ta.atr(100) / 2
dev = channelDeviation * atr2
highPrice1 = high
lowPrice1 = low
highma = ta.sma(high, amplitude)
lowma = ta.sma(low, amplitude)
if nextTrend == 1
maxLowPrice := math.max(lowPrice1, maxLowPrice)
if highma < maxLowPrice and close < nz(low , low)
trend := 1
nextTrend := 0
minHighPrice := highPrice1
minHighPrice
else
minHighPrice := math.min(highPrice1, minHighPrice)
if lowma > minHighPrice and close > nz(high , high)
trend := 0
nextTrend := 1
maxLowPrice := lowPrice1
maxLowPrice
if trend == 0
if not na(trend ) and trend != 0
up1 := na(down1 ) ? down1 : down1
arrowUp := up_a - atr2
arrowUp
else
up1 := na(up1 ) ? maxLowPrice : math.max(maxLowPrice, up1 )
up1
atrHigh := up1 + dev
atrLow := up1 - dev
atrLow
else
if not na(trend ) and trend != 1
down1 := na(up1 ) ? up1 : up1
arrowDown := down1 + atr2
arrowDown
else
down1 := na(down1 ) ? minHighPrice : math.min(minHighPrice, down1 )
down1
atrHigh := down1 + dev
atrLow := down1 - dev
atrLow
ht = trend == 0 ? up1 : down1
var color buyColor = #00e73a
var color sellColor = color.red
htColor = trend == 0 ? buyColor : sellColor
htPlot = plot(chaos_trend?ht:na, title='ATR', linewidth=2, color=htColor,editable = false)
// Risk Manager
tpLabels(tp,bull,bear) =>
rsi1 = ta.rsi(close, 14)
countBull = ta.barssince(bull)
countBear = ta.barssince(bear)
trigger = nz(countBull, bar_index) < nz(countBear, bar_index) ? 1 : 0
tp1Bull = ta.crossover (rsi1, 70), tp2Bull = ta.crossover (rsi1, 85), tp3Bull = ta.crossover (rsi1, 100)
tp1Bear = ta.crossunder(rsi1, 30), tp2Bear = ta.crossunder(rsi1, 15), tp3Bear = ta.crossunder(rsi1, 5)
tp1Bull := tp1Bull and (nz(ta.barssince(tp1Bull) , 9999) > countBull), tp2Bull := tp2Bull and (ta.barssince(tp1Bull) <= countBull), tp2Bull := tp2Bull and (nz(ta.barssince(tp2Bull) , 9999) > countBull), tp3Bull := tp3Bull and (ta.barssince(tp2Bull) <= countBull), tp3Bull := tp3Bull and (nz(ta.barssince(tp3Bull) , 9999) > countBull)
tp1Bear := tp1Bear and (nz(ta.barssince(tp1Bear) , 9999) > countBear), tp2Bear := tp2Bear and (ta.barssince(tp1Bear) <= countBear), tp2Bear := tp2Bear and (nz(ta.barssince(tp2Bear) , 9999) > countBear), tp3Bear := tp3Bear and (ta.barssince(tp2Bear) <= countBear), tp3Bear := tp3Bear and (nz(ta.barssince(tp3Bear) , 9999) > countBear)
trigger ? (tp == 1 ? tp1Bull : tp == 2 ? tp2Bull : tp3Bull) : (tp == 1 ? tp1Bear : tp == 2 ? tp2Bear : tp3Bear)
plotshape(TP1 and tpLabels(1,Cbull,Cbear) and Trigger, "TP", shape.xcross, location.abovebar, color.green , 0, "TP1", color.green , false,size = size.tiny)
plotshape(TP2 and tpLabels(2,Cbull,Cbear) and Trigger, "TP", shape.xcross, location.abovebar, color.green , 0, "TP2", color.green , false,size = size.tiny)
plotshape(TP3 and tpLabels(3,Cbull,Cbear) and Trigger, "TP", shape.xcross, location.abovebar, color.green , 0, "TP3", color.green , false,size = size.tiny)
plotshape(TP1 and tpLabels(1,Cbull,Cbear) and not Trigger, "TP", shape.xcross, location.belowbar, color.red, 0, "TP1", color.red, false,size = size.tiny)
plotshape(TP2 and tpLabels(2,Cbull,Cbear) and not Trigger, "TP", shape.xcross, location.belowbar, color.red, 0, "TP2", color.red, false,size = size.tiny)
plotshape(TP3 and tpLabels(3,Cbull,Cbear) and not Trigger, "TP", shape.xcross, location.belowbar, color.red, 0, "TP3", color.red, false,size = size.tiny)
_bull = Cbull
_bear = Cbear
risksteps = tpstrength
percTrailingSL = 1//input.float(1, "", 0, step=0.1, inline="2", group="RISK MANAGEMENT SETTINGS")
usePercSL = false//input(false, "% Trailing sl", inline="2", group="RISK MANAGEMENT SETTINGS")
enableTpSlAreas = riskmanage
useTP1 = true //input(true, "", inline="4", group="RISK MANAGEMENT SETTINGS")
multTP1 = risksteps //input.float(1, "TP 1", 0, inline="4", group="RISK MANAGEMENT SETTINGS")
useTP2 = true//input(true, "", inline="5", group="RISK MANAGEMENT SETTINGS")
multTP2 = risksteps * 2 //input.float(2, "TP 2", 0, inline="5", group="RISK MANAGEMENT SETTINGS")
useTP3 = true //input(true, "", inline="6", group="RISK MANAGEMENT SETTINGS")
multTP3 = risksteps * 3 //input.float(3, "TP 3", 0, inline="6", group="RISK MANAGEMENT SETTINGS")
tpLabels = true //input(true, "Take profit labels", group="RISK MANAGEMENT SETTINGS")
// Plots
none = close > 0
countBull = ta.barssince(_bull)
countBear = ta.barssince(_bear)
trigger = nz(countBull, bar_index) < nz(countBear, bar_index) ? 1 : 0
atrBand = usePercSL ? (trigger ? low : high) * (percTrailingSL / 100) : ta.atr(14) * 2.2
atrStop = trigger ? low - atrBand : high + atrBand
lastTrade(src) => ta.valuewhen(_bull or _bear, src, 0)
entry_y = lastTrade(close)
stop_y = lastTrade(atrStop)
tp1_y = (entry_y-lastTrade(atrStop))*multTP1 + entry_y
tp2_y = (entry_y-lastTrade(atrStop))*multTP2 + entry_y
tp3_y = (entry_y-lastTrade(atrStop))*multTP3 + entry_y
labelTpSl(cond, y, txt, color) =>
label labelTpSl = enableTpSlAreas and cond ? label.new(bar_index + 1, y, txt, xloc.bar_index, yloc.price, color, label.style_label_left, color.white, size.normal) : na
label.delete(labelTpSl )
labelTpSl(none, entry_y, "Entry : " + str.tostring(math.round_to_mintick(entry_y)), color.orange)
labelTpSl(none, stop_y , "Stop loss : " + str.tostring(math.round_to_mintick(atrStop)), color.red)
labelTpSl(useTP1 and multTP1 != 0, tp1_y, "TP 1 : " + str.tostring(math.round_to_mintick(tp1_y)), color.green)
labelTpSl(useTP2 and multTP2 != 0, tp2_y, "TP 2 : " + str.tostring(math.round_to_mintick(tp2_y)), color.green)
labelTpSl(useTP3 and multTP3 != 0, tp3_y, "TP 3 : " + str.tostring(math.round_to_mintick(tp3_y)), color.green)
lineTpSl(cond, y, color, style) =>
line lineTpSl = enableTpSlAreas and cond ? line.new(bar_index - (trigger ? countBull : countBear), y, bar_index + 1, y, xloc.bar_index, extend.none, color, style) : na
line.delete(lineTpSl )
lineTpSl(none, entry_y, color.orange, line.style_dashed)
lineTpSl(none, stop_y , color.red , line.style_solid )
lineTpSl(useTP1 and multTP1 != 0, tp1_y, color.green, line.style_dotted)
lineTpSl(useTP2 and multTP2 != 0, tp2_y, color.green, line.style_dotted)
lineTpSl(useTP3 and multTP3 != 0, tp3_y, color.green, line.style_dotted)
// Reversal Signals
enableReversal = true
ReversalInputs = 25//input.int(14, minval=1, title="Reversals Sensitivity", group="Reversal Settings")
overbought = 75//input(75, 'Reversal Down Level', group='Reversal Settings')
oversold = 25//input(25, 'Reversal Up Level', group='Reversal Settings')
upwardd = ta.rma(math.max(ta.change(close), 0), ReversalInputs)
dnwardd = ta.rma(-math.min(ta.change(close), 0), ReversalInputs)
source = dnwardd == 0 ? 100 : upwardd == 0 ? 0 : 100 - (100 / (1 + upwardd / dnwardd))
revdn = ta.crossunder(source, overbought) and enableReversal
revup = ta.crossover(source, oversold) and enableReversal
plotshape(revup, 'Reversal Up Signal', shape.labelup, location.belowbar, #b300ff4f, text='', size=size.small, textcolor=color.white)
plotshape(revdn, 'Reversal Down Signal', shape.labeldown, location.abovebar, #ca009e79, text='', size=size.small, textcolor=color.white)
//Channel Breakouts
bars = 3//input(3)
checkbox = true//input.bool(title= "color chenging by trend", defval=true)
ph = ta.pivothigh(high, bars, bars)
pl = ta.pivotlow(low, bars, bars)
//INIT VARIABLES
var int ph_uptrend_flag = 0
var float ph_valid1 = 0
var float ph_valid2 = 0
var float ph_valid3 = 0
var float ph_valid4 = 0
var float ph_valid5 = 0
var float pl_valid1 = 0
var float pl_valid2 = 0
var float pl_valid3 = 0
var float pl_valid4 = 0
var float pl_valid5 = 0
var float ph_valid_old = 2
var float pl_valid_old = 0 // non meaningful number here for initialization only
ph_non_na = nz(ph, 0)
pl_non_na = nz(pl, 0) // stores 0's instead of na's for non-pivot-pointed bars
if ph_non_na != 0
ph_valid5 := ph_valid4
ph_valid4 := ph_valid3
ph_valid3 := ph_valid2
ph_valid2 := ph_valid1
ph_valid1 := ph_non_na
ph_valid_old := ph_valid1
ph_valid_old
else
ph_valid1 := ph_valid1
ph_valid_old := ph_valid_old
ph_valid_old
if pl_non_na != 0
pl_valid5 := pl_valid4
pl_valid4 := pl_valid3
pl_valid3 := pl_valid2
pl_valid2 := pl_valid1
pl_valid1 := pl_non_na
pl_valid_old := pl_valid1
pl_valid_old
else
pl_valid1 := pl_valid1
pl_valid_old := pl_valid_old
pl_valid_old
max = math.max(ph_valid2, ph_valid1)
min = math.min(pl_valid2, pl_valid1)
avg = math.avg(ph_valid2, ph_valid1,pl_valid2, pl_valid1)
plot(c_break ?max:na, title = "High level", color=green)
plot(c_break ?min:na, title = "Low level", color=red)
//plot(avg, title = "Mid level", color=color.yellow )
// OrderBlock
box_ob = order_blocks//input.bool(false, "Toggle Order Block", group="ORDER BLOCK")
box_hide_gray = true//input.bool(false, "Hide gray boxes", group="ORDER BLOCK")
bos_type = "High and Low"//input.string("High and Low", "MSB trigger", , group="ORDER BLOCK")
box_sv = true//input.bool(true, "Plot demand boxes", group="ORDER BLOCK")
box_test_delay = 3//input.int(3, "Delay to count test of demand box", 1, group="ORDER BLOCK")
box_fill_delay = 3//input.int(3, "Delay to count fill of demand box", 1, group="ORDER BLOCK")
box_test_sv = true//input.bool(true, "Dim tested demand boxes", group="ORDER BLOCK")
box_stop_sv = true//input.bool(true, "Stop plotting filled demand boxes", group="ORDER BLOCK")
var float pvh1_price = array.new_float(1000, na)
var int pvh1_time = array.new_int (1000, na)
var float pvl1_price = array.new_float(1000, na)
var int pvl1_time = array.new_int (1000, na)
var float pvh2_price = array.new_float(1000, na)
var int pvh2_time = array.new_int (1000, na)
var float pvl2_price = array.new_float(1000, na)
var int pvl2_time = array.new_int (1000, na)
var float htcmrll_price = na
var int htcmrll_time = na
var float ltcmrhh_price = na
var int ltcmrhh_time = na
var box long_boxes = array.new_box()
var box short_boxes = array.new_box()
var float temp_pv_0 = na
var float temp_pv_1 = na
var float temp_pv_2 = na
bool pvh = high < high and high > high
bool pvl = low > low and low < low
int pv1_time = bar_index
float pv1_high = high
float pv1_low = low
float trigger_high = bos_type == "High and Low" ? high : math.max(open, close)
float trigger_low = bos_type == "High and Low" ? low : math.min(open, close)
if box_ob and barstate.isconfirmed
if pvh
array.pop(pvh1_price)
array.pop(pvh1_time)
array.unshift(pvh1_price, pv1_high)
array.unshift(pvh1_time, pv1_time)
if array.size(pvh1_price) > 2
temp_pv_0 := array.get(pvh1_price, 0)
temp_pv_1 := array.get(pvh1_price, 1)
temp_pv_2 := array.get(pvh1_price, 2)
if temp_pv_0 > temp_pv_1
for i = 0 to array.size(pvl1_time) - 1 by 1
temp_ltcmrhh_time = array.get(pvl1_time, i)
if temp_ltcmrhh_time < array.get(pvh1_time, 0)
ltcmrhh_price := array.get(pvl1_price, i)
ltcmrhh_time := temp_ltcmrhh_time
break
if temp_pv_0 < temp_pv_1 and temp_pv_1 > temp_pv_2
array.pop(pvh2_price)
array.pop(pvh2_time)
array.unshift(pvh2_price, temp_pv_1)
array.unshift(pvh2_time, array.get(pvh1_time, 1))
if pvl
array.pop(pvl1_price)
array.pop(pvl1_time)
array.unshift(pvl1_price, pv1_low)
array.unshift(pvl1_time, pv1_time)
if array.size(pvl1_price) > 2
temp_pv_0 := array.get(pvl1_price, 0)
temp_pv_1 := array.get(pvl1_price, 1)
temp_pv_2 := array.get(pvl1_price, 2)
if temp_pv_0 < temp_pv_1
for i = 0 to array.size(pvh1_time) - 1 by 1
temp_htcmrll_time = array.get(pvh1_time, i)
if temp_htcmrll_time < array.get(pvl1_time, 0)
htcmrll_price := array.get(pvh1_price, i)
htcmrll_time := temp_htcmrll_time
break
if temp_pv_0 > temp_pv_1 and temp_pv_1 < temp_pv_2
array.pop(pvl2_price)
array.pop(pvl2_time)
array.unshift(pvl2_price, temp_pv_1)
array.unshift(pvl2_time, array.get(pvl1_time, 1))
if trigger_high > htcmrll_price
if box_sv
loBox = box.new(left=array.get(pvl1_time, 0), top=math.min(high , high ), right=bar_index, bottom=array.get(pvl1_price, 0), bgcolor=color.rgb(0, 255, 0, 80), border_color=color.rgb(0, 255, 0, 80), extend=extend.right)
if array.size(long_boxes) >= 25
box.delete(array.shift(long_boxes))
array.push(long_boxes, loBox)
htcmrll_price := na
htcmrll_price
if trigger_low < ltcmrhh_price
if box_sv
hiBox = box.new(left=array.get(pvh1_time, 0), top=array.get(pvh1_price, 0), right=bar_index, bottom=math.max(low , low ), bgcolor=color.rgb(255, 0, 0, 80), border_color=color.rgb(255, 0, 0, 80), extend=extend.right)
if array.size(short_boxes) >= 25
box.delete(array.shift(short_boxes))
array.push(short_boxes, hiBox)
ltcmrhh_price := na
ltcmrhh_price
if array.size(short_boxes) > 0
for i = array.size(short_boxes) - 1 to 0 by 1
tbox = array.get(short_boxes, i)
top = box.get_top(tbox)
bottom = box.get_bottom(tbox)
if trigger_high > bottom and box.get_left(tbox) + box_test_delay < bar_index and box_test_sv
if box_hide_gray
box.set_bgcolor(tbox, #00000000)
box.set_border_color(tbox, #00000000)
else
box.set_bgcolor(tbox, color.rgb(192, 192, 192, 80))
box.set_border_color(tbox, color.rgb(192, 192, 192, 80))
if trigger_high > top and box.get_left(tbox) + box_fill_delay < bar_index
if box_stop_sv
box.set_right(tbox, bar_index)
box.set_extend(tbox, extend.none)
array.remove(short_boxes, i)
if array.size(long_boxes) > 0
for i = array.size(long_boxes) - 1 to 0 by 1
lbox = array.get(long_boxes, i)
top = box.get_top(lbox)
bottom = box.get_bottom(lbox)
if trigger_low < top and box.get_left(lbox) + box_test_delay < bar_index and box_test_sv
if box_hide_gray
box.set_bgcolor(lbox, #00000000)
box.set_border_color(lbox, #00000000)
else
box.set_bgcolor(lbox, color.rgb(192, 192, 192, 80))
box.set_border_color(lbox, color.rgb(192, 192, 192, 80))
if trigger_low < bottom and box.get_left(lbox) + box_fill_delay < bar_index
if box_stop_sv
box.set_right(lbox, bar_index)
box.set_extend(lbox, extend.none)
array.remove(long_boxes, i)
ICT Swiftedge# ICT SwiftEdge: Advanced Market Structure Trading System
**Overview**
ICT SwiftEdge is a powerful trading system built upon the foundation of ICTProTools' ICT Breakers, licensed under the Mozilla Public License 2.0 (mozilla.org). This script has been significantly enhanced by to combine market structure analysis with modern technical indicators and a sleek, AI-inspired statistics dashboard. The goal is to provide traders with a comprehensive tool for identifying high-probability trade setups, managing exits, and tracking performance in a visually intuitive way.
**Credits**
This script is a derivative work based on the original "ICT Breakers" by ICTProTools, used with permission under the Mozilla Public License 2.0. Significant enhancements, including RSI-MA signals, trend filtering, dynamic timeframe adjustments, dual exit strategies, and an AI-style statistics dashboard, were developed by . We express our gratitude to ICTProTools for their foundational work in market structure analysis.
**What It Does**
ICT SwiftEdge integrates multiple trading concepts to help traders identify and manage trades based on market structure and momentum:
- **Market Structure Analysis**: Identifies Break of Structure (BOS) and Market Structure Shift (MSS) patterns, which signal potential trend continuations or reversals. BOS indicates a continuation of the current trend, while MSS highlights a shift in market direction, providing key entry points.
- **RSI-MA Signals**: Generates "BUY" and "SELL" signals when BOS or MSS patterns align with the Relative Strength Index (RSI) smoothed by a Moving Average (RSI-MA). Signals are filtered to occur only when RSI-MA is above 50 (for buys) or below 50 (for sells), ensuring momentum supports the trade direction.
- **Trend Filtering**: Prevents multiple signals in the same trend, ensuring only one buy or sell signal per trend direction, reducing noise and improving trade clarity.
- **Dynamic Timeframe Adjustment**: Automatically adjusts pivot points, RSI, and MA parameters based on the selected chart timeframe (1M to 1D), optimizing performance across different market conditions.
- **Flexible Exit Strategies**: Offers two user-selectable exit methods:
- **Trailing Stop-Loss (TSL)**: Exits trades when price moves against the position by a user-defined distance (in points), locking in profits or limiting losses.
- **RSI-MA Exit**: Exits trades when RSI-MA crosses the 50 level, signaling a potential loss of momentum.
- Users can enable either or both strategies, providing flexibility to adapt to different trading styles.
- **AI-Style Statistics Dashboard**: Displays real-time trade performance metrics in a futuristic, neon-colored interface, including total trades, wins, losses, win/loss ratio, and win percentage. This helps traders evaluate the system's effectiveness without external tools.
**Why This Combination?**
The integration of these components creates a synergistic trading system:
- **BOS/MSS and RSI-MA**: Combining market structure breaks with RSI-MA ensures entries are based on both price action (structure) and momentum (RSI-MA), increasing the likelihood of high-probability trades.
- **Trend Filtering**: By limiting signals to one per trend, the system avoids overtrading and focuses on significant market moves.
- **Dynamic Adjustments**: Timeframe-specific parameters make the system versatile, suitable for scalping (1M, 5M) or swing trading (4H, 1D).
- **Dual Exit Strategies**: TSL protects profits during trending markets, while RSI-MA exits are ideal for range-bound or reversing markets, catering to diverse market conditions.
- **Statistics Dashboard**: Provides immediate feedback on trade performance, enabling data-driven decision-making without manual tracking.
This combination balances technical precision with user-friendly visuals, making it accessible to both novice and experienced traders.
**How to Use**
1. **Add to Chart**: Apply the script to any TradingView chart.
2. **Configure Settings**:
- **Chart Timeframe**: Select your chart's timeframe (1M to 1D) to optimize parameters.
- **Structure Timeframe**: Choose a timeframe for market structure analysis (leave blank for chart timeframe).
- **Exit Strategy**: Enable Trailing Stop-Loss (`useTslExit`), RSI-MA Exit (`useRsiMaExit`), or both. Adjust `tslPoints` for TSL distance.
- **Show Signals/Labels**: Toggle `showSignals` and `showExit` to display "BUY", "SELL", and "EXIT" labels.
- **Dashboard**: Enable `showDashboard` to view trade statistics. Customize colors with `dashboardBgColor` and `dashboardTextColor`.
3. **Trading**:
- Look for "BUY" or "SELL" labels to enter trades when BOS/MSS aligns with RSI-MA.
- Exit trades at "EXIT" labels based on your chosen strategy.
- Monitor the statistics dashboard to track performance (total trades, win/loss ratio, win percentage).
4. **Alerts**: Set up alerts for BOS, MSS, buy, sell, or exit signals using the provided alert conditions.
**License**
This script is licensed under the Mozilla Public License 2.0 (mozilla.org). The source code is available for review and modification under the terms of this license.
**Compliance with TradingView House Rules**
This publication adheres to TradingView's House Rules and Scripts Publication Rules. It provides a clear, self-contained description of the script's functionality, credits the original author (ICTProTools), and explains the rationale for combining indicators. The script contains no promotional content, offensive language, or proprietary restrictions beyond MPL 2.0.
**Note**
Trading involves risk, and past performance is not indicative of future results. Always backtest and validate the system on your preferred markets and timeframes before live trading.
Enjoy trading with ICT SwiftEdge, and let data-driven insights guide your decisions!
DC - Volatility ZigZag Support/ResistanceThis indicator combines advanced Volatility ZigZag detection, SMA 200 trend analysis, and dynamic support/resistance zones based on volume and price pivots. It's designed to help traders visually identify trend reversals, key price levels, and potential breakouts or bounces with clarity and precision.
What It Does
Volatility ZigZag: Uses price volatility (standard deviation, ATR, true range) to plot ZigZag lines and identify significant trend changes. Labels provide reversal price, price/percentage change, and volume data between pivots.
SMA 200: Plots the 200-period Simple Moving Average to indicate the long-term trend direction.
Support/Resistance Zones: Automatically detects price levels based on pivot highs/lows confirmed by volume conditions. Boxes are color-coded and dynamically update based on breakout or retest behavior.
⚙️ Key Features
Fully customizable ZigZag settings: deviation %, pivot confirmation, std dev factor, and lookback length.
Configurable visuals: pivot markers (⦿), alert points (◯), and labeled statistics between pivots.
Volume-sensitive support/resistance zones that react to breakouts or bounces.
Alerts for new ZigZag pivots.
Data window feedback on trend status and deviation metrics.
✅ Ideal For
Swing traders tracking reversals or continuation patterns.
Trend followers using SMA 200 and pivot points for confirmation.
Volume-based traders looking for support/resistance backed by meaningful volume spikes or drops.
Xpips Trade TrendLooking to boost your trend-following strategy? Discover this ultra-precise indicator, designed to deliver fast and responsive trend signals with zero lag. By combining a no-lag EMA (ZLEMA), adaptive volatility bands, and dynamic alerts, you'll gain a clear, real-time view of the market—no matter your trading timeframe. 🔍
🔹 Lag-free analysis: Smooth price action using ZLEMA for fast and fluid trend readings.
🔹 Multi-timeframe view: Track up to 5 timeframes simultaneously (from intraday to daily) in a clean, intuitive panel.
🔹 Adaptive volatility bands: Spot reversals with greater accuracy and reduced false signals.
🔹 Smart alerts: Get instantly notified when trend shifts occur—no need to constantly monitor your chart.
🔹 Optimized visuals: Clear color-coded signals help you instantly identify bullish and bearish trends.
🔹 Fully customizable: Tweak EMA length, band settings, colors, and timeframes to perfectly fit your strategy.
To set an alert, simply create an alert on the indicator:
- For a sell alert: select the indicator and choose *bearish trend*
- For a buy alert: select the indicator and choose *bullish trend*
"You can also create alerts on the small triangles after the label.
It’s the same thing."
- For a sell alert: select the indicator and choose *bearish entry signal*
- For a buy alert: select the indicator and choose *bullish entry signal*
Trend Channel SwiftEdgeTrend Channel SwiftEdge
The Trend Channel SwiftEdge is a powerful, visually striking tool designed to help traders identify trends and potential trade setups across multiple timeframes with a futuristic, tech-inspired design. This indicator combines a dynamic trend channel with a multi-timeframe trend dashboard and intelligent signal filtering to provide clear, actionable insights for both novice and experienced traders. Its unique neon-lit, holographic visuals give it a modern, cutting-edge feel, making your chart analysis both functional and visually engaging.
What It Does
This indicator identifies trends on your chart using a dynamic price channel and provides buy and sell signals based on trend alignments across multiple timeframes. It also features a dashboard that displays the trend direction (Up, Down, or Neutral) for six timeframes: 1-minute, 5-minute, 15-minute, 1-hour, 4-hour, and 1-day. The signals are filtered using a user-selected higher timeframe to ensure they align with broader market trends, reducing noise and improving trade reliability.
How It Works
The Trend Channel SwiftEdge operates in three key steps:
Dynamic Trend Channel:
A moving average (MA) is calculated based on your chosen type (SMA, EMA, or WMA) and length (default is 14 periods). This MA forms the backbone of the trend channel.
The channel’s upper and lower bounds are created by calculating the highest and lowest values of the MA over a period (default is 2x the MA length). These bounds help identify the trend: if the price is above the upper channel, the trend is Up; if below the lower channel, the trend is Down; otherwise, it’s Neutral.
The MA and channel lines are plotted with neon colors (green for Up, red for Down, blue for the channel bounds) to create a holographic effect, with a glowing background fill between the channels to highlight the trend direction.
Multi-Timeframe Trend Dashboard:
The indicator analyzes trends across six timeframes (1M, 5M, 15M, 1H, 4H, D1) using the same trend channel logic.
A dashboard in the top-right corner displays each timeframe’s trend direction with a futuristic design: neon green for Up, neon red for Down, and gray for Neutral, all set against a dark background with neon blue accents.
Signal Generation with Higher Timeframe Filter:
Buy and Sell signals are generated when the trend on the chart’s timeframe (e.g., 1M) aligns with a user-selected higher timeframe (e.g., 15M).
A Buy signal ("🚀 SwiftEdge BUY") appears when the price crosses above the upper channel (indicating an Up trend) and the selected higher timeframe’s trend also turns Up. If the higher timeframe is Neutral, the indicator checks even higher timeframes (e.g., 1H and 4H for a 15M filter) to confirm the trend direction.
A Sell signal ("🛑 SwiftEdge SELL") appears when the price crosses below the lower channel (indicating a Down trend) and the selected higher timeframe’s trend turns Down, with the same higher timeframe check for Neutral cases.
Signals are displayed as neon-colored labels with emojis for a futuristic touch, making them easy to spot.
Why This Combination?
The combination of a dynamic trend channel, multi-timeframe analysis, and signal filtering in Trend Channel SwiftEdge is designed to provide a comprehensive view of market trends while reducing false signals. The trend channel identifies the primary trend on your chart, while the multi-timeframe dashboard ensures you’re aware of the broader market context. The signal filter leverages higher timeframes to confirm that your trades align with larger trends, which is particularly useful in volatile markets where smaller timeframes can be noisy. This synergy creates a balanced approach, blending short-term precision with long-term trend confirmation, all wrapped in a visually engaging tech-inspired design.
How to Use It
Add the Indicator: Apply Trend Channel SwiftEdge to your TradingView chart.
Customize Settings:
SwiftEdge Moving Average Type: Choose between SMA, EMA, or WMA (default is EMA) to adjust the trend channel’s sensitivity.
SwiftEdge MA Length: Set the period for the moving average (default is 14).
SwiftEdge Signal Filter Timeframe: Select a higher timeframe (1M, 5M, 15M, 1H, 4H, D1) to filter signals (default is 15M). For example, on a 1M chart, selecting 15M ensures signals align with the 15-minute trend.
Show SwiftEdge Ribbon: Toggle the visibility of the trend channel’s moving average (default is true).
Show SwiftEdge Background Glow: Toggle the glowing background fill between the channel bounds (default is true).
Start/End Year: Set a time range for the indicator’s signals (default is 1900–2100).
Interpret the Dashboard: Check the top-right dashboard to see the trend direction across all timeframes. Use this to understand the broader market context.
Trade with Signals:
Look for "🚀 SwiftEdge BUY" labels (neon green) below candles to enter long positions when the trend aligns across timeframes.
Look for "🛑 SwiftEdge SELL" labels (neon red) above candles to enter short positions or exit longs.
Ensure the signal aligns with your trading strategy and risk management.
What Makes It Original?
Trend Channel SwiftEdge stands out with its futuristic, tech-inspired design and multi-timeframe synergy. Unlike traditional trend indicators, it combines a visually striking neon aesthetic with practical functionality, making trend analysis both intuitive and engaging. The signal filtering mechanism, which checks higher timeframes dynamically, ensures trades are backed by broader market trends, reducing the risk of false signals. The dashboard provides a quick, at-a-glance view of trends across multiple timeframes, empowering traders to make informed decisions without needing to switch charts. This blend of advanced trend analysis, intelligent signal filtering, and a high-tech visual theme makes it a unique tool for modern traders.
Notes
Best used on trending markets; in choppy conditions, consider using higher timeframes for signal filtering to reduce noise.
Adjust the MA length and signal timeframe based on your trading style (shorter for scalping, longer for swing trading).
Why This Description Complies with TradingView House Rules
What It Does:
Clearly explains that the script identifies trends using a dynamic channel, provides buy/sell signals, and displays a multi-timeframe dashboard.
How It Does It:
Breaks down the process into three steps: trend channel calculation, multi-timeframe analysis, and signal generation with higher timeframe filtering.
Explains the logic (e.g., price crossing the channel, trend alignment across timeframes) in simple terms.
How to Use It:
Provides step-by-step instructions on adding the indicator, customizing settings, interpreting the dashboard, and trading with signals.
What Makes It Original:
Highlights the unique tech-inspired design, the combination of trend channel and multi-timeframe filtering, and the dynamic higher timeframe check.
Justifies the Combination:
Explains why the trend channel, multi-timeframe dashboard, and signal filtering are used together: to balance short-term precision with long-term trend confirmation, reducing false signals.
Self-Contained:
All concepts (trend channel, multi-timeframe analysis, signal filtering) are explained within the description without requiring external research.
Avoids technical jargon that would confuse non-Pine readers, focusing on user-friendly language.
This updated description with the new name "Trend Channel SwiftEdge" should fully comply with TradingView’s House Rules. If you need further adjustments, let me know!
Global M2 Money Supply // Days Offset =Implementation of Colin Crypto M2 money supply indicator which seems to lead BTC movement.
Dynamic Strong Support & ResistanceThis Pine Script dynamically identifies strong support and strong resistance levels based on significant pivot points in the market. It calculates the high and low points of previous candles within a specified lookback period and marks these levels as key support (green) and resistance (red) areas. The script visually plots these levels on the chart and adds labels for easy reference, helping traders spot potential reversal zones and key price levels for market analysis.
HTF 30-m Visualiser for 3M - ADK - WHTF 30-m Visualiser — use on 3-minute charts
Purpose – gives 3-minute scalpers an unobtrusive snapshot of the last completed 30-minute candle.
Visual elements
Two dotted verticals show the 30-m candle’s start and an “early” finish one 3-min bar before the real close (27 min span).
Vertical colour follows candle direction: green for up, red for down.
Dotted green horizontal at the 30 m open and red horizontal at its close, confined between the verticals.
Verticals extend only from that candle’s low to its high.
Data window – self-prunes to keep roughly two days of 30-m structure (~48 candles) so the chart stays light.
Typical uses – aligning micro entries with 30-m bias, marking session blocks, anchoring VWAP or order-flow studies to reliable HTF pivots.
Ultimate Scalping Dashboard (w/ Entry/Exit)Entry Recommendation: When all conditions align (momentum, trend, volume, etc.)
Exit Recommendation:
Exit Long when bullish conditions weaken
Exit Short when bearish conditions weaken
These will appear in a new column in your dashboard: ENTRY/EXIT
Signal: Whether the market setup is Long, Short, or Neutral
Entry/Exit: When to Enter Long/Short, or when to Exit
Zig Zag Channels + Pivots + Live Price LabelThis script visualizes a Zig Zag indicator combined with:
Channel boundaries based on max price deviation,
Pivot point markers, and
A live price label extending to the right of the chart.
It’s intended for trend analysis, showing swings, potential reversals, and visual cues for extreme movements.
NEO Super 1The main changes include:
Added parameters from the second indicator
Expanded the MA function to support types from both indicators
Integrated moving average calculations
Added new signal logic using conditions:
MA Fast/Slow crossover 2 bars ago
Checking the close of the previous candle
Definition of the Hull Ribbon zone
Added new arrows and alerts
Kept all original visuals and alerts
All controls from both indicators are available in the script settings. You can enable/disable individual components via parameters.
[blackcat] L2 MTF Heikin-Ashi SR LevelsOVERVIEW
The L2 MTF Heikin-Ashi SR Levels indicator is a sophisticated tool designed to help traders identify critical support and resistance levels across multiple timeframes. This script employs Heikin-Ashi candles, which provide a smoothed representation of price action, making it easier to spot trends and reversals. By integrating multi-timeframe analysis, this indicator offers a comprehensive view of market dynamics, enabling traders to make more informed decisions 📊✅.
This indicator not only calculates essential support and resistance levels but also visually represents them on the chart with gradient colors based on Relative Strength Index (RSI) values. Additionally, it features customizable alerts and labels to enhance user experience and ensure timely execution of trades.
FEATURES
Advanced Trend Identification:
Uses Heikin-Ashi candles for smoother price action analysis.
Helps filter out noise and focus on significant trends.
Ideal for both short-term and long-term trading strategies.
Multi-Timeframe Analysis:
Allows users to select different resolutions for deeper insights.
Ensures compatibility with various trading styles and preferences.
Comprehensive Support and Resistance Calculation:
Computes four distinct levels: Support Level 1, Support Level 2, Resistance Level 1, and Resistance Level 2.
Each level serves as a reference point for potential price reversals or continuations.
Gradient Color Visualization:
Employs a spectrum of colors derived from RSI values to represent support and resistance lines.
Enhances readability and helps traders quickly assess market sentiment 🎨.
Dynamic Labels and Alerts:
Automatically generates buy ('Buy') and sell ('Sell') labels when price crosses key levels.
Provides real-time alerts for crossing events, ensuring traders never miss important signals 🔔.
Customizable Parameters:
Offers adjustable Length and Resolution inputs for tailored performance.
Allows traders to fine-tune the indicator according to their unique needs and strategies.
HOW TO USE
Adding the Indicator:
Open your TradingView chart and navigate to the indicators list.
Search for ' L2 MTF Heikin-Ashi SR Levels' and add it to your chart.
Configuring Settings:
Adjust the Length parameter to determine the period over which calculations are made.
A shorter length increases sensitivity, while a longer length smoothens the output.
Choose a specific Resolution to analyze different timeframes simultaneously.
For example, set it to 'D' for daily charts or 'W' for weekly charts.
Interpreting the Chart:
Observe the plotted support and resistance lines on the chart.
Look for price interactions with these levels to identify potential entry and exit points.
Pay attention to the gradient colors, which reflect underlying market momentum.
Setting Up Alerts:
Configure alerts based on the generated signals to receive instant notifications.
Customize alert messages and conditions to suit your trading plan.
Utilizing Labels:
Use the automatically placed buy and sell labels as quick references for decision-making.
Combine these labels with other technical analyses for confirmation.
Backtesting and Optimization:
Thoroughly test the indicator on historical data to evaluate its performance.
Optimize settings and refine your strategy based on backtest results.
Live Trading:
Apply the indicator to live charts and monitor real-time price movements.
Execute trades based on the generated signals and adjust positions accordingly.
Combining with Other Tools:
Integrate this indicator with other technical tools and fundamental analyses for a holistic approach.
Consider using moving averages, oscillators, or volume indicators alongside L2 MTF Heikin-Ashi SR Levels.
LIMITATIONS
Market Volatility:
In highly volatile or ranging markets, the indicator might produce false signals due to erratic price movements 🌪️.
Traders should exercise caution during such periods and consider additional confirmations.
Timeframe Dependency:
The effectiveness of the indicator can vary significantly depending on the chosen timeframe and asset.
Always validate the indicator's performance across different contexts before relying solely on it.
Over-reliance Risk:
While powerful, no single indicator guarantees success in all market conditions.
Combining this tool with other analytical methods enhances reliability and reduces risk.
NOTES
Data Requirements:
Ensure your chart has enough historical data to perform accurate calculations.
Insufficient data may lead to inaccurate or incomplete results.
Demo Testing:
Before deploying the indicator in live trading, conduct extensive testing on demo accounts.
Familiarize yourself with how the indicator behaves under various market scenarios.
Parameter Tuning:
Experiment with different Length and Resolution settings to find what works best for your trading style.
Regularly review and update parameters as market conditions evolve.
Continuous Learning:
Stay updated with the latest developments in technical analysis and trading strategies.
Adapt your use of the indicator based on new insights and experiences.
THANKS
Additionally, gratitude goes to the broader TradingView community for fostering collaboration and knowledge-sharing among traders worldwide. Together, we strive to elevate our understanding and application of financial markets 🌍💡.
Volume Weighted Median Price (VWMP)The volume is indeed crucial for confirming price moves and understanding market conviction. While many traders are familiar with VWAP (Volume Weighted Average Price), this indicator introduces a lesser-known but powerful cousin: the Volume Weighted Median Price (VWMP).
What is VWMP?
Unlike VWAP, which calculates the average price weighted by volume over a period, VWMP identifies the median price level weighted by volume.
Think of it this way: If you line up all the trades within a specific lookback period, sorted by price, and then start accumulating the volume traded at each price level, the VWMP is the price level where 50% of the total volume occurred below it, and 50% occurred above it.
It essentially finds the "middle ground" of trading activity based on where the bulk of the volume actually traded, not just the average price.
Key Difference: VWMP vs. VWAP
VWAP: Volume Weighted Average Price. Sensitive to outliers (single large trades at extreme prices can skew the average).
VWMP: Volume Weighted Median Price. More robust to outliers. It represents the price that splits the period's volume distribution in half.
Because it uses the median, VWMP can sometimes provide a more stable or representative level of the "typical" price where significant volume is changing hands, especially in volatile markets or when large, anomalous trades occur.
How to Interpret and Use VWMP in trading
The VWMP plots as a line on your chart, similar to a moving average or VWAP. Here are a few ways traders might use it:
Dynamic Support and Resistance:
Like VWAP, the VWMP line can act as a dynamic level of interest.
Watch how price interacts with the VWMP. Consistent acceptance above VWMP might suggest bullish control and potential support.
Consistent rejection or acceptance below VWMP might indicate bearish control and potential resistance.
Trend Filter / Confirmation:
Uptrend: Look for price consistently staying above the VWMP line. Pullbacks to the VWMP that hold could offer entry opportunities.
Downtrend: Look for price consistently staying below the VWMP line. Rallies to the VWMP that fail could present shorting opportunities.
Use it to filter trades: Only take long trades if price is above VWMP, and short trades if below.
Mean Reversion Potential (Use with Caution):
When price extends significantly far away from the VWMP, some traders might look for potential reversion back towards this volume-based median level.
Important: This should not be used in isolation. Always look for confirmation from other indicators (like RSI, Stochastics, or candlestick patterns) before trading counter-trend reversions.
Confluence with Other Indicators:
VWMP works best when combined with other analysis tools.
Look for confluence: Does the VWMP align with a key Fibonacci level, a standard moving average, or a prior support/resistance zone? This confluence strengthens the level's potential significance.
Considerations
Lookback Period: The length input is crucial. A shorter period makes VWMP more responsive to recent action; a longer period makes it smoother and reflects longer-term volume distribution. Experiment to find what suits your timeframe and trading style.
Lagging Nature: Like all indicators based on past data, VWMP is inherently lagging. It reflects past volume distribution, not the future.
Market Context: Its effectiveness can vary depending on the market conditions (trending vs. ranging) and the asset being traded.
Sweep Reversal 5M PRO – by [TuNombre]🔹 **Sweep Reversal 5M PRO – by ** 🔹
This indicator is built to detect high-probability *Institutional Sweeps* using Swing Failure Patterns (SFP), fully filtered with Smart Money Concepts (SMC) logic and volume confirmation.
✅ Identifies key liquidity grabs
✅ Confirms with strong impulse candle + increasing volume
✅ Filters out false signals (doji, weak zones, low volume)
✅ Optimized for the 5-minute timeframe (5M)
✅ Compatible with push alerts to your mobile
---
**How to use it:**
1. Wait for a “BUY” or “SELL” signal on the chart
2. Only enter if the next candle confirms with momentum
3. Place a tight stop just beyond the sweep
4. Recommended Take Profit: 1:1 minimum / 2:1 ideal
---
💡 Inspired by institutional trading (SMC, ICT-style setups)
🔒 Developed by – private or team-based use
📲 Activate alerts to get real-time trade opportunities on your phone
---
⚠️ This script does not repaint.
Built for serious traders who want precision, not noise.
MACD + Scaled DoubleCCIDouble CCI Histo on top, MacD histo on bottom. Long when both sides are green, short when both sides are red.
Fighter
FF
THE WINNER
CHICKEN DINNER!
CryptoQuebec Suite// This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
// Crypto Quebec & StefB.
//@version=6
indicator("CryptoQuebec Suite", overlay = true, max_labels_count = 500, max_lines_count = 500, max_boxes_count = 500, max_bars_back = 500)
//strategy("UT BOT Amélioré pour le Day Trading Crypto", overlay=true, initial_capital=1000, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
// Version 2.0 order block ajustable colors
// Version 2.1 draw swing High/low
// Version 2.2 Changed the wording of "Area of interest" for "Premium Zone" and "Discount Zone"
// Version 2.3 Added the price to the auto fib levels.
// Version 2.4 Correction. Added 3 digits after the dot of the auto fib. This was lost when the price has been added.
// Version 2.4.01 Added few fib levels. (0, -0.272, -0.414, -0.618).
// Version 2.4.02 Added few fib levels. (1, 1.272, 1.414, 1.618).
// Version 2.4.03 Made a small change in the label of 240L, 240H, DL and DH. Change 240 for 4h and H/L for Lo/Hi
// Version 2.4.04 Added digits after the dot for more price precision into the Fib levels.
// Version 2.4.05 Added Entry long/short indicator base on EMA. Also added the trailing stop line.
// Version 2.4.06 Added Trail Stop enable/disable option. Moved the Buy/Sell label farther from the candles.
// Version 2.4.07 Added Trend info table with active trading session
// Version 2.4.08 Small adjustment in the trend table and FIB lines more visible.
// Version 2.4.09 Changed the indicator name for CryptoQuebe Suite.
//---------------------------------------------------------------------------------------------------------------------
//CONSTANTS & STRINGS & INPUTS
//---------------------------------------------------------------------------------------------------------------------
BULLISH = +1
BEARISH = -1
showHighLowSwingsTooltip = 'Highlight most recent strong and weak high/low points on the chart'
bullC = input.color(defval = #14D990, title = "Bull Color", group = "Smart Money Concepts", inline = "7")
bearC = input.color(defval = #F24968, title = "Bear Color", group = "Smart Money Concepts", inline = "7")
showInt = input.bool(defval = true, title = "Show Internals", group = "Smart Money Concepts")
intSens = input.int(3, "Internals Sensitivity", options = , group = "Smart Money Concepts", inline = "20")
intStru = input.string(defval = "All", title = "Internal Structure", options = , inline = "30", group = "Smart Money Concepts")
showExt = input.bool(defval = true, title = "Show Externals" ,group = "Smart Money Concepts")
extSens = input.int(25, "Externals Sensitivity", options = ,group = "Smart Money Concepts", inline = "21")
extStru = input.string(defval = "All", title = "External Structure", options = , inline = "31", group = "Smart Money Concepts")
showOB = input.bool(defval = true, title = "Show Order Blocks" ,group = "Swing Blocks")
//----------------------------------------------
//showHighLowSwingsInput = input(true, 'Show Strong/Weak High/Low', group = "Smart Money Concepts", tooltip = showHighLowSwingsTooltip)
BullOBColor = input.color(color.new(#3179f5, 80), 'Internal Bullish OB',group = "Swing Blocks")
BearOBColor = input.color(color.new(#f77c80, 80), 'Internal Bearish OB',group = "Swing Blocks")
//---------------------------------------------------------------------------
showLast = input.int(defval = 10, title = "Swing Order Blocks", minval = 0, group = "Swing Blocks")
showHHLH = input.bool(defval = true, title = "Show HH/LH", group = "Swing Blocks")
showHLLL = input.bool(defval = true, title = "Show LH/LL", group = "Swing Blocks")
showAOE = input.bool(defval = true, title = "Show Premium/Discount", group = "Swing Blocks")
//showAOE = input.bool(defval = true, title = "Show Area of Interest", group = "Swing Blocks")
show1D = input.bool(defval = true, title = "Show Previous Day High", group = "High/Low")
show1DLab = input.bool(defval = true, title = "Show 1 Day Labels", group = "High/Low")
show4H = input.bool(defval = true, title = "Show 4 Hour High", group = "High/Low")
show4hLab = input.bool(defval = true, title = "Show 4 Hour Labels", group = "High/Low")
showFVG = input.bool(defval = true, title = "Show Fair Value Gaps", group = "FVG")
contract = input.bool(defval = false, title = "Contract Violated FVG", group = "FVG")
closeOnly = input.bool(defval = false, title = "Show Closest Up/Down FVG Only", group = "FVG")
fvgcol = input.color(defval = #F2B807, title = "FVG Color", group = "FVG")
fvgtra = input.int(defval = 80, minval = 0, maxval = 100, title = "FVG Transparency", group = "FVG")
showFibs = input.bool(defval = true, title = "Show Auto Fibs", group = "Auto Fibs")
// extSensFibs = input.int(25, "Fibs Sensitivity", options = , group = "Auto Fibs", inline = "22")
show0_618 = input.bool(defval = true, title = "", inline = "1", group = "Auto Fibs")
show0_414 = input.bool(defval = true, title = "", inline = "2", group = "Auto Fibs")
show0_272 = input.bool(defval = true, title = "", inline = "3", group = "Auto Fibs")
show0 = input.bool(defval = true, title = "", inline = "4", group = "Auto Fibs")
show236 = input.bool(defval = true, title = "", inline = "5", group = "Auto Fibs")
show382 = input.bool(defval = true, title = "", inline = "6", group = "Auto Fibs")
show5 = input.bool(defval = true, title = "", inline = "7", group = "Auto Fibs")
show618 = input.bool(defval = true, title = "", inline = "8", group = "Auto Fibs")
show65 = input.bool(defval = true, title = "", inline = "9", group = "Auto Fibs")
show786 = input.bool(defval = true, title = "", inline = "10", group = "Auto Fibs")
show1 = input.bool(defval = true, title = "", inline = "11", group = "Auto Fibs")
show1_272 = input.bool(defval = true, title = "", inline = "12", group = "Auto Fibs")
show1_414 = input.bool(defval = true, title = "", inline = "13", group = "Auto Fibs")
show1_618 = input.bool(defval = true, title = "", inline = "14", group = "Auto Fibs")
fib1 = input.float(defval = -0.618, title = "", minval = -0.618, step = 0.01, inline = "1", group = "Auto Fibs")
fib2 = input.float(defval = -0.414, title = "", minval = -0.618, step = 0.01, inline = "2", group = "Auto Fibs")
fib3 = input.float(defval = -0.272, title = "", minval = -0.618, step = 0.01, inline = "3", group = "Auto Fibs")
fib4 = input.float(defval = 0, title = "", minval = 0, step = 0.01, inline = "4", group = "Auto Fibs")
fib5 = input.float(defval = .236, title = "", minval = 0, step = 0.01, inline = "5", group = "Auto Fibs")
fib6 = input.float(defval = .382, title = "", minval = 0, step = 0.01, inline = "6", group = "Auto Fibs")
fib7 = input.float(defval = .5, title = "", minval = 0, step = 0.01, inline = "7", group = "Auto Fibs")
fib8 = input.float(defval = .618, title = "", minval = 0, step = 0.01, inline = "8", group = "Auto Fibs")
fib9 = input.float(defval = .65, title = "", minval = 0, step = 0.01, inline = "9", group = "Auto Fibs")
fib10 = input.float(defval = .786, title = "", minval = 0, step = 0.01, inline = "10", group = "Auto Fibs")
fib11 = input.float(defval = 1, title = "", minval = 0, step = 0.01, inline = "11", group = "Auto Fibs")
fib12 = input.float(defval = 1.272, title = "", minval = 0, step = 0.01, inline = "12", group = "Auto Fibs")
fib13 = input.float(defval = 1.414, title = "", minval = 0, step = 0.01, inline = "13", group = "Auto Fibs")
fib14 = input.float(defval = 1.618, title = "", minval = 0, step = 0.01, inline = "14", group = "Auto Fibs")
fib1col = input.color(title = "", defval = color.orange, inline = "1", group = "Auto Fibs")
fib2col = input.color(title = "", defval = color.orange, inline = "2", group = "Auto Fibs")
fib3col = input.color(title = "", defval = color.orange, inline = "3", group = "Auto Fibs")
fib4col = input.color(title = "", defval = color.gray, inline = "4", group = "Auto Fibs")
fib5col = input.color(title = "", defval = color.white, inline = "5", group = "Auto Fibs")
fib6col = input.color(title = "", defval = color.white, inline = "6", group = "Auto Fibs")
fib7col = input.color(title = "", defval = color.red, inline = "7", group = "Auto Fibs")
fib8col = input.color(title = "", defval = color.green, inline = "8", group = "Auto Fibs")
fib9col = input.color(title = "", defval = color.green, inline = "9", group = "Auto Fibs")
fib10col = input.color(title = "", defval = color.white, inline = "10", group = "Auto Fibs")
fib11col = input.color(title = "", defval = color.gray, inline = "11", group = "Auto Fibs")
fib12col = input.color(title = "", defval = color.orange, inline = "12", group = "Auto Fibs")
fib13col = input.color(title = "", defval = color.orange, inline = "13", group = "Auto Fibs")
fib14col = input.color(title = "", defval = color.orange, inline = "14", group = "Auto Fibs")
//---------------------------------------------------------------------------------------------------------------------
//DATA STRUCTURES & VARIABLES
//---------------------------------------------------------------------------------------------------------------------
// @type UDT representing last swing extremes (top & bottom)
// @field top last top swing price
// @field bottom last bottom swing price
// @field barTime last swing bar time
// @field barIndex last swing bar index
// @field lastTopTime last top swing time
// @field lastBottomTime last bottom swing time
type trailingExtremes
float top
float bottom
int barTime
int barIndex
int lastTopTime
int lastBottomTime
// @type UDT representing trend bias
// @field bias BULLISH or BEARISH
type trend
int bias
var bigData = map.new()
// @variable swing trend bias
var trend swingTrend = trend.new(0)
// @variable last trailing swing high and low
var trailingExtremes trailing = trailingExtremes.new()
// @variable color for swing bullish structures
var swingBullishColor = color.green //styleInput == MONOCHROME ? MONO_BULLISH : swingBullColorInput
// @variable color for swing bearish structures
var swingBearishColor = color.red //styleInput == MONOCHROME ? MONO_BEARISH : swingBearColorInput
if bigData.size() == 0
bigData.put("moving", 0)
bigData.put("upaxis", 0.0)
bigData.put("upaxis2", 0)
bigData.put("dnaxis", 0.0)
bigData.put("dnaxis2", 0)
bigData.put("upside", 1)
bigData.put("downside", 1)
= request.security(syminfo.tickerid, "1D", [high , low , high, low, time , time])
var highArr = array.new_float(), var lowArr = array.new_float()
var timeArr = array.new_int (), var volArr = array.new_float()
var closeArr = array.new_float(), var openArr = array.new_float()
highArr.unshift(high), lowArr.unshift(low)
timeArr.unshift(time), volArr.unshift(volume)
closeArr.unshift(close), openArr.unshift(open)
type rollingTF
float highTF = 0
float lowTF = 1e8
int highTFt = 0
int lowTFt = 0
float volTF = 0
map rTFdraw
map rTFlabel
// Convert time period in text
f_convert_tf_to_text(tf) =>
tf == "240" ? "H4" : tf == "1D" ? "D" : tf == "60" ? "1h" : tf == "15" ? "15m" : tf
// Create the labels fo each level
offset = 10 // Ajustez cette valeur selon le décalage souhaité
// Ajust the label position in case of overide
f_adjust_label_position(x, offset) =>
x + offset
// @function tfDraw
// @param tfDiff Specifies the timeframe difference for the high/low calculations.
// @param showRollingLab Indicates whether to display rolling labels for timeframes.
// @param tf Specifies the timeframe as a string.
// @param showLevels Determines if the high/low levels for the timeframe should be shown.
// @returns A tuple with the total volume (TFhrdata.volTF) and the rolling volume array (volRolling).
method tfDraw(int tfDiff, bool showRollingLab, string tf, bool showLevels) =>
TFhrdata = rollingTF.new(), var volRolling = array.new()
if highArr.size() > tfDiff
for i = 0 to tfDiff
if showLevels and barstate.islast
getHigh = highArr.get(i), getLow = lowArr.get(i),
getTime = timeArr.get(i)
TFhrdata.highTF := math.max(TFhrdata.highTF, getHigh)
TFhrdata.lowTF := math.min(TFhrdata.lowTF , getLow )
if TFhrdata.highTF == getHigh
TFhrdata.highTFt := timeArr.get(i)
if TFhrdata.lowTF == getLow
TFhrdata.lowTFt := timeArr.get(i)
TFhrdata.volTF += volArr.get(i)
volRolling.push(TFhrdata.volTF)
var lineDraw = rollingTF.new(rTFdraw = map.new(), rTFlabel = map.new())
if showLevels
switch lineDraw.rTFdraw.size() == 0
true => lineDraw.rTFdraw.put("High", line.new(TFhrdata.highTFt, TFhrdata.highTF, time, TFhrdata.highTF,
xloc = xloc.bar_time, color = color.aqua)),
lineDraw.rTFdraw.put("Low" , line.new(TFhrdata.lowTFt , TFhrdata.lowTF , time, TFhrdata.lowTF ,
xloc = xloc.bar_time, color = color.aqua))
=> lineDraw.rTFdraw.get("High").set_xy1(TFhrdata.highTFt, TFhrdata.highTF),
lineDraw.rTFdraw.get("High").set_xy2(time, TFhrdata.highTF),
lineDraw.rTFdraw.get("Low").set_xy1(TFhrdata.lowTFt, TFhrdata.lowTF),
lineDraw.rTFdraw.get("Low").set_xy2(time, TFhrdata.lowTF)
if showRollingLab
switch lineDraw.rTFlabel.size() == 0
true => lineDraw.rTFlabel.put("High", label.new(f_adjust_label_position(bar_index, offset), TFhrdata.highTF, xloc = xloc.bar_time, textcolor = color.aqua, text = f_convert_tf_to_text(tf) + " Hi", style = label.style_label_left, size = size.normal, color = #00000000)),
lineDraw.rTFlabel.put("Low", label.new(f_adjust_label_position(bar_index, offset), TFhrdata.lowTF, xloc = xloc.bar_time, textcolor = color.aqua, text = f_convert_tf_to_text(tf) + " Lo", style = label.style_label_left, size = size.normal, color = #00000000))
=> lineDraw.rTFlabel.get("High") .set_xy(time, TFhrdata.highTF),
lineDraw.rTFlabel.get("Low") .set_xy(time, TFhrdata.lowTF)
// @function tfDrawLower
// @param showRollingLab Indicates whether to display rolling labels for lower timeframes.
// @param tf Specifies the lower timeframe as a string.
// @param showLevels Determines if the high/low levels for the lower timeframe should be shown.
// @returns (volume and volume array)
tfDrawLower(bool showRollingLab, simple string tf, bool showLevels) =>
simple int end = switch tf
"240" => 240
"1D" => 1440
= request.security_lower_tf(syminfo.tickerid, "1", )
var oArr = array.new_float()
var hArr = array.new_float()
var lArr = array.new_float()
var cArr = array.new_float()
var vArr = array.new_float()
var tArr = array.new_int()
TFhrdata = rollingTF.new(), var volRolling = array.new()
if h.size() > 0
for i = 0 to h.size() - 1
oArr.push(o.get(i))
hArr.push(h.get(i))
lArr.push(l.get(i))
cArr.push(c.get(i))
vArr.push(v.get(i))
tArr.push(t.get(i))
if hArr.size() > end
oArr.shift()
hArr.shift()
lArr.shift()
cArr.shift()
vArr.shift()
tArr.shift()
for i = 0 to hArr.size() - 1
if showLevels
getHigh = hArr.get(i), getLow = lArr.get(i),
getTime = tArr.get(i)
TFhrdata.highTF := math.max(TFhrdata.highTF, getHigh)
TFhrdata.lowTF := math.min(TFhrdata.lowTF , getLow)
if TFhrdata.highTF == getHigh
TFhrdata.highTFt := tArr.get(i)
if TFhrdata.lowTF == getLow
TFhrdata.lowTFt := tArr.get(i)
TFhrdata.volTF += vArr.get(i)
volRolling.push(TFhrdata.volTF)
var lineDraw = rollingTF.new(rTFdraw = map.new(), rTFlabel = map.new())
if showLevels
switch lineDraw.rTFdraw.size() == 0
true => lineDraw.rTFdraw.put("High", line.new(TFhrdata.highTFt, TFhrdata.highTF, time, TFhrdata.highTF,
xloc = xloc.bar_time, color = color.aqua)),
lineDraw.rTFdraw.put("Low" , line.new(TFhrdata.lowTFt , TFhrdata.lowTF , time, TFhrdata.lowTF ,
xloc = xloc.bar_time, color = color.aqua))
=> lineDraw.rTFdraw.get("High").set_xy1(TFhrdata.highTFt, TFhrdata.highTF),
lineDraw.rTFdraw.get("High").set_xy2(time, TFhrdata.highTF),
lineDraw.rTFdraw.get("Low").set_xy1(TFhrdata.lowTFt, TFhrdata.lowTF),
lineDraw.rTFdraw.get("Low").set_xy2(time, TFhrdata.lowTF)
if showRollingLab
switch lineDraw.rTFlabel.size() == 0
true => lineDraw.rTFlabel.put("High", label.new(f_adjust_label_position(bar_index, 0), TFhrdata.highTF, xloc = xloc.bar_time, textcolor = color.aqua, text = f_convert_tf_to_text(tf) + " Hi", style = label.style_label_left, size = size.normal, color = #00000000)),
lineDraw.rTFlabel.put("Low" , label.new(f_adjust_label_position(bar_index, 0), TFhrdata.lowTF, xloc = xloc.bar_time, textcolor = color.aqua, text = f_convert_tf_to_text(tf) + " Lo", style = label.style_label_left, size = size.normal, color = #00000000))
=> lineDraw.rTFlabel.get("High") .set_xy(time, TFhrdata.highTF),
lineDraw.rTFlabel.get("Low") .set_xy(time, TFhrdata.lowTF)
var r4hrbars = math.floor(timeframe.in_seconds("240") / timeframe.in_seconds(timeframe.period))
var rDbars = math.floor(timeframe.in_seconds("1D") / timeframe.in_seconds(timeframe.period))
= switch
timeframe.in_seconds() <= 60 => r4hrbars.tfDraw(show4hLab, "240", show4H)
=> tfDrawLower(show4hLab, "240", show4H)
= switch
timeframe.in_seconds() <= 60 => rDbars.tfDraw(show1DLab, "1D", show1D)
=> tfDrawLower(show1DLab, "1D", show1D)
// @function calculatePivots
// @param length Specifies the lookback length for high/low pivot calculations.
// @returns A tuple with top and bottom swing values.
calculatePivots(length)=>
var int intraCalc = 0
if bar_index > length + 1
up = highArr.slice(0, length).max()
dn = lowArr .slice(0, length).min()
cHi = highArr.get(length)
cLo = lowArr .get(length)
intraCalc := switch
cHi > up => 0
cLo < dn => 1
=> intraCalc
topSwing = switch
intraCalc == 0 and intraCalc != 0 => cHi
=> 0
botSwing = switch
intraCalc == 1 and intraCalc != 1 => cLo
=> 0
= calculatePivots(extSens)
= calculatePivots(intSens)
var label upLabel = array.new_label(1)
var label dnLabel = array.new_label(1)
var box highBlock = array.new_box()
var box lowBlock = array.new_box()
drawChar(x, y, str, col, down) =>
style = switch down
true => label.style_label_down
=> label.style_label_up
line.new (int(x), y, bar_index, y, color = col, style = line.style_dashed)
label.new(math.round(math.avg(x, bar_index)), y, str, color = #00000000, textcolor = col, style = style, size = size.small)
// @function drawStructureExt
// @returns Counter indicating the structure direction: 1 for bullish, -1 for bearish, 0 for neutral.
drawStructureExt() =>
var int counter = 0
if bigUpper != 0
bigData.put("upside", 1)
x1 = bar_index - extSens
txt = switch bigUpper > bigData.get("upaxis")
true => 'HH'
=> 'LH'
if showHHLH
upLabel.set(0, label.new(x1, bigUpper, txt,
color = color.new(color.white, 100),
textcolor = bearC,
style = label.style_label_down,
size = size.small
))
if showOB
highBlock.push(box.new(x1, bigUpper, last_bar_index + 5, bigUpper * .998, border_color = BearOBColor, bgcolor = BearOBColor))
bigData.put("upaxis" , bigUpper)
bigData.put("upaxis2", x1)
counter := 1
if bigLower != 0
bigData.put("downside", 1)
x1 = bar_index - extSens
txt = switch bigLower < bigData.get("dnaxis")
true => "LL"
=> "HL"
if showHLLL == true
dnLabel.set(0, label.new(x1, bigLower, txt, color = #ffffff00,
textcolor = bullC,
style = label.style_label_up,
size = size.small
))
if showOB
lowBlock.push(box.new(x1, bigLower, last_bar_index + 5, bigLower * 1.002, border_color = BullOBColor, bgcolor = BullOBColor))
//border_color = color.new(color.blue, 60),//75),
//bgcolor = color.new(color.blue, 70)//95)
//))
bigData.put("dnaxis" , bigLower)
bigData.put("dnaxis2", x1)
counter := -1
if showExt
if ta.crossover(close, bigData.get("upaxis"))
if bigData.get("upside") != 0
str = switch bigData.get("moving") < 0
true => extStru != "BoS" ? 'CHoCH' : ""
=> extStru != 'CHoCH' ? 'BoS' : ""
if extStru == "All" or str.contains(extStru, str)
drawChar(bigData.get("upaxis2"), bigData.get("upaxis"), str, bullC, true)
bigData.put("upside", 0)
bigData.put("moving", 1)
if ta.crossunder(close, bigData.get("dnaxis"))
if bigData.get("downside") != 0
str = switch bigData.get("moving") > 0
true => extStru != "BoS" ? 'CHoCH' : ""
=> extStru != 'CHoCH' ? 'BoS' : ""
if extStru == "All" or str.contains(extStru, str)
drawChar(bigData.get("dnaxis2"), bigData.get("dnaxis"), str, bearC, false)
bigData.put("downside", 0)
bigData.put("moving", -1)
counter
counter = drawStructureExt()
// @function updateBox
// @param id Array of boxes to update based on the bar index.
// @returns void
method updateBox(array id) =>
if id.size() > 0
for i = 0 to id.size() - 1
id.get(i).set_right(last_bar_index + 5)
method cleanseLevel(array id, bool isHighBlock) =>
if id.size() > 0
for i = id.size() - 1 to 0
condition = switch isHighBlock
true => close >= id.get(i).get_top()
=> close <= id.get(i).get_bottom()
if condition
id.remove(i).delete()
if id.size() > showLast and showLast != 0
for i = id.size() - showLast to 0
id.remove(i).delete()
highBlock.cleanseLevel(true)
lowBlock .cleanseLevel(false)
if barstate.islast
highBlock.updateBox()
lowBlock .updateBox()
// @function updateMain
// @param id Line object for updating based on price structure pivots.
// @returns void
// @description Updates the main line indicator to match the latest high/low price levels.
method updateMain(line id) =>
hi = 0.0
lo = 1e8
if showFibs
= calculatePivots(25)
var int counterFibs = 0
if bigUpperFibs != 0
counterFibs := 1
if bigLowerFibs != 0
counterFibs := -1
if counterFibs == 1
hi := 0.0
id.set_xy1(int(bigData.get("upaxis2")), bigData.get("upaxis"))
for i = 0 to bar_index - int(bigData.get("dnaxis2"))
getLow = lowArr.get(i)
lo := math.min(getLow, lo)
if lo == getLow
id.set_xy2(bar_index - i, lo)
else if counterFibs == -1
lo := 1e8
id.set_xy1(int(bigData.get("dnaxis2")), bigData.get("dnaxis"))
for i = 0 to bar_index - bigData.get("upaxis2")
getHigh = highArr.get(i)
hi := math.max(highArr.get(i), hi)
if hi == getHigh
id.set_xy2(bar_index - i, hi)
if id.get_x2() < id.get_x1()
x2 = id.get_x2(), x1 = id.get_x1()
y2 = id.get_y2(), y1 = id.get_y1(),
id.set_xy2(x1, y1),
id.set_xy1(x2, y2)
switch id.get_y2() < id.get_y1()
true => id.set_color(#F24968)
=> id.set_color(#14D990)
0
var main = line.new(dnLabel.first().get_x(), dnLabel.first().get_y(), upLabel.first().get_x(), upLabel.first().get_y(),
style = line.style_dashed,
width = 2
)
main.updateMain()
//-----------------------------------FIB----------------------------------------------------------
// @function quickLine
// @param getX2 The x-coordinate for the endpoint of the line.
// @param y The y-coordinate for the line’s position.
// @param color The color of the line to be drawn.
// @returns void
// @description Draws a horizontal line on the chart with specific attributes.
quickLine(getX2, y, color) =>
line.new(getX2, y, bar_index + 5, y, color = color.new(color, 50))
// @function quickLabel
// @param y The y-coordinate for the label’s position.
// @param txt Text content of the label.
// @param color The text color of the label.
// @returns void
// @description Places a label with given text and color at a specified y-coordinate.
quickLabel(y, txt, color) =>
label.new(bar_index + 5, y, text = str.tostring(txt), color = #00000000, style = label.style_label_left, textcolor = color)
// @function drawFibs
// @returns void
// @description Draws Fibonacci retracement levels based on recent price action.
drawFibs() =>
if barstate.islast
var fibLine = array.new(14)
var fibLab = array.new(14)
if fibLine.size() > 0
for i = 0 to fibLine.size() - 1
fibLine .get(i).delete()
fibLab .get(i).delete()
if showFibs
getY2 = main.get_y2(), sub = main.get_y1() - getY2,
getX1 = main.get_x1(), getX2 = main.get_x2()
for i = 0 to fibLine.size() - 1
mod = i % fibLine.size() - 1
= switch mod
0 =>
1 =>
2 =>
3 =>
4 =>
5 =>
6 =>
7 =>
8 =>
9 =>
10 =>
11 =>
12 =>
13 =>
fibLine.set(i, quickLine (getX2, y, col))
// Combine text level and price
priceLabel = str.tostring(y, "#.#####")
combinedText = txt + " (" + priceLabel + ")" // Prix entre parenthèses
fibLab.set(i, quickLabel(y, combinedText, col))
drawFibs()
// @function drawStructureInternals
// @returns void
// @description Draws internal structures for smaller price swings based on user-defined settings.
drawStructureInternals() =>
if showInt
var keyValues = map.new()
if keyValues.size() == 0
keyValues.put("movingSmall", 0)
if smallUpper != 0
keyValues.put("upsideSmall", 1)
keyValues.put("upaxisSmall", smallUpper)
keyValues.put("upaxis2Small", bar_index - intSens)
if smallLower != 0
keyValues.put("downsideSmall", 1)
keyValues.put("dnaxisSmall", smallLower)
keyValues.put("dnaxis2Small", bar_index - intSens)
if ta.crossover(close, keyValues.get("upaxisSmall"))
if keyValues.get("upsideSmall") != 0
str = switch
keyValues.get("movingSmall") < 0 => intStru != "BoS" ? 'I-CHoCH' : ""
=> intStru != "CHoCH" ? 'I-BoS' : ""
if intStru == "All" or str.contains(str, intStru)
drawChar(keyValues.get("upaxis2Small"), keyValues.get("upaxisSmall"), str, bullC, true)
keyValues.put("upsideSmall", 0)
keyValues.put("movingSmall", 1)
if ta.crossunder(close, keyValues.get("dnaxisSmall"))
if keyValues.get("downsideSmall") != 0
str = switch
keyValues.get("movingSmall") > 0 => intStru != "BoS" ? 'I-CHoCH' : ""
=> intStru != "CHoCH" ? 'I-BoS' : ""
if intStru == "All" or str.contains(str, intStru)
drawChar(keyValues.get("dnaxis2Small"), keyValues.get("dnaxisSmall"), str, bearC, false)
keyValues.put("downsideSmall", 0)
keyValues.put("movingSmall", -1)
drawStructureInternals()
// @function drawAOE
// @returns void
// @description Draws the Premium and Discount Zones on the chart based on recent highs and lows.
drawAOE() =>
atr = ta.atr(14)
if showAOE
if closeArr.size() > 50
aoi = closeArr.slice(0, 50)
aoi2 = openArr .slice(0, 50)
maxaoiH = math.max(aoi.max(), aoi2.max())
minaoiL = math.min(aoi.min(), aoi2.min())
var aoeLevels = map.new()
if aoeLevels.size() == 0
aoeLevels.put("High",
box.new(bar_index , maxaoiH * 1.01, bar_index + 5, maxaoiH,
border_color = #00000000,
bgcolor = color.new(#F24968, 90),
text = "Premium Zone", //"Area of Interest" ,
text_size = size.normal,//.small,
text_color = color.new(#F24968, 33)
))
aoeLevels.put("Low",
box.new(bar_index , minaoiL, bar_index + 5, minaoiL * .99,
border_color = #00000000,
bgcolor = color.new(#14D990, 90),
text = "Discount Zone", //"Area of Interest" ,
text_size = size.normal,//size.small,
text_color = color.new(#14D990, 33)
))
getHighBox = aoeLevels.get("High")
if close <= getHighBox.get_top() * 1.01
getHighBox.set_lefttop (bar_index , maxaoiH + atr)
getHighBox.set_rightbottom (bar_index + 5, maxaoiH)
getHighBox.set_text ("Premium Zone") //"Area of Interest")
else
getHighBox.set_lefttop (bar_index + 5, maxaoiH + atr)
getHighBox.set_rightbottom (bar_index + 5, maxaoiH + atr)
getHighBox.set_text ("")
getLowBox = aoeLevels.get("Low")
if close >= getLowBox.get_bottom() * .99
getLowBox.set_lefttop (bar_index , minaoiL)
getLowBox.set_rightbottom (bar_index + 5, minaoiL - atr)
getLowBox.set_text ("Discount Zone") //"Area of Interest")
else
getLowBox.set_lefttop (bar_index + 5, minaoiL)
getLowBox.set_rightbottom (bar_index + 5, - atr)
getLowBox.set_text ("")
drawAOE()
var table tab2 = table.new(position.top_right, 13, 13, bgcolor = #20222C, border_color = #363843, frame_color = #363843, border_width = 1, frame_width = 1)
nyHour = hour (timenow, "America/New_York")
nyMinute = minute(timenow, "America/New_York")
// @function fvg
// @param direction Determines the direction for fair value gap (FVG) detection: positive for up, negative for down.
// @returns An array of FVG boxes in the specified direction.
// @description Identifies fair value gaps (FVGs) and stores them in an array of boxes for visual representation.
fvg(direction) =>
var fvgMat = matrix.new(5), var fvgDrawings = array.new()
fvgMat.add_col(0, array.from(math.sign(close - open), close, high, low, time))
if fvgMat.columns() > 3
fvgMat.remove_col(fvgMat.columns() - 1)
if fvgMat.row(0).sum() == direction
getDir = math.sign(direction)
= switch getDir
-1 =>
=>
col = switch closeOnly
true => #00000000
=> color.new(fvgcol, fvgtra)
fvgDrawings.push(
box.new(int(fvgMat.get(4, 1)),y, last_bar_time, y1, xloc = xloc.bar_time,
border_color = col, bgcolor = col)
)
fvgDrawings
if showFVG
fvgDn = fvg(-3)
fvgUp = fvg(3)
if fvgDn.size() > 0
for i = fvgDn.size() - 1 to 0
getfvg = fvgDn.get(i)
if high >= getfvg.get_top()
getfvg.delete()
fvgDn.remove(i)
else if contract
if high > getfvg.get_bottom()
getfvg.set_bottom(high)
if fvgUp.size() > 0
for i = fvgUp.size() - 1 to 0
getfvg = fvgUp.get(i)
if low <= getfvg.get_bottom()
getfvg.delete()
fvgUp.remove(i)
else if contract
if low < getfvg.get_top()
getfvg.set_top(low)
if closeOnly and barstate.islast
minDist = matrix.new(1, 2, 20e20)
if fvgDn.size() > 0
for i = fvgDn.size() - 1 to 0
getBottom = fvgDn.get(i).get_bottom()
minDist.set(0, 1, math.min(minDist.get(0, 1), math.abs(close - getBottom)))
if math.abs(close - getBottom) == minDist.get(0, 1)
minDist.set(0, 0, i)
fvgDn.get(i).set_right(fvgDn.get(i).get_left())
fvgDn.get(int(minDist.get(0, 0))).set_bgcolor(color.new(fvgcol, fvgtra))
fvgDn.get(int(minDist.get(0, 0))).set_border_color(color.new(fvgcol, fvgtra))
fvgDn.get(int(minDist.get(0, 0))).set_right(last_bar_time)
minDist.set(0, 0, 0)
minDist.set(0, 1, 20e20)
if fvgUp.size() > 0
for i = fvgUp.size() - 1 to 0
getTop = fvgUp.get(i).get_top()
minDist.set(0, 1, math.min(minDist.get(0, 1), math.abs(close - getTop)))
if math.abs(close - getTop) == minDist.get(0, 1)
minDist.set(0, 0, i)
fvgUp.get(i).set_right(fvgUp.get(i).get_left())
fvgUp.get(int(minDist.get(0, 0))).set_bgcolor(color.new(fvgcol, fvgtra))
fvgUp.get(int(minDist.get(0, 0))).set_border_color(color.new(fvgcol, fvgtra))
fvgUp.get(int(minDist.get(0, 0))).set_right(last_bar_time)
// @function calculateTimeDifference
// @param timestamp1 The starting timestamp for time difference calculation.
// @param timestamp2 The ending timestamp for time difference calculation.
// @returns A tuple containing hours and minutes as integers.
// @description Calculates the time difference between two timestamps, outputting hours and minutes.
//calculateTimeDifference(timestamp1, timestamp2) =>
// timeDifference = timestamp2 - timestamp1
// hours = math.floor(timeDifference / 3600000)
// minutes = math.floor((timeDifference % 3600000) / 60000)
//
//dayAdjustment = (hour(timenow, "America/New_York") < 2) ? dayofmonth(timenow) + 1 : dayofmonth(timenow)
//dayAdjustment2 = nyHour >= 20 or nyHour < 2 ? dayofmonth(timenow) + 1 : dayofmonth(timenow)
// @function timeIsInRange
// @param startHour The start hour of the time range.
// @param startMinute The start minute of the time range.
// @param endHour The end hour of the time range.
// @param endMinute The end minute of the time range.
// @returns Boolean indicating if the current time is within the specified range.
// @description Checks if the current time falls within a specified range based on New York timezone.
//timeIsInRange(startHour, startMinute, endHour, endMinute) =>
// (nyHour > startHour or (nyHour == startHour and nyMinute >= startMinute)) and (nyHour < endHour or (nyHour == endHour and nyMinute <= endMinute))
// = switch
// timeIsInRange(9, 30, 16, 0) =>
// timeIsInRange(20, 0, 2 , 0) =>
// timeIsInRange(3, 0, 11, 30) =>
// =>
// = calculateTimeDifference(timenow, timetilchange)
//timetilchange2 = switch
// timeIsInRange(9, 30, 16, 0) => timestamp("America/New_York", year(timenow), month(timenow), dayofmonth(timenow), 20, 0, 0)
// timeIsInRange(20, 0, 2 , 0) => timestamp("America/New_York", year(timenow), month(timenow), dayofmonth(timenow), 3, 0, 0)
// timeIsInRange(3, 0, 11, 30) => timestamp("America/New_York", year(timenow), month(timenow), dayofmonth(timenow), 9, 30, 0)
// => na
//if na(timetilchange2)
// timetilchange2 := switch
// nyHour < 9 or (nyHour == 9 and nyMinute < 30) => timestamp("America/New_York", year(timenow), month(timenow), dayofmonth(timenow), 9, 30, 0)
// nyHour < 20 or (nyHour >= 16 and nyHour < 20) => timestamp("America/New_York", year(timenow), month(timenow), dayofmonth(timenow), 20, 0, 0)
// nyHour < 3 or (nyHour >= 2 and nyHour < 3) => timestamp("America/New_York", year(timenow), month(timenow), dayofmonth(timenow), 3, 0, 0)
// => na
// = calculateTimeDifference(timenow, timetilchange2)
//method getActivity(array id, float id2) =>
// if id.size() > 0
// volPerc1 = id.percentile_nearest_rank(10)
// volPerc2 = id.percentile_nearest_rank(33)
// volPerc3 = id.percentile_nearest_rank(50)
// volPerc4 = id.percentile_nearest_rank(66)
// volPerc5 = id.percentile_nearest_rank(90)
// log.warning(str.tostring(volPerc1) + " " + str.tostring(volPerc2) + " " + str.tostring(volPerc3) + " " + str.tostring(volPerc4) + " " + str.tostring(volPerc5))
// activity = switch
// id2 <= volPerc1 => "Very Low"
// id2 <= volPerc2 => "Low"
// id2 <= volPerc3 => "Average"
// id2 <= volPerc4 => "High"
// => "Very High"
// activity
//if barstate.islast
// hr4Act = vol4hrArr.getActivity(vol4hr)
// D1Act = vol1DArr .getActivity(vol1D)
// str = str.tostring(timetilchange)
// ch = str.substring(str, str.pos(str, ".") + 1, str.length(str))
// nu = str.tonumber(ch) * 6
// nu2 = str.substring(str.tostring(nu), 0, 2)
// table.cell(tab2, 0, 2, text = "Session:" , text_color = color.white, text_halign = text.align_left)
// table.cell(tab2, 0, 3, text = "Session Close:" , text_color = color.white, text_halign = text.align_left)
// table.cell(tab2, 0, 4, text = "Next Session:" , text_color = color.white, text_halign = text.align_left)
// table.cell(tab2, 0, 5, text = "Next Session Open:" , text_color = color.white, text_halign = text.align_left)
// table.cell(tab2, 0, 6, text = "4-Hr Volume:" , text_color = color.white, text_halign = text.align_left)
// table.cell(tab2, 0, 7, text = "24-Hr Volume:" , text_color = color.white, text_halign = text.align_left)
// table.cell(tab2, 1, 2, text = stringCol , text_color = color.white)
// table.cell(tab2, 1, 3, text = stringCol != "Dead Zone" ? str.tostring(hours)+ "h" + str.tostring(minutes) + "m": "Dead Zone", text_color = color.white)
// table.cell(tab2, 1, 4, text =stringCol2, text_color = color.white)
// table.cell(tab2, 1, 5, text = str.tostring(hours2) + "h:" + str.tostring(minutes2) + "m", text_color = color.white)
// table.cell(tab2, 1, 6, text = hr4Act, text_color = color.white)
// table.cell(tab2, 1, 7, text = D1Act, text_color = color.white)
nyHour2 = hour (time, "America/New_York")
nyMinute2 = minute(time, "America/New_York")
// @function timeIsInRange2
// @param startHour The starting hour for checking the time range.
// @param startMinute The starting minute within the hour.
// @param endHour The ending hour for checking the time range.
// @param endMinute The ending minute within the hour.
// @returns Boolean indicating if the current time is within the specified range.
// @description Checks if the current chart time falls within a specified time range.
timeIsInRange2(startHour, startMinute, endHour, endMinute) =>
if endHour >= startHour
(nyHour2 > startHour or (nyHour2 == startHour and nyMinute2 >= startMinute)) and
(nyHour2 < endHour or (nyHour2 == endHour and nyMinute2 <= endMinute))
else
(nyHour2 > startHour or (nyHour2 == startHour and nyMinute2 >= startMinute)) or
(nyHour2 < endHour or (nyHour2 == endHour and nyMinute2 <= endMinute))
nyCol = input.color(defval = #f24968, title = "NY Color")
asCol = input.color(defval = #14D990, title = "Asia Color")
loCol = input.color(defval = #F2B807, title = "London Color")
tra = input.int(defval = 98, minval = 0, maxval = 100, title = "Transparency")
bgcolor(timeIsInRange2(9, 30, 16, 0) ? color.new(nyCol, tra) : na)
bgcolor(timeIsInRange2(20, 0, 2 , 0) ? color.new(asCol, tra) : na)
bgcolor(timeIsInRange2(3, 0, 11, 30) ? color.new(loCol, tra) : na)
//---------------------------------------Entry/Exit-------------------------------------------------------
// "Entry/Exit signal"
Entry_exit_ena = input.bool(defval = true, title = "Entry/Exit Signal" ,group = "Entry/exit Signal")
a = input.float(1.5, title="Key Value. 'This changes the sensitivity'", group = "Entry/exit Signal")
c = input.int(7, title="ATR Period", group = "Entry/exit Signal")
ma_length = input.int(50, minval=1, title="Période de la Moyenne Mobile", group = "Entry/exit Signal")
Trail_Stop_ENA = input.bool(defval = true, title = "Trail Stop" ,group = "Entry/exit Signal")
Trail_stop_col = input.color(title = "Trailing stop color", defval = color.yellow, group = "Entry/exit Signal")
//if Entry_exit_ena
// Paramètres de la Moyenne Mobile (Filtre de Tendance)
// Calculs de base
xATR = ta.atr(c)
nLoss = a * xATR
src = close
// Calcul de l'UT BOT Trailing Stop
var float xATRTrailingStop = 0.0
xATRTrailingStop := if src > nz(xATRTrailingStop ) and src > nz(xATRTrailingStop )
math.max(nz(xATRTrailingStop ), src - nLoss)
else if src < nz(xATRTrailingStop ) and src < nz(xATRTrailingStop )
math.min(nz(xATRTrailingStop ), src + nLoss)
else if src > nz(xATRTrailingStop )
src - nLoss
else
src + nLoss
// Calcul de la Moyenne Mobile
ma = ta.ema(close, ma_length)
// Condition de tendance
is_uptrend = close > ma
is_downtrend = close < ma
// Signaux d'achat et de vente selon le trend
buy = ta.crossover(src, xATRTrailingStop) and is_uptrend
sell = ta.crossunder(src, xATRTrailingStop) and is_downtrend
// Tracé de l'UT BOT Trailing Stop
plot(Trail_Stop_ENA ? xATRTrailingStop : na, color=buy ? color.green : sell ? color.red : Trail_stop_col, linewidth=2, title="Trailing Stop Style")
// Indication des signaux sur le graphique
if buy and Entry_exit_ena
label.new(bar_index, low, text='Buy', style=label.style_label_up, yloc=yloc.belowbar ,color=color.green, textcolor=color.white, size=size.small)
if sell and Entry_exit_ena
label.new(bar_index, high, text='Sell', style=label.style_label_down, yloc=yloc.abovebar, color=color.red, textcolor=color.white, size=size.small)
alertcondition(buy, "Buy/Long", "Buy Long")
alertcondition(sell, "Sell/Short", "Sell/Short")
// ----------------------------------------Trend table-----------------------------------------------
// Paramètres utilisateur
afficher_tableau = input.bool(true, "Afficher le tableau", group="Trend Table")
periode_ema = input.int(200, minval=1, title="Période EMA pour les tendances", group="Trend Table")
periode_ema_btc = input.int(200, minval=1, title="Période EMA pour la tendance BTC", group="Trend Table")
// Configuration des périodes de tendance avec un menu déroulant lisible
periode1 = input.string("15m", "Période de tendance 1", options= , group="Trend Table")
periode2 = input.string("1h", "Période de tendance 2", options= , group="Trend Table")
periode3 = input.string("4h", "Période de tendance 3", options= , group="Trend Table")
periode4 = input.string("Day", "Période de tendance 4", options= , group="Trend Table")
// Période de tendance pour le BTC
btc_periode_tendance = input.string("4h", "Période de tendance BTC", options= , group="Trend Table")
// Couleurs pour les tendances
color_haussier = color.green
color_baissier = color.red
// Couleurs de fond alternées pour les lignes (définies globalement)
bg_color_odd = color.new(color.gray, 90) // Gris très clair pour les lignes impaires
bg_color_even = color.new(color.gray, 70) // Gris clair pour les lignes paires
// Fonction de mapping des périodes lisibles en valeurs temporelles standard
f_mapper_periode(timeframe_lisible) =>
switch timeframe_lisible
"5m" => "5"
"15m" => "15"
"1h" => "60"
"4h" => "240"
"8h" => "480"
"12h" => "720"
"Day" => "D"
=> timeframe_lisible // Cas par défaut si aucune correspondance n'est trouvée
// Mapper les périodes sélectionnées
periode1_mapped = f_mapper_periode(periode1)
periode2_mapped = f_mapper_periode(periode2)
periode3_mapped = f_mapper_periode(periode3)
periode4_mapped = f_mapper_periode(periode4)
btc_periode_tendance_mapped = f_mapper_periode(btc_periode_tendance)
// Fonction pour déterminer la session actuelle en utilisant l'heure du graphique (UTC-5)
f_session_actuelle() =>
heure = hour(time)
minute_ = minute(time)
heure_mod = heure * 60 + minute_
sessions_actives = ""
// Définir les plages horaires des sessions en UTC-5
// Session Asie (19:00 - 04:00)
if (heure_mod >= (19 * 60) or heure_mod < (4 * 60))
sessions_actives := sessions_actives + "Asie, "
// Session Londres (03:00 - 12:00)
if (heure_mod >= (3 * 60) and heure_mod < (12 * 60))
sessions_actives := sessions_actives + "Londres, "
// Session New York (08:00 - 17:00)
if (heure_mod >= (8 * 60) and heure_mod < (17 * 60))
sessions_actives := sessions_actives + "NY, "
// Nettoyer la chaîne de caractères pour enlever la virgule finale
if (str.endswith(sessions_actives, ", "))
sessions_actives := str.substring(sessions_actives, 0, str.length(sessions_actives) - 2)
// Si aucune session n'est active
sessions_actives := sessions_actives == "" ? "Hors session" : sessions_actives
sessions_actives
session_actuelle = f_session_actuelle()
// Fonction pour calculer la tendance basée sur l'EMA sans lookahead
f_tendance(symbole, timeframe_tendance, periode_ema) =>
= request.security(symbole, timeframe_tendance, , barmerge.gaps_off, barmerge.lookahead_off)
tendance = cours > ema_valeur ? "Haussier" : "Baissier"
tendance
// Calcul de la tendance du BTC
tendance_btc = f_tendance("BINANCE:BTCUSDT", btc_periode_tendance_mapped, periode_ema_btc)
// Calcul des tendances pour les périodes spécifiées
tendance_periode1 = f_tendance(syminfo.tickerid, periode1_mapped, periode_ema)
tendance_periode2 = f_tendance(syminfo.tickerid, periode2_mapped, periode_ema)
tendance_periode3 = f_tendance(syminfo.tickerid, periode3_mapped, periode_ema)
tendance_periode4 = f_tendance(syminfo.tickerid, periode4_mapped, periode_ema)
// Fonction pour obtenir le nom du ticker actuel
f_ticker_actuel() =>
syminfo.ticker
// Obtenir le ticker actuel
ticker_actuel = f_ticker_actuel()
// Affichage du tableau
if afficher_tableau
// Création du tableau
var table mon_tableau = table.new(position=position.top_right, columns=2, rows=7, bgcolor=color.new(color.black, 0), frame_color=color.new(color.gray, 0), frame_width=1)
if barstate.isfirst
// Première colonne (libellés)
table.cell(table_id=mon_tableau, row=0, column=0, text="Session actuelle:", text_color=color.white, bgcolor=bg_color_even)
table.cell(table_id=mon_tableau, row=1, column=0, text="Tendance:", text_color=color.white, bgcolor=bg_color_odd, text_halign=text.align_right)
table.cell(table_id=mon_tableau, row=6, column=0, text="BTC (" + btc_periode_tendance + "):", text_color=color.white, text_halign=text.align_right, bgcolor=bg_color_even)
table.cell(table_id=mon_tableau, row=2, column=0, text= ticker_actuel + " (" + periode1 + "):", text_color=color.white, bgcolor=bg_color_odd)
table.cell(table_id=mon_tableau, row=3, column=0, text="(" + periode2 + "):", text_color=color.white, text_halign=text.align_right, bgcolor=bg_color_even)
table.cell(table_id=mon_tableau, row=4, column=0, text="(" + periode3 + "):", text_color=color.white, text_halign=text.align_right, bgcolor=bg_color_odd)
table.cell(table_id=mon_tableau, row=5, column=0, text="(" + periode4 + "):", text_color=color.white, text_halign=text.align_right, bgcolor=bg_color_even)
// Définir les couleurs de fond pour les cellules de tendance
trend_btc_color = tendance_btc == "Haussier" ? color.green : color.red
trend_periode1_color = tendance_periode1 == "Haussier" ? color.green : color.red
trend_periode2_color = tendance_periode2 == "Haussier" ? color.green : color.red
trend_periode3_color = tendance_periode3 == "Haussier" ? color.green : color.red
trend_periode4_color = tendance_periode4 == "Haussier" ? color.green : color.red
// Mise à jour des valeurs avec les couleurs appropriées
table.cell(table_id=mon_tableau, row=0, column=1, text=session_actuelle, text_color=color.yellow, bgcolor=bg_color_even)
table.cell(table_id=mon_tableau, row=1, column=1, text="", bgcolor=bg_color_odd)
table.cell(table_id=mon_tableau, row=6, column=1, text=tendance_btc, text_color=color.white, bgcolor=trend_btc_color)
table.cell(table_id=mon_tableau, row=2, column=1, text=tendance_periode1, text_color=color.white, bgcolor=trend_periode1_color)
table.cell(table_id=mon_tableau, row=3, column=1, text=tendance_periode2, text_color=color.white, bgcolor=trend_periode2_color)
table.cell(table_id=mon_tableau, row=4, column=1, text=tendance_periode3, text_color=color.white, bgcolor=trend_periode3_color)
table.cell(table_id=mon_tableau, row=5, column=1, text=tendance_periode4, text_color=color.white, bgcolor=trend_periode4_color)
// Optionnel : Ajouter une étiquette de débogage pour vérifier la session actuelle
// label.new(bar_index, high, text="Session: " + session_actuelle, style=label.style_label_down, color=color.blue, textcolor=color.white, size=size.small, yloc=yloc.abovebar)
M2 Global Liquidity Index [Extended + Offset]M2 Global Liquidity Index
This indicator visualizes global M2 money supply, weighted in USD, based on major economic regions.
Features:
Standard Mode: Includes M2 data from the USA, China, Eurozone, Japan, and the UK.
Extended Mode: Adds Switzerland, Canada, India, Russia, Brazil, South Korea, Mexico, and South Africa.
Offset Function: Adjustable time lag (78 or 108 days) to analyze the delayed impact of liquidity on financial markets.
Use Case:
Designed to help identify global liquidity cycles and assess potential turning points in financial markets. Rising global liquidity generally supports risk assets like equities and crypto, while declining liquidity can put downward pressure on these markets.
Technical Details:
Non-USD M2 values are converted using real-time FX rates.
All values are displayed in trillions of USD (Tn).
Note:
Not all countries release M2 data in real-time or at the same frequency. Minor delays and discrepancies may occur.
Example: