Trend Pro V2 [CRYPTIK1]Introduction: What is Trend Pro V2?
Welcome to Trend Pro V2! This analysis tool give you at-a-glance understanding of the market's direction. In a noisy market, the single most important factor is the dominant trend. Trend Pro V2 filters out this noise by focusing on one core principle: trading with the primary momentum.
Instead of cluttering your chart with confusing signals, this indicator provides a clean, visual representation of the trend, helping you make more confident and informed trading decisions.
The dashboard provides a simple, color-coded view of the trend across multiple timeframes.
The Core Concept: The Power of Confluence
The strength of any trading decision comes from confluenceโwhen multiple factors align. Trend Pro V2 is built on this idea. It uses a long-term moving average (200-period EMA by default) to define the primary trend on your current chart and then pulls in data from three higher timeframes to confirm whether the broader market agrees.
When your current timeframe and the higher timeframes are all aligned, you have a state of "confluence," which represents a higher-probability environment for trend-following trades.
Key Features
1. The Dynamic Trend MA:
The main moving average on your chart acts as your primary guide. Its color dynamically changes to give you an instant read on the market.
Teal MA: The price is in a confirmed uptrend (trading above the MA).
Pink MA: The price is in a confirmed downtrend (trading below the MA).
The moving average changes color to instantly show you if the trend is bullish (teal) or bearish (pink).
2. The Multi-Timeframe (MTF) Trend Dashboard:
Located discreetly in the bottom-right corner, this dashboard is your window into the broader market sentiment. It shows you the trend status on three customizable higher timeframes.
Teal Box: The trend is UP on that timeframe.
Pink Box: The trend is DOWN on that timeframe.
Gray Box: The price is neutral or at the MA on that timeframe.
How to Use Trend Pro V2: A Simple Framework
Step 1: Identify the Primary Trend
Look at the color of the MA on your chart. This is your starting point. If it's teal, you should generally be looking for long opportunities. If it's pink, you should be looking for short opportunities.
Step 2: Check for Confluence
Glance at the MTF Trend Dashboard.
Strong Confluence (High-Probability): If your main chart shows an uptrend (Teal MA) and the dashboard shows all teal boxes, the market is in a strong, unified uptrend. This is a high-probability environment to be a buyer on dips.
Weak or No Confluence (Caution Zone): If your main chart shows an uptrend, but the dashboard shows pink or gray boxes, it signals disagreement among the timeframes. This is a sign of market indecision and a lower-probability environment. It's often best to wait for alignment.
Here, the daily trend is down, but the MTF dashboard shows the weekly trend is still upโa classic sign of weak confluence and a reason for caution.
Best Practices & Settings
Timeframe Synergy: For best results, use Trend Pro on a lower timeframe and set your dashboard to higher timeframes. For example, if you trade on the 1-hour chart, set your MTF dashboard to the 4-hour, 1-day, and 1-week.
Use as a Confirmation Tool: Trend Pro V2 is designed as a foundational layer for your analysis. First, confirm the trend, then use your preferred entry method (e.g., support/resistance, chart patterns) to time your trade.
This is a tool for the community, so feel free to explore the open-source code, adapt it, and build upon it. Happy trading!
For your consideration @TradingView
Cari dalam skrip untuk "mtf"
Supertrend + MACD with Advanced FiltersDetailed Guide
1. Indicator Overview
Purpose:
This enhanced indicator combines Supertrend and MACD to signal potential trend changes. In addition, it now includes several extra filters for more reliable signals:
Multi-Timeframe (MTF) Confirmation: Checks a higher timeframeโs trend.
ADX (Momentum) Filter: Ensures the market is trending strongly.
Dynamic Factor Adjustment: Adapts the Supertrend sensitivity to current volatility.
Volume Filter: Verifies that current volume is above average.
Each filter can be enabled or disabled according to your preference.
How It Works:
The Supertrend calculates dynamic support/resistance levels based on ATR and an adjustable factor, while MACD identifies momentum shifts via its crossovers. The additional filters then confirm whether the conditions meet your criteria for a trend change. If all enabled filters align, the indicator plots a shape and triggers an alert.
2. Supertrend Component with Dynamic Factor
Base Factor & ATR Period:
The Supertrend uses these inputs to compute its dynamic bands.
Dynamic Factor Toggle:
When enabled, the factor is adjusted by comparing the current ATR to its simple moving average. This makes the indicator adapt to higher or lower volatility conditions, helping to reduce false signals.
3. MACD Component
Parameters:
Standard MACD settings (Fast MA, Slow MA, Signal Smoothing) determine the responsiveness of the MACD line. Crossovers between the MACD line and its signal line indicate potential trend reversals.
4. Multi-Timeframe (MTF) Filter
Function:
If enabled, the indicator uses a higher timeframeโs simple moving average (SMA) to confirm the prevailing trend.
Bullish Confirmation: The current close is above the higher timeframe SMA.
Bearish Confirmation: The current close is below the higher timeframe SMA.
5. ADX Filter (Momentum)
Custom Calculation:
Since the built-in ta.adx function may not be available, a custom ADX is calculated. This involves:
Determining positive and negative directional movements (DMs).
Smoothing these values to obtain +DI and -DI.
Calculating the DX and then smoothing it to yield the ADX.
Threshold:
Only signals where the ADX exceeds the set threshold (default 20) are considered valid, ensuring that the market is trending strongly enough.
6. Volume Filter
Function:
Checks if the current volume exceeds the average volume (SMA) multiplied by a specified factor. This helps confirm that a price move is supported by sufficient trading activity.
7. Combined Signal Logic & Alerts
Final Signal:
A bullish signal is generated when:
MACD shows a bullish crossover,
Supertrend indicates an uptrend,
And all enabled filters (MTF, ADX, volume) confirm the signal.
The bearish signal is generated similarly in the opposite direction.
Alerts:
Alert conditions are set so that TradingView can notify you via pop-up, email, or SMS when these combined conditions are met.
8. User Adjustments
Toggle Filters:
Use the on/off switches for MTF, ADX, and Volume filters as needed.
Parameter Tuning:
Adjust the ATR period, base factor, higher timeframe settings, ADX period/threshold, and volume multiplier to match your trading style and market conditions.
Backtesting:
Always backtest your settings to ensure that they perform well with your strategy.
Linear Regression Channel 200โโOVERVIEW
This a simplified version of linear regression channel which use length 200 instead of traditional length 100.
โโFEATURES
Color change depends light / dark mode.
โโLIMITATIONS
Limited to source of closing price and max bars back is 1500.
โโSIMILAR
Regression Channel Alternative MTF
Regression Channel Alternative MTF V2
Modified QQE-ZigZag [Non Repaint During Candle Building]V V V V V V V Please Read V V V V V V V
I ask Peter and he is fine, that im published this script
Tell me if you have some ideas or criticism about that sricpt
>>>>>>>>>> This is a modified Version of Peter_O's Momentum Based ZigZag <<<<<<<<<<<
This is only a test, and i want to share it with the community
It works like other ZigZags
Because Peters_O's original Version is only non repaint on closed historical Data ,
during a Candle building process it can still repaint (signal appears / 21 seconds later signal disapears / 42 seconds later signal appears again in the same candle / etc.),
but that isnt important for backtesting, its only important for realtime PivotPoints during a candle.
My goal for this zigzag was to make it absolute non repaint neither during a candle building process (current candle),
so once the signal is shown there is no chance that it disapers and shown a few seconds later again on that same candle, it can only show up one time per candle an thats it,
and that makes it absolute non repaint in all time frames.
Credits to:
==> Thanks to @glaz , for bringing the QQE to Tradingview <3
==> Thanks to @Peter_O , for sharing his idea to use the QQE as base for a Zigzag
and for sharing his MTF RSI with the Community <3
Changes:
- I changed the MTF RSI a little bit, you can choose between two version
- I changed the QQE a little bit, its now using the MTF RSI , and its using High and Low values as Source to make it absolute non repaint during a candle is building
- I added a little Divergence Calculation beween price and the MTF RSI that is used for the ZigZag
Colors :
- Green for HH / HL Continuation
- Red for LL / LH Continuation
- Yellow for Positive Divergence
- Purple for Negative Divergence
Important:
It is not possible to backtest this script correctly with historical Data, its only possible in Realtime,
because the QQE is using crossunders with RSILowSource and the QQE Line to find the Tops and,
because the QQE is using crossovers with RSIHighSource and the QQE Line to find the Bottoms,
and that means it is not possible to find the correct Time/Moment when that crossovers / crossunders happens in historical Data
=============> So please be sure you understand the Calculation and Backtest it in Realtime when you want to use it,
because i didn't published this script for real trading
=============> Im not a financial advisor and youre using this script at your own risk
=============> Please do your own research
Joint Conditions Strategy Suite + TradingConnector alerts bot"Please give us combined alerts with the possibility of having several conditions in place to trigger the alert." - was the top voted request from users under one of the recent blogposts by TradingView.
Ask and you shall receive ;)
TradingView is a great platform, with unmatched set of functionalities, yet this particular combo of features indeed seems not to be in place. Fortunately, TradingView is also very open platform, thanks to PineScript coding language, which enables developing combos like the requried one and plenty of other magic.
I have already published numerous "educational" scripts, showing how to code indicators and alerts with PineScript, but... this is not one of them. This one is for real. READY FOR USE on real markets, also by the non-coding traders. Just take my script, set parameters with dropdowns, backtest the strategy, fire the alerts and execute them.
HOW TO USE IT
In "Settings" popup I tried to mimic the CreateAlert popup dropdowns for selecting logic. Let's say you want to enter Long position at Stochastic KxD crossover. In first line of Long Entry conditions set "StochK" + "Crossing Up" + "StochD". Last field doesn't matter because in 3rd dropdown something else than "value" was selected. In second line you could set "maB" + "Greater Than" + "maC" to filter out those entries which are in direction of the uptrend. And yeah, add ADX>25 to make sure the market is actually moving: "ADX" + "Greater Than" + "value" + "25". All condition lines must be TRUE (or skipped) for the entry to be triggered. Toghether with an alert.
The same for Short entries. Combinations are limitless.
INDICATORS AND MTF (MULTI-TIMEFRAME)
In those dropdowns you can select candle values like open/close/high/low/ohlc4, but also some most popular indicators, which I have pre-built into this script: RSI, various Moving Averages, ADX-DMI, Stochastic and Bollinger Bands for start. You can configure parameters of those indicators also in "Settings" popup, in "Indicator Definitions" section. What's important, you can use any of these indicators from higher timeframe, setting MTF multiplier. So if you applied this indicator to 1h chart, but want to use rsi(close,14) from 4h chart, set MTF to 4. If you want to use current timeframe indicators, keep MTF at 1, which is a default setting here.
Note for coders: to keep focus of this script on joining conditions, entire logic for those indicators has been moved to external library, also open source. I encourage you to dig into the code and see how it's done. I love the addition of libraries concept in PineScript.
CUSTOM INDICATOR
Following the "openness" spirit of my master - which is TradingView itself - my work is also open, in 2 ways:
1. This script is open source. So you can grab it, modify or add any functionalities you want. I cannot and don't want to stop you from doing that. I'm asking for only one favor - please mention this source script in your credits.
2. You can import the plot (series) from any other indicator on TradingView. In Settings popup of my script, scroll down to "Indicator Definitions" section, and select the series of your choice in the first dropdown. Now it is ready to use in conditions dropdowns on top of the Settings popup.
Let me give you an example of that last scenario. Take another script of mine, "Pivot Points on SR lines DEMO". You can find it in "Indicators & Strategies" library or here: (). Attach it to your chart. Now come back to THIS script, open Settings popup and in "Custom Indicator aka Imported Source" select "Pivot Points on SR lines: ...". The way it works - it detects if a pivot point happened on Support/Resistance line from the past and returns 1 for PivotLow and -1 for Pivot High. Now in first Long Entry condition set: "custom indicator" + "Greater Than" + "value" + "0" and long entries will be marked on every pivot low noticed on Support/Resistance line.
ALERTS
Last but not least - the alerts. This script produces alerts on the entries calculated by strategy logic, as marked on the chart by the backtester. Moreover, syntax of those alerts is already prepared and fully compatible with TradingConnector - alerts executing tool (bot), if you want to auto-execute those trades. Apart from installing the tool, you need to set
up the alerts in TradingView, here is how:
open CreateAlert popup
in first dropdown select "Joint Conditions Strategy Template"
in second dropdown select "alert() function calls only"
And that's all. You only need to set one alert for the whole script, not one for Longs and one for Shorts as it was in the past. Also, you don't need to setup closing alerts, because stop-loss/take-profit/trailing-stop information is embedded in the entry alert so your broker receives it as early as possible. Alerts sent will look like this: "long sl=40 tp=80", which is exactly what TradingConnector expects.
Phew, that's all folks. If you think I should add something to this template (maybe other indicators?) please let me know in comments or via DM. Happy trading!
P.S. Pyramiding is not supported in this script.
Disclaimer : I'm not saying above combination of conditions will make you money. Actually none of this can be considered financial advice. It is only a software tool. Use it wisely, be aware of the risk and do your own research!
_CM_Ultimate_MA_MTF_V4***For a Detailed Video Overview Showing all of the Settings...
Click HERE to View Video
New _CM_Ultimate_MA_MTF_V4 - Update - 08-24-2021
Thanks to @SKTennis for help with code
Added Ability to Plot 1 or 2 Moving Averages - Fast MA & Slow MA
Added Ability to Plot Fast MA with Multi TimeFrame
Added Ability to Plot Slow MA with Multi TimeFrame
Added Ability to Color Fast MA Based on Slope of MA
Added Ability to Color Fast MA based on being Above/Below Slow MA
Added Ability to Plot 8 Types of Moving Averages
Simple, Exponential, Weighted, Hull, VWMA, RMA, TEMA, & Tilson T3
Added Ability to Set Alerts Based on:
Slope Change in the Fast MA Or Fast MA Crossing Above/Below Slow MA.
Added Ability to Plot "Fill" if Both Moving Averages are Turned ON
Added Ability to control Transparency of Fill
Added Alerts to Settings Pane.
Customized how Alerts work. Must keep Checked in Settings Pane, and When you go to Alerts Panel, Change Symbol to Indicator (_CM_Ultimate_MA_MTF_V4)
Customized Alerts to Show Symbol, TimeFrame, Closing Price, & Moving Average Signal Name in Alert
Alerts are Pre-Set to only Alert on Bar Close
See Video for Detailed Overview
New Updates Coming Soon!!!
***Please Post Feedback and Any Feature Requests in the Comments Section Below***
Relative Volume at Timeโโ OVERVIEW
This indicator calculates relative volume, which is the ratio of present volume over an average of past volume.
It offers two calculation modes, both using a time reference as an anchor.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโ CONCEPTS
Calculation modes
The simplest way to calculate relative volume is by using the ratio of a bar's volume over a simple moving average of the last n volume values.
This indicator uses one of two, more subtle ways to calculate both values of the relative volume ratio: current volume:past volume .
The two calculations modes are:
โ1 โ Cumulate from Beginning of TF to Current Bar where:
โโโ current volume = the cumulative volume since the beginning of the timeframe unit, and
โโโ past volume = the mean of volume during that same relative period of time in the past n timeframe units.
โ2 โ Point-to-Point Bars at Same Offset from Beginning of TF where:
โโโ current volume = the volume on a single chart bar, and
โโโ past volume = the mean of volume values from that same relative bar in time from the past n timeframe units.
Timeframe units
Timeframe units can be defined in three different ways:
โ1 โ Using Auto-steps, where the timeframe unit automatically adjusts to the timeframe used on the chart:
โโโโโ A 1 min timeframe unit will be used on 1sec charts,
โโโโโ 1H will be used for charts at 1min and less,
โโโโโ 1D will be used for other intraday chart timeframes,
โโโโโ 1W will be used for 1D charts,
โโโโโ 1M will be used for charts at less than 1M,
โโโโโ 1Y will be used for charts at greater or equal than 1M.
โ2 โ As a fixed timeframe that you define.
โ3 โ By time of day (for intraday chart timeframes only), which you also define. If you use non-intraday chart timeframes in this mode, the indicator will switch to Auto-steps.
Relative Relativity
A relative volume value of 1.0 indicates that current volume is equal to the mean of past volume , but how can we determine what constitutes a high relative volume value?
The traditional way is to settle for an arbitrary threshold, with 2.0 often used to indicate that relative volume is worthy of attention.
We wanted to provide traders with a contextual method of calculating threshold values, so in addition to the conventional fixed threshold value,
this indicator includes two methods of calculating a threshold channel on past relative volume values:
โ1 โ Using the standard deviation of relative volume over a fixed lookback.
โ2 โ Using the highs/lows of relative volume over a variable lookback.
Channels calculated on relative volume provide meta-relativity, if you will, as they are relative values of relative volume.
โโ FEATURES
Controls in the "Display" section of inputs determine what is visible in the indicator's pane. The next "Settings" section is where you configure the parameters used in the calculations. The "Column Coloring Conditions" section controls the color of the columns, which you will see in three of the five display modes available. Whether columns are plotted or not, the coloring conditions also determine when markers appear, if you have chosen to show the markers in the "Display" section. The presence of markers is what triggers the alerts configured on this indicator. Finally, the "Colors" section of inputs allows you to control the color of the indicator's visual components.
Display
Five display modes are available:
โโข Current Volume Columns : shows columns of current volume , with past volume displayed as an outlined column.
โโข Relative Volume Columns : shows relative volume as a column.
โโข Relative Volume Columns With Average : shows relative volume as a column, with the average of relative volume.
โโข Directional Relative Volume Average : shows a line calculated using the average of +/- values of relative volume.
โโThe positive value of relative volume is used on up bars; its negative value on down bars.
โโข Relative Volume Average : shows the average of relative volume.
A Hull moving average is used to calculate the average used in the three last display modes.
You can also control the display of:
โโข The value or relative volume, when in the first three display modes. Only the last 500 values will be shown.
โโข Timeframe transitions, shown in the background.
โโข A reminder of the active timeframe unit, which appears to the right of the indicator's last bar.
โโข The threshold used, which can be a fixed value or a channel, as determined in the next "Settings" section of inputs.
โโข Up/Down markers, which appear on transitions of the color of the volume columns (determined by coloring conditions), which in turn control when alerts are triggered.
โโข Conditions of high volatility.
Settings
Use this section of inputs to change:
โโข Calculation mode : this is where you select one of this indicator's two calculation modes for current volume and past volume , as explained in the "Concepts" section.
โโข Past Volume Lookback in TF units : the quantity of timeframe units used in the calculation of past volume .
โโข Define Timeframes Units Using : the mode used to determine what one timeframe unit is. Note that when using a fixed timeframe, it must be higher than the chart's timeframe.
โโAlso, note that time of day timeframe units only work on intraday chart timeframes.
โโข Threshold Mode : Five different modes can be selected:
โโโโ Fixed Value : You can define the value using the "Fixed Threshold" field below. The default value is 2.0.
โโโโ Standard Deviation Channel From Fixed Lookback : This is a channel calculated using the simple moving average of relative volume
โโโโ(so not the Hull moving average used elsewhere in the indicator), plus/minus the standard deviation multiplied by a user-defined factor.
โโโโThe lookback used is the value of the "Channel Lookback" field. Its default is 100.
โโโโ High/Low Channel From Beginning of TF : in this mode, the High/Low values reset at the beginning of each timeframe unit.
โโโโ High/Low Channel From Beginning of Past Volume Lookback : in this mode, the High/Low values start from the farthest point back where we are calculating past volume ,
โโโโwhich is determined by the combination of timeframe units and the "Past Volume Lookback in TF units" value.
โโโโ High/Low Channel From Fixed Lookback : In this mode the lookback is fixed. You can define the value using the "Channel Lookback" field. The default value is 100.
โโข Period of RelVol Moving Average : the period of the Hull moving average used in the "Directional Relative Volume Average" and the "Relative Volume Average".
โโข High Volatility is defined using fast and slow ATR periods, so this represents the volatility of price.
โโVolatility is considered to be high when the fast ATR value is greater than its slow value. Volatility can be used as a filter in the column coloring conditions.
Column Coloring Conditions
โโข Eight different conditions can be turned on or off to determine the color of the volume columns. All "ON" conditions must be met to determine a high/low state of relative volume,
โโor, in the case of directional relative volume, a bull/bear state.
โโข A volatility state can also be used to filter the conditions.
โโข When the coloring conditions and the filter do not allow for a high/low state to be determined, the neutral color is used.
โโข Transitions of the color of the volume columns determined by coloring conditions are used to plot the up/down markers, which in turn control when alerts are triggered.
Colors
โโข You can define your own colors for all of the oscillator's plots.
โโข The default colors will perform well on light or dark chart backgrounds.
Alerts
โโข An alert can be defined for the script. The alert will trigger whenever an up/down marker appears in the indicator's display.
โโThe particular combination of coloring conditions and the display settings for up/down markers when you create the alert will determine which conditions trigger the alert.
โโAfter alerts are created, subsequent changes to the conditions controlling the display of markers will not affect existing alerts.
โโข By configuring the script's inputs in different ways before you create your alerts, you can create multiple, functionally distinct alerts from this script.
โโWhen creating multiple alerts, it is useful to include in the alert's message a reminder of the particular conditions you used for each alert.
โโข As is usually the case, alerts triggering "Once Per Bar Close" will prevent repainting.
Error messages
Error messages will appear at the end of the chart upon the following conditions:
โโข When the combination of the timeframe units used and the "Past Volume Lookback in TF units" value create a lookback that is greater than 5000 bars.
โโThe lookback will then be recalculated to a value such that a runtime error does not occur.
โโข If the chart's timeframe is higher than the timeframe units. This error cannot occur when using Auto-steps to calculate timeframe units.
โโข If relative volume cannot be calculated, for example, when no volume data is available for the chart's symbol.
โโข When the threshold of relative volume is configured to be visible but the indicator's scale does not allow it to be visible (in "Current Volume Columns" display mode).
โโ NOTES
For traders
The chart shown here uses the following display modes: "Current Volume Columns", "Relative Volume Columns With Average", "Directional Relative Volume Average" and "Relative Volume Average". The last one also shows the threshold channel in standard deviation mode, and the TF Unit reminder to the right, in red.
Volume, like price, is a value with a market-dependent scale. The only valid reference for volume being its past values, any improvement in the way past volume is calculated thus represents a potential opportunity to traders. Relative volume calculated as it is here can help traders extract useful information from markets in many circumstances, markets with cyclical volume such as Forex being one, obvious case. The relative nature of the values calculated by this indicator also make it a natural fit for cross-market and cross-sector analysis, or to identify behavioral changes in the different futures contracts of the same market. Relative volume can also be put to more exotic uses, such as in evaluating changes in the popularity of exchanges.
Relative volume alone has no directional bias. While higher relative volume values always indicate higher trading activity, that activity does not necessarily translate into significant price movement. In a tightly fought battle between buyers and sellers, you could theoretically have very large volume for many bars, with no change whatsoever in bid/ask prices. This of course, is unlikely to happen in reality, and so traders are justified in considering high relative volume values as indicating periods where more attention is required, because imbalances in the strength of buying/selling power during high-volume trading periods can amplify price variations, providing traders with the generally useful gift of volatility.
Be sure to give the "Directional Relative Volume Average" a try. Contrary to the always-positive ratio widely used in this indicator, the "Directional Relative Volume Average" produces a value able to determine a bullish/bearish bias for relative volume.
Note that realtime bars must be complete for the relative volume value to be confirmed. Values calculated on historical or elapsed realtime bars will not recalculate unless historical volume data changes.
Finally, as with all indicators using volume information, keep in mind that some exchanges/brokers supply different feeds for intraday and daily data, and the volume data on both feeds can sometimes vary quite a bit.
For coders
Our script was written using the PineCoders Coding Conventions for Pine .
The description was formatted using the techniques explained in the How We Write and Format Script Descriptions PineCoders publication.
Bits and pieces of code were lifted from the MTF Selection Framework and the MTF Oscillator Framework , also by PineCoders.
โโ THANKS
Thanks to dgtrd for suggesting to add the channel using standard deviation.
Thanks to adolgov for helpful suggestions on calculations and visuals.
Look first. Then leap.
Efficient Work [LucF]โโ OVERVIEW
Efficient Work measures the ratio of price movement from close to close ( resulting work ) over the distance traveled to the high and low before settling down at the close ( total work ). The closer the two values are, the more Efficient Work approaches its maximum value of +1 for an up move or -1 for a down move. When price does not change, Efficient Work is zero.
Higher values of Efficient Work indicate more efficient price travel between the close of two successive bars, which I interpret to be more significant, regardless of the move's amplitude. Because it measures the direction and strength of price changes rather than their amplitude, Efficient Work may be thought of as a sentiment indicator.
โโ CONCEPTS
This oscillator's design stems from a few key concepts.
Relative Levels
Other than the centerline, relative rather than absolute levels are used to identify levels of interest. Accordingly, no fixed levels correspond to overbought/oversold conditions. Relative levels of interest are identified using:
โโข A Donchian channel (historical highs/lows).
โโข The oscillator's position relative to higher timeframe values.
โโข Oscillator levels following points in time where a divergence is identified.
Higher timeframes
Two progressively higher timeframes are used to calculate larger-context values for the oscillator. The rationale underlying the use of timeframes higher than the chart's is that, while they change less frequently than the values calculated at the chart's resolution, they are more meaningful because more work (trader activity) is required to calculate them. Combining the immediacy of values calculated at the chart's resolution to higher timeframe values achieves a compromise between responsiveness and reliability.
Divergences as points of interest rather than directional clues
A very simple interpretation of what constitutes a divergence is used. A divergence is defined as a discrepancy between any bar's direction and the direction of the signal line on that same bar. No attempt is made to attribute a directional bias to divergences when they occur. Instead, the oscillator's level is saved and subsequent movement of the oscillator relative to the saved level is what determines the bullish/bearish state of the oscillator.
Conservative coloring scheme
Several additive coloring conditions allow the bull/bear coloring of the oscillator's main line to be restricted to specific areas meeting all the selected conditions. The concept is built on the premise that most of the time, an oscillator's value should be viewed as mere noise, and that somewhat like price, it only occasionally conveys actionable information.
โโ FEATURES
Plots
โโข Three lines can be plotted. They are named Main line , Line 2 and Line 3 . You decide which calculation to use for each line:
โโโโข The oscillator's value at the chart's resolution.
โโโโข The oscillator's value at a medium timeframe higher than the chart's resolution.
โโโโข The oscillator's value at the highest timeframe.
โโโโข An aggregate line calculated using a weighed average of the three previous lines (see the Aggregate Weights section of Inputs to configure the weights).
โโข The coloring conditions, divergence levels and the Hi/Lo channel always apply to the Main line, whichever calculation you decide to use for it.
โโข The color of lines 2 and 3 are fixed but can be set in the "Colors" section of Inputs.
โโข You can change the thickness of each line.
โโข When the aggregate line is displayed, higher timeframe values are only used in its calculation when they become available in the chart's history,
โโotherwise the aggregate line would appear much later on the chart. To indicate when each higher timeframe value becomes available,
โโa small label appears near the centerline.
โโข Divergences can be shown as small dots on the centerline.
โโข Divergence levels can be shown. The level and fill are determined by the oscillator's position relative to the last saved divergence level.
โโข Bull/bear markers can be displayed. They occur whenever a new bull/bear state is determined by the "Main Line Coloring Conditions".
โโข The Hi/Lo (Donchian) channel can be displayed, and its period defined.
โโข The background can display the state of any one of 11 different conditions.
โโข The resolutions used for the higher timeframes can be displayed to the right of the last bar's value.
โโข Four key values are always displayed in the Data Window (fourth icon down to the right of your chart):
โโoscillator values for the chart, medium and highest timeframes, and the oscillator's instant value before it is averaged.
Main Line Coloring Conditions
โโข Nine different conditions can be selected to determine the bull/bear coloring of the main line. All conditions set to "ON" must be met to determine the bull/bear state.
โโข A volatility state can also be used to filter the conditions.
โโข When the coloring conditions and the filter do not allow for a bull/bear state to be determined, the neutral color is used.
Signal
โโข Seven different averages can be used to calculate the average of the oscillator's value.
โโข The average's period can be set. A period of one will show the instant value of the oscillator,
โโprovided you don't use linear regression or the Hull MA as they do not work with a period of one.
โโข An external signal can be used as the oscillator's instant value. If an already averaged external value is used, set the period to one in this indicator.
โโข For the cases where an external signal is used, a centerline value can be set.
Higher Timeframes
โโข The two higher timeframes are named Medium timeframe and Highest timeframe . They can be determined using one of three methods:
โโโข Auto-steps: the higher timeframes are determined using the chart's resolution. If the chart uses a seconds resolution, for example,
โโโthe medium and highest resolutions will be 15 and 60 minutes.
โโโข Multiples: the timeframes are calculated using a multiple of the chart's resolution, which you can set.
โโโข Fixed: the set timeframes do not change with the chart's resolution.
Repainting
โโข Repainting can be controlled separately for the chart's value and the higher timeframe values.
โโข The default is a repainting chart value and non-repainting higher timeframe values. The Aggregate line will thus repaint by default,
โโas it uses the chart's value along with the higher timeframes values.
Aggregate Weights
โโข The weight of each component of the Aggregate line can be set.
โโข The default is equal weights for the three components, meaning that the chart's value accounts for one third of the weight in the Aggregate.
High Volatility
โโข This provides control over the volatility filter used in the Main line's coloring conditions and the background display.
โโข Volatility is determined to be high when the short-term ATR is greater than the long-term ATR.
Colors
โโข You can define your own colors for all of the oscillator's plots.
โโข The default colors will perform well on both white and black chart backgrounds.
Alerts
โโข An alert can be defined for the script. The alert will trigger whenever a bull/bear marker appears in the indicator's display.
โโThe particular combination of coloring conditions and the display of bull/bear markers when you create the alert will thus determine when the alert triggers.
โโOnce the alerts are created, subsequent changes to the conditions controlling the display of markers will not affect the existing alert(s).
โโข You can create multiple alerts from this script, each triggering on different conditions.
Backtesting & Trading Engine Signal Line
โโข An invisible plot named "BTE Signal" is provided. It can be used as an entry signal when connected to the PineCoders Backtesting & Trading Engine as an external input.
โโIt will generate an entry whenever a marker is displayed.
โโ NOTES
โข I do not know for sure if the calculations in Efficient Work are original. I apologize if they are not.
โข Because this version of Efficient Work only has access to OHLC information, it cannot measure the total distance traveled through all of a bar's ticks, but the indicator nonetheless behaves in a manner consistent with the intentions underlying its design.
For Pine coders
This code was written using the following standards:
โโข The PineCoders Coding Conventions for Pine .
โโข A modified version of the PineCoders MTF Oscillator Framework and MTF Selection Framework .
Time ChangesThis is very cool and simple script
I just play around with non security MTF and this is the end result:)
buy period is lime, sell period is red
since it based on the changes of the MTF by time it give us very nice signal of bullish or bearish period
since no security is here so no repaint fear..
if you use 1 hour candle choose either daily (better for crypto ) or weekly MTF (better for stocks ) or even higher
if you use lower TF then try to see which MTF is best suited for it
simple and nice I think :)
here on tesla
facebook
boeing
nifty
forex
etc
DEMARSIThis is little tricky indicator but you need to understand how its work in order to make it easy to understand
The black line is DEMA RSI hybrid which is made on the MTF length that is not repainting.
The green and red zones are also DEMA RSI that is calculated in different way (the cross between the fast and the slow moving create the color change and the signal.
you can buy or sell using the signals shown (no alerts given) but it easy to add. the since the first MTF DEMA RSI is slower the the other ones we can use it as base . so lets say you enter in green and the second DEMA is still above the black line the trend is still forward and even if you get sell signal you still can hold the coin as it expected to rise further . on the other hand once you get sell signal in red and its fall down bellow black line then it the true end of the buy period. you need to find best condition for your purpose which mean to play with setting (here I put 240 MTF over rsiDEma kegth 21) , other options can be better (did not test it).
here without the cross signals of dema rsi 2
here with MTF 120
Trader HQ - Multi Time Frame EMA๐ท Indicator Title
MTF 200 EMA Pro โ Triple Timeframe Trend Filter
๐ท Short Description (Tagline)
A professional multi-timeframe 200 EMA framework that overlays up to three higher and lower timeframe trend filters on a single chart for superior market alignment and trade confirmation.
๐ท Full Description (Paste This in TradingView)
๐ MTF 200 EMA Pro โ Triple Timeframe Trend Filter
MTF 200 EMA Pro is a professional-grade multi-timeframe trend analysis tool designed to help traders identify high-probability directional bias across multiple timeframes.
This indicator allows you to overlay up to three independent 200-period Exponential Moving Averages from different timeframes onto one chart, providing instant insight into higher, medium, and lower timeframe trend alignment.
By stacking multiple 200 EMAs, traders can eliminate low-quality setups, avoid countertrend trades, and operate in harmony with dominant market structure.
๐ง Key Features
โ
Up to 3 independent 200 EMAs
โ
Individual timeframe selection per EMA
โ
Clean overlay on any chart
โ
Adjustable display per line
โ
Real-time multi-timeframe calculations
โ
Works on all markets and sessions
๐ฏ How to Use
This indicator is designed as a primary trend filter.
Example configuration:
โข EMA 1 โ Lower timeframe (Execution)
โข EMA 2 โ Medium timeframe (Momentum)
โข EMA 3 โ Higher timeframe (Structure)
Bullish Bias Example
Price above all 200 EMAs
Lower EMA above higher EMA
Pullbacks hold above structure
Bearish Bias Example
Price below all 200 EMAs
Lower EMA below higher EMA
Rejections at structure
When EMAs are aligned, trend probability increases.
๐ Best Use Cases
โ Futures Trading
โ Options & Equity Trading
โ Forex & Crypto
โ Prop Firm Evaluations
โ Trend-Following Systems
โ Momentum Strategies
โ ๏ธ Risk Disclaimer
This indicator is a trend visualization and filtering tool only. It does not provide financial advice. Always apply proper risk management and confirm signals with your own strategy.
ARPAKET_FLOW_CRYPTOArpaket_FLOW - TradingView Script
---
## ๐ Short Description (for subtitle)
```
Advanced Money Flow Indicator with Multi-Asset Support, Whale Detection & Multi-Timeframe Analysis
```
---
## ๐ Full Description (copy below this line)
---
### ๐ ARPAKET_FLOW - Smart Money Flow Indicator
**Arpaket_FLOW** is a comprehensive money flow indicator designed to help traders visualize whether smart money is flowing INTO or OUT of the market, along with the intensity of that flow. This indicator combines multiple proven technical analysis methods into a single, easy-to-read tool for making informed buy/sell decisions.
---
### ๐ฏ What Does This Indicator Do?
This indicator answers the most critical question in trading: **"Is money flowing into or out of this asset?"**
By combining volume analysis with price action, Arpaket_FLOW calculates a **Flow Score (0-100)** that tells you:
- **Above 70**: Strong money inflow โ Bullish bias
- **50-70**: Moderate inflow โ Cautiously bullish
- **30-50**: Neutral zone โ Wait for confirmation
- **Below 30**: Strong money outflow โ Bearish bias
---
### ๐ฌ How It Works
Arpaket_FLOW combines **6 powerful indicators** into one unified score:
| Component | Weight | Purpose |
|-----------|--------|---------|
| **Volume Ratio** | 25% | Detects unusual volume activity |
| **Money Flow Index (MFI)** | 20% | Measures buying/selling pressure with volume |
| **Chaikin Money Flow (CMF)** | 20% | Identifies accumulation/distribution |
| **On-Balance Volume (OBV)** | 15% | Tracks volume flow direction |
| **RSI Momentum** | 10% | Confirms price momentum |
| **VWAP Deviation** | 10% | Institutional price reference |
---
### โจ Key Features
#### ๐๏ธ Multi-Asset Adaptation
- **Crypto Mode**: Higher volatility thresholds + Whale detection
- **Low Liquidity Stocks**: Adjusted sensitivity for thin markets (SET Index, Small Caps)
- **High Liquidity Markets**: Standard settings for Forex, Major Indices
#### โฑ๏ธ Multiple Trading Styles
- **Scalping** (1-5 min): Ultra-fast signals with noise filtering
- **Day Trading** (15min-1H): Balanced speed and reliability
- **Swing Trading** (4H-Daily): Multi-timeframe confirmation
- **Position Trading** (Weekly+): Long-term flow analysis
#### ๐ Whale Detection (Crypto)
Automatically detects unusual large-volume activity that may indicate whale accumulation or distribution. When volume exceeds 3x the average, a whale marker (๐) appears on the chart.
#### ๐ Multi-Timeframe Panel
For Swing and Position traders, view flow direction across 4 timeframes (1H, 4H, Daily, Weekly) simultaneously to ensure alignment before entering trades.
#### ๐ Real-Time Dashboard
A clean dashboard displaying:
- Flow Direction (Inflow/Outflow/Neutral)
- Flow Score (0-100)
- Flow Strength (Weak/Moderate/Strong/Extreme)
- Volume Status (Normal/Surge/Whale)
- MFI & CMF readings
- Overall Signal (Buy/Sell/Neutral)
#### โ ๏ธ Divergence Detection
Automatically identifies bullish and bearish divergences between price and money flow, providing early reversal warnings.
---
### ๐ How To Use
#### Basic Usage:
1. **Select your Market Type** in settings (Crypto/Low Liquidity/High Liquidity)
2. **Select your Trading Style** (Scalping/Day Trading/Swing/Position)
3. **Watch the histogram**:
- Green bars = Money flowing IN (bullish)
- Red bars = Money flowing OUT (bearish)
- Bar height = Flow intensity
#### Signal Interpretation:
| Signal | Meaning | Suggested Action |
|--------|---------|------------------|
| ๐ข Green Triangle | Strong buy signal | Consider long entry |
| ๐ด Red Triangle | Strong sell signal | Consider short/exit |
| ๐ Whale Icon | Large player activity | Watch for direction |
| DIV Label | Divergence detected | Potential reversal |
#### Best Practices:
- Use **higher timeframes** for trend direction
- Use **lower timeframes** for entry timing
- Wait for **MTF alignment** (3+ timeframes agreeing) for higher probability trades
- Combine with support/resistance levels for optimal entries
---
### โ๏ธ Settings Guide
#### General Settings
- **Market Type**: Match to your traded asset
- **Trading Style**: Match to your timeframe
- **Sensitivity**: Conservative (fewer signals) โ Aggressive (more signals)
#### Period Settings
- **Fast Period**: Short-term calculation (default: 7)
- **Slow Period**: Long-term calculation (default: 21)
- **Signal Smoothing**: Reduces noise (default: 5)
#### Alert Settings
- **Buy Threshold**: Score level for buy signals (default: 70)
- **Sell Threshold**: Score level for sell signals (default: 30)
- **Volume Surge Multiplier**: Volume spike detection (default: 2.0x)
- **Whale Multiplier**: Whale detection threshold (default: 3.0x)
---
### ๐ Available Alerts
1. **Strong Buy/Sell Signal** - When confirmed signals trigger
2. **Enter Buy/Sell Zone** - When score crosses thresholds
3. **Whale Activity** - Accumulation or distribution detected
4. **Bullish/Bearish Divergence** - Price/flow divergence
5. **Volume Surge** - Unusual volume spike
6. **MTF Alignment** - Multiple timeframes agree
7. **Extreme Conditions** - Score above 90 or below 10
8. **Flow Reversal** - Direction change confirmed
---
### ๐ Recommended Combinations
This indicator works best when combined with:
- **Support/Resistance levels** for entry points
- **Trend lines** for direction confirmation
- **Moving Averages** (EMA 20/50/200) for trend context
- **Price Action patterns** for timing
---
### โ ๏ธ Disclaimer
This indicator is a tool to assist in trading decisions, not a guarantee of profits. Always:
- Use proper risk management
- Never risk more than you can afford to lose
- Backtest before live trading
- Consider multiple factors before entering trades
Past performance does not guarantee future results. Trading involves substantial risk of loss.
---
### ๐ Credits & Acknowledgments
This indicator combines concepts from:
- Money Flow Index (Gene Quong & Avrum Soudack)
- Chaikin Money Flow (Marc Chaikin)
- On-Balance Volume (Joe Granville)
- Volume-Weighted Average Price (Institutional standard)
---
### ๐ฌ Feedback
If you find this indicator helpful, please leave a comment or like! Your feedback helps improve future updates.
For questions or suggestions, feel free to comment below.
**Happy Trading!** ๐
---
## ๐ท๏ธ Suggested Tags (for TradingView)
```
moneyflow, volume, smartmoney, whaledetection, crypto, stocks, forex, mfi, cmf, obv, vwap, multitimeframe, buysellindicator, flowanalysis, accumulation, distribution
```
---
## ๐ธ Suggested Screenshots to Include
1. **Main Chart View** - Show the indicator with histogram and dashboard
2. **Buy Signal Example** - Zoom in on a successful buy signal
3. **Whale Detection** - Show crypto chart with whale markers
4. **MTF Panel** - Display multi-timeframe alignment
5. **Settings Panel** - Show available customization options
[GYTS] VolatilityToolkit LibraryVolatilityToolkit Library
๐ธ Part of GoemonYae Trading System (GYTS) ๐ธ
๐ธ --------- INTRODUCTION --------- ๐ธ
๐ฎ What Does This Library Contain?
VolatilityToolkit provides a comprehensive suite of volatility estimation functions derived from academic research in financial econometrics. Rather than relying on simplistic measures, this library implements range-based estimators that extract maximum information from OHLC data โ delivering estimates that are 5โ14ร more efficient than traditional close-to-close methods.
The library spans the full volatility workflow: estimation, smoothing, and regime detection.
๐ฎ Key Categories
โข Range-Based Estimators โ Parkinson, Garman-Klass, Rogers-Satchell, Yang-Zhang (academically-grounded variance estimators)
โข Classical Measures โ Close-to-Close, ATR, Chaikin Volatility (baseline and price-unit measures)
โข Smoothing & Post-Processing โ Asymmetric EWMA for differential decay rates
โข Aggregation & Regime Detection โ Multi-horizon blending, MTF aggregation, Volatility Burst Ratio
๐ฎ Originality
To the best of our knowledge, no other TradingView script combines range-based estimators (Parkinson, Garman-Klass, Rogers-Satchell, Yang-Zhang), classical measures, and regime detection tools in a single package. Unlike typical volatility implementations that offer only a single method, this library:
โข Implements four academically-grounded range-based estimators with proper mathematical foundations
โข Handles drift bias and overnight gaps, issues that plague simpler estimators in trending markets
โข Integrates with GYTS FiltersToolkit for advanced smoothing (10 filter types vs. typical SMA-only)
โข Provides regime detection tools (Burst Ratio, MTF aggregation) for systematic strategy integration
โข Standardises output units for seamless estimator comparison and swapping
๐ธ --------- ADDED VALUE --------- ๐ธ
๐ฎ Academic Rigour
Each estimator implements peer-reviewed methodologies with proper mathematical foundations. The library handles aspects that are easily missed, e.g. drift independence, overnight gap adjustment, and optimal weighting factors. All functions include guards against edge cases (division by zero, negative variance floors, warmup handling).
๐ฎ Statistical Efficiency
Range-based estimators extract more information from the same data. Yang-Zhang achieves up to 14ร the efficiency of close-to-close variance, meaning you can achieve the same estimation accuracy with far fewer bars โ critical for adapting quickly to changing market conditions.
๐ฎ Flexible Smoothing
All estimators support configurable smoothing via the GYTS FiltersToolkit integration. Choose from 10 filter types to balance responsiveness against noise reduction:
โข Ultimate Smoother (2-Pole / 3-Pole) โ Near-zero lag; the 3-pole variant is a GYTS design with tunable overshoot
โข Super Smoother (2-Pole / 3-Pole) โ Excellent noise reduction with minimal lag
โข BiQuad โ Second-order IIR filter with quality factor control
โข ADXvma โ Adaptive smoothing based on directional volatility
โข MAMA โ Cycle-adaptive moving average
โข A2RMA โ Adaptive autonomous recursive moving average
โข SMA / EMA โ Classical averages (SMA is default for most estimators)
Using Infinite Impulse Response (IIR) filters (e.g. Super Smoother, Ultimate Smoother) instead of SMA avoids the "drop-off artefact" where volatility readings crash when old spikes exit the window.
๐ฎ Plug-and-Play Integration
Standardised output units (per-bar log-return volatility) make it trivial to swap estimators. The annualize() helper converts to yearly volatility with a single call. All functions work seamlessly with other GYTS components.
๐ธ --------- RANGE-BASED ESTIMATORS --------- ๐ธ
These estimators utilise High, Low, Open, and Close prices to extract significantly more information about the underlying diffusion process than close-only methods.
๐ฎ parkinson()
The Extreme Value Method -- approximately 5ร more efficient than close-to-close, requiring about 80% less data for equivalent accuracy. Uses only the High-Low range, making it simple and robust.
โข Assumption: Zero drift (random walk). May be biased in strongly trending markets.
โข Best for: Quick volatility reads when drift is minimal.
โข Parameters: smoothing_length (default 14), filter_type (default SMA), smoothing_factor (default 0.7)
Source: Parkinson, M. (1980). The Extreme Value Method for Estimating the Variance of the Rate of Return. Journal of Business, 53 (1), 61โ65. DOI
๐ฎ garman_klass()
Extends Parkinson by incorporating Open and Close prices, achieving approximately 7.4ร efficiency over close-to-close. Implements the "practical" analytic estimator (ฯฬยฒโ
) which avoids cross-product terms whilst maintaining near-optimal efficiency.
โข Assumption: Zero drift, continuous trading (no gaps).
โข Best for: Markets with minimal overnight gaps and ranging conditions.
โข Parameters: smoothing_length (default 14), filter_type (default SMA), smoothing_factor (default 0.7)
Source: Garman, M.B. & Klass, M.J. (1980). On the Estimation of Security Price Volatilities from Historical Data. Journal of Business, 53 (1), 67โ78. DOI
๐ฎ rogers_satchell()
The drift-independent estimator correctly isolates variance even in strongly trending markets where Parkinson and Garman-Klass become significantly biased. Uses the formula: ln(H/C)ยทln(H/O) + ln(L/C)ยทln(L/O).
โข Key advantage: Unbiased regardless of trend direction or magnitude.
โข Best for: Trending markets, crypto (24/7 trading with minimal gaps), general-purpose use.
โข Parameters: smoothing_length (default 14), filter_type (default SMA), smoothing_factor (default 0.7)
Source: Rogers, L.C.G. & Satchell, S.E. (1991). Estimating Variance from High, Low and Closing Prices. Annals of Applied Probability, 1 (4), 504โ512. DOI
๐ฎ yang_zhang()
The minimum-variance composite estimator โ both drift-independent AND gap-aware. Combines overnight returns, open-to-close returns, and the Rogers-Satchell component with optimal weighting to minimise estimator variance. Up to 14ร more efficient than close-to-close.
โข Parameters: lookback (default 14, minimum 2), alpha (default 1.34, optimised for equities).
โข Best for: Equity markets with significant overnight gaps, highest-quality volatility estimation.
โข Note: Unlike other estimators, Yang-Zhang does not support custom filter types โ it uses rolling sample variance internally.
Source: Yang, D. & Zhang, Q. (2000). Drift-Independent Volatility Estimation Based on High, Low, Open, and Close Prices. Journal of Business, 73 (3), 477โ491. DOI
๐ธ --------- CLASSICAL MEASURES --------- ๐ธ
๐ฎ close_to_close()
Classical sample variance of logarithmic returns. Provided primarily as a baseline benchmark โ it is approximately 5โ8ร less efficient than range-based estimators, requiring proportionally more data for the same accuracy.
โข Parameters: lookback (default 14), filter_type (default SMA), smoothing_factor (default 0.7)
โข Use case: Comparison baseline, situations requiring strict methodological consistency with academic literature.
๐ฎ atr()
Average True Range -- measures volatility in price units rather than log-returns. Directly interpretable for stop-loss placement (e.g., "2ร ATR trailing stop") and handles gaps naturally via the True Range formula.
โข Output: Price units (not comparable across different price levels).
โข Parameters: smoothing_length (default 14), filter_type (default SMA), smoothing_factor (default 0.7)
โข Best for: Position sizing, trailing stops, any application requiring volatility in currency terms.
Source: Wilder, J.W. (1978). New Concepts in Technical Trading Systems . Trend Research.
๐ฎ chaikin_volatility()
Rate of Change of the smoothed trading range. Unlike level-based measures, Chaikin Volatility shows whether volatility is expanding or contracting relative to recent history.
โข Output: Percentage change (oscillates around zero).
โข Parameters: length (default 10), roc_length (default 10), filter_type (default EMA), smoothing_factor (default 0.7)
โข Interpretation: High values suggest nervous, wide-ranging markets; low values indicate compression.
โข Best for: Detecting volatility regime shifts, breakout anticipation.
๐ธ --------- SMOOTHING & POST-PROCESSING --------- ๐ธ
๐ฎ asymmetric_ewma()
Differential smoothing with separate alphas for rising versus falling volatility. Allows volatility to spike quickly (fast reaction to shocks) whilst decaying slowly (stability). Essential for trailing stops that should widen rapidly during turbulence but narrow gradually.
โข Parameters: alpha_up (default 0.1), alpha_down (default 0.02).
โข Note: Stateful function โ call exactly once per bar.
๐ฎ annualize()
Converts per-bar volatility to annualised volatility using the square-root-of-time rule: ฯ_annual = ฯ_bar ร โ(periods_per_year).
โข Parameters: vol (series float), periods (default 252 for daily equity bars).
โข Common values: 365 (crypto), 52 (weekly), 12 (monthly).
๐ธ --------- AGGREGATION & REGIME DETECTION --------- ๐ธ
๐ฎ weighted_horizon_volatility()
Blends volatility readings across short, medium, and long lookback horizons. Inspired by the Heterogeneous Autoregressive (HAR-RV) model's recognition that market participants operate on different time scales.
โข Default horizons: 1-bar (short), 5-bar (medium), 22-bar (long).
โข Default weights: 0.5, 0.3, 0.2.
โข Note: This is a weighted trailing average, not a forecasting regression. For true HAR-RV forecasting, it would be required to fit regression coefficients.
Inspired by: Corsi, F. (2009). A Simple Approximate Long-Memory Model of Realized Volatility. Journal of Financial Econometrics .
๐ฎ volatility_mtf()
Multi-timeframe aggregation for intraday charts. Combines base volatility with higher-timeframe (Daily, Weekly, Monthly) readings, automatically scaling HTF volatilities down to the current timeframe's magnitude using the square-root-of-time rule.
โข Usage: Calculate HTF volatilities via request.security() externally, then pass to this function.
โข Behaviour: Returns base volatility unchanged on Daily+ timeframes (MTF aggregation not applicable).
๐ฎ volatility_burst_ratio()
Regime shift detector comparing short-term to long-term volatility.
โข Parameters: short_period (default 8), long_period (default 50), filter_type (default Super Smoother 2-Pole), smoothing_factor (default 0.7)
โข Interpretation: Ratio > 1.0 indicates expanding volatility; values > 1.5 often precede or accompany explosive breakouts.
โข Best for: Filtering entries (e.g., "only enter if volatility is expanding"), dynamic risk adjustment, breakout confirmation.
๐ธ --------- PRACTICAL USAGE NOTES --------- ๐ธ
๐ฎ Choosing an Estimator
โข Trending equities with gaps: yang_zhang() โ handles both drift and overnight gaps optimally.
โข Crypto (24/7 trading): rogers_satchell() โ drift-independent without the lag of Yang-Zhang's multi-period window.
โข Ranging markets: garman_klass() or parkinson() โ simpler, no drift adjustment needed.
โข Price-based stops: atr() โ output in price units, directly usable for stop distances.
โข Regime detection: Combine any estimator with volatility_burst_ratio().
๐ฎ Output Units
All range-based estimators output per-bar volatility in log-return units (standard deviation). To convert to annualised percentage volatility (the convention in options and risk management), use:
vol_annual = annualize(yang_zhang(14), 252) // For daily bars
vol_percent = vol_annual * 100 // Express as percentage
๐ฎ Smoothing Selection
The library integrates with FiltersToolkit for flexible smoothing. General guidance:
โข SMA: Classical, statistically valid, but suffers from "drop-off" artefacts when spikes exit the window.
โข Super Smoother / Ultimate Smoother / BiQuad: Natural decay, reduced lag โ preferred for trading applications.
โข MAMA / ADXvma / A2RMA: Adaptive smoothing, sometimes interesting for highly dynamic environments.
๐ฎ Edge Cases and Limitations
โข Flat candles: Guards prevent log(0) errors, but single-tick bars produce near-zero variance readings.
โข Illiquid assets: Discretisation bias causes underestimation when ticks-per-bar is small. Use higher timeframes for more reliable estimates.
โข Yang-Zhang minimum: Requires lookback โฅ 2 (enforced internally). Cannot produce instantaneous readings.
โข Drift in Parkinson/GK: These estimators overestimate variance in trending conditions โ switch to Rogers-Satchell or Yang-Zhang.
Note: This library is actively maintained. Suggestions for additional estimators or improvements are welcome.
BO Rule: Full Suite (Auto-Clean)** **
**BO Rule: Ultimate Breakout & Retest Suite (Body Only + Strict Sequence)**
This is a comprehensive Price Action indicator designed for traders who focus on **Structure Break & Retest** setups. Unlike standard fractal indicators, this script employs a strict "New Price Rule" and "Body-Only" logic to filter out noise, combined with a Multi-Timeframe (MTF) Dashboard and Mobile Alerts.
**Key Logic & Unique Features:**
1. **Classic Levels (Body Only):**
* **Logic:** Resistance is defined by a Green candle followed by a Red candle. Support is Red followed by Green.
* **Precision:** The script strictly uses Candle **Bodies** (Open/Close) to define levels and confirm breakouts. Wicks are ignored to avoid volatility fakeouts.
2. **Strict Sequence (New Price Rule):**
* **Reset Logic:** Once a breakout signal is confirmed, all previous structure levels are immediately invalidated.
* The script only scans for *new* structure levels formed *after* the latest confirmed signal. This ensures you are always trading the most current market structure.
3. **Smart Visualization (Auto-Clean):**
* **Queue System:** To keep your chart clean, the script includes a "Display Limit" feature. It only keeps the most recent N signals (e.g., 20) and automatically deletes the oldest ones.
4. **MTF Dashboard & Conflicts:**
* Includes a bottom-right dashboard showing trend directions across 5 user-defined timeframes.
* Displays "Conflict" lines if different timeframes show opposing signals on the same bar.
5. **Filter Duplicates:**
* Option to show only **Trend Reversals** (Buy -> Sell -> Buy) by hiding consecutive signals in the same direction.
6. **Mobile Notifications:**
* Supports custom alerts for specific timeframe reversals, designed to push notifications directly to the TradingView App.
**How to Trade:**
* **Green Dashed Line:** Bullish Confirmation (Body Breakout + Retest).
* **Red Dashed Line:** Bearish Confirmation (Body Breakdown + Retest).
* **Dashboard:** โฒ = Bullish Trend, โผ = Bearish Trend.
-------------------------------------------------------
** **
**BO Rule: ็ถๅ
ธๆฐดๅนณ็ช็ ดๅ่ธฉ็ญ็ฅ (ๅฏฆ้ซๅคๆท + ๅดๆ ผๅบๅ + ่ชๅๆธ
็)**
้ๆฏไธๅๅฐ็บ่ฃธKไบคๆ่
(Price Action) ่จญ่จ็ๅฎๆด็ช็ ดๅ่ธฉ็ณป็ตฑใๅฎๆก็จไบๅดๆ ผ็ใๆฐๅนๆ ผ่ฆๅใ่ใๅ
็ๅฏฆ้ซใ้่ผฏ๏ผไธฆๆดๅไบๅค้ฑๆๅ่กจๆฟ่ๆๆฉ้็ฅๅ่ฝใ
**ๆ ธๅฟ้่ผฏ่็จ็นๅ่ฝ๏ผ**
1. **็ถๅ
ธๆฐดๅนณ (ๅ
็ๅฏฆ้ซ Body Only)๏ผ**
* **ๅฎ็พฉ๏ผ** ้ปๅไฝ็ฑใ็ถ Kๆฅ็ด
Kใๅฝขๆ๏ผๆฏๆไฝ็ฑใ็ด
Kๆฅ็ถ Kใๅฝขๆใ
* **้ๆฟพ๏ผ** ็ณป็ตฑๅ
ไฝฟ็จ Kๆฃๅฏฆ้ซ (ๆถ็ค/้็ค) ไพๅฎ็พฉๆฐดๅนณ่ๅคๆท็ช็ ด๏ผๅฎๅ
จๅฟฝ็ฅๅฝฑ็ท (Wicks)๏ผๆๆ้ฟๅ
ๅ็ช็ ดใ
2. **ๆฐๅนๆ ผ่ฆๅ (ๅดๆ ผๅบๅ)๏ผ**
* **้็ฝฎๆฉๅถ๏ผ** ๆก็จใๆๆฐๅชๅ
ใๅๅใไธๆฆ็ถๅ่จ่็ขบ่ช๏ผไนๅๆๆ็่็ตๆงๆฐดๅนณ็ซๅณไฝๅปขใ็ณป็ตฑๅชๆๅฐๆพๅจใๆๆฐ่จ่ไนๅพใๅฝขๆ็ๆฐๆฐดๅนณ๏ผ็ขบไฟไบคๆ้่ผฏ็ฌฆๅ็ถไธ็ๅธๅ ด็ตๆงใ
3. **ๆบ่ฝ้กฏ็คบ (่ชๅๆธ
็)๏ผ**
* **ไฝๅ็ณป็ตฑ๏ผ** ็บไบไฟๆๅ่กจๆดๆฝ๏ผๆจๅฏไปฅ่จญๅฎใไฟ็ๆ่ฟ N ๅ่จ่ใใ็ณป็ตฑๆ่ชๅๅช้คๆ่็็ทๆฎต๏ผ้ฟๅ
ๅ่กจๅ
ๆปฟๆญทๅฒ็ทๆขใ
4. **ๅค้ฑๆ (MTF) ๅ่กจๆฟ๏ผ**
* ๅณไธ่ง้ขๆฟๅฏๅๆ็ฃๆง 5 ๅไธๅๆ้็ดๅฅ็่ถจๅข็ๆ
ใ
* ่ฅไธๅ้ฑๆๅจๅไธๆ น K ๆฃๅบ็พ็ธๅ่จ่๏ผๆๆจ่จ็บใ่ก็ชใใ
5. **้ๆฟพ้่ค่จ่๏ผ**
* ๅฏๅพ้ธใๅช้กฏ็คบๅ่ฝใใ่ฅ็ถๅๆฏๅค้ ญ๏ผ็ณป็ตฑๆ้ฑ่ๅพ็บ็ๅค้ ญ่จ่๏ผ็ดๅฐๅบ็พ็ฉบ้ ญ่จ่็บๆญข (ๅ็พ๏ผๅค -> ็ฉบ -> ๅค)ใ
6. **ๆๆฉ App ้็ฅ๏ผ**
* ๆฏๆด้ๅฐ็นๅฎ้ฑๆ็ๅ่ฝ่จ่็ผ้ๆจๆญ้็ฅใ
**ไฝฟ็จ่ชชๆ๏ผ**
* **็ถ ่ฒ่็ท**๏ผๅค้ ญ็ขบ่ช (ๅฏฆ้ซ็ช็ ด + ๅ่ธฉ)ใ
* **็ด
่ฒ่็ท**๏ผ็ฉบ้ ญ็ขบ่ช (ๅฏฆ้ซ่ท็ ด + ๅ่ธฉ)ใ
* **ๅ่กจๆฟ**๏ผโฒ = ๅค้ ญ่ถจๅข๏ผโผ = ็ฉบ้ ญ่ถจๅขใ
Rate Trail IndicatorRate Trail Indicator Precision Trailing Stop & Multi-Timeframe Highs
Description The Rate Trail Indicator V2 is a professional-grade risk management tool designed to declutter your charts while providing precise, dynamic stop-loss levels. Unlike traditional indicators that paint a continuous "trail" or history across the chart, this script utilizes a Single Line visual approach. It draws only the currently active stop-loss level as a distinct horizontal line, keeping your workspace clean and focused on current price action.
This updated version now includes extensive Multi-Timeframe (MTF) Support, allowing you to overlay key Intraday and Higher Timeframe (HTF) highs directly on your chart.
Key Features Clean "Single Line" Visuals: Removes historical noise by plotting only the active stop-loss level and a dedicated price label. Dual Logic Modes: Percentage Mode: Classic trailing stop based on a percentage drop from the high. Renko Mode: Volatility-based stop that counts exact "Bricks" (supports decimals like 1.5 bricks). Dynamic Reset: The stop trails the "Lifetime High" of the current trend. If the stop is breached, it automatically resets to the current price to begin a new trail immediately. MTF High Breakout Levels: Optional toggles to display previous Intraday Highs (2H, 4H, 6H, 12H) and Historical Highs (1W, 2W, 1M, 3M). Rolling 3-Month Logic: The 3M level now uses a "Rolling" lookback (Highest of the last 3 monthly candles) rather than a fixed calendar quarter, ensuring the data is always recent and relevant. Full Customization: Control line styles (Solid, Dashed, Dotted), colors, and widths for every level independently via the inputs.
How to Use & Settings
1. Main Trailing Stop Setup Configure your primary risk line (Red Line) in the "Main Trailing Stop" group. Stop-Loss Mode: Select Percentage for standard equity/crypto trading (e.g., 2% trail) or Renko Boxes for Renko charts. Renko Boxes Down: Enter the number of bricks to trail. You can use decimals (e.g., 1.5) for fine-tuning. Use Fixed Lookback?: Unchecked (Default): The script tracks the "Infinite High" since the last reset. This is ideal for catching long trends. Checked: The script only looks at the highest price of the last X bars. This creates a more "rolling" stop-loss.
2. Intraday & Historical Highs (Resistance/Breakout) Enable up to eight additional lines to see where the price peaked on other timeframes. These act as strong breakout or resistance levels. Intraday Highs: Show the high of the previous 2H, 4H, 6H, or 12H session. 1W / 1M Highs: The highest price of the previous Week or Month. 2W High: The highest price of the last 2 Weeks . 3M High (Updated): The highest price of the last 3 Months (Rolling). This updates monthly, ensuring you aren't looking at data that is 6 months old.
3. Alerts You can set specific alerts to automate your trading or get notified instantly. Main Stop Breached: Fires when price closes below your trailing stop line. MTF High Cross: Fires when price crosses under any of the enabled Intraday or HTF High levels (2H, 4H, 1W, 3M, etc.).
OCC Strategy Optimized (MA 5 + Delayed TSL)# OCC Strategy Optimized (MA 5 + Delayed TSL) - User Guide
## Introduction
The **OCC Strategy Optimized** is an enhanced version of the classic **Open Close Cross (OCC)** strategy. This strategy is designed for high-precision trend following, utilizing the crossover logic of Open and Close moving averages to identify market shifts. This optimized version incorporates advanced risk management, multi-timeframe analysis, and a variety of moving average types to provide a robust trading solution for modern markets.
>
> **Special Thanks:** This strategy is based on the original work of **JustUncleL**, a renowned Pine Script developer. You can find their work and profile on TradingView here: (in.tradingview.com).
---
## Key Features
### 1. Optimized Core Logic
- **MA Period (Default: 5):** The strategy is tuned with a shorter MA length to reduce lag and capture trends earlier.
- **Crossing Logic:** Signals are generated when the Moving Average of the **Close** crosses the Moving Average of the **Open**.
### 2. Multi-Timeframe (MTF) Analysis
- **Alternate Resolution:** Use a higher timeframe (Resolution Multiplier) to filter out noise. By default, it uses $3 \times$ your current chart timeframe to confirm the trend.
- **Non-Repainting:** Includes an optional delay offset to ensure signals are confirmed and do not disappear (repaint) after the bar closes.
### 3. Advanced Risk Management
This script features a hierarchical exit system to protect your capital and lock in profits:
- **Fixed Stop Loss (Initial):** Protects against sudden market reversals immediately after entry.
- **Delayed Trailing Stop Loss (TSL):**
- **Activation Delay:** The TSL only activates after the trade reaches a specific profit threshold (e.g., 1%). This prevents being stopped out too early in the trade's development.
- **Ratchet Trail:** Once activated, the stop loss "ratchets" up/down, never moving backward, ensuring you lock in profits as the trend continues.
- **Take Profit (TP):** A fixed percentage target to exit the trade at a pre-defined profit level.
### 4. Versatility
- **12 MA Types:** Choose from SMA, EMA, DEMA, TEMA, WMA, VWMA, SMMA, HullMA, LSMA, ALMA, SSMA, and TMA.
- **Trade Direction:** Toggle between Long-only, Short-only, or Both.
- **Visuals:** Optional bar coloring to visualize the trend directly on the candlesticks.
---
## User Input Guide
### Core Settings
- **Use Alternate Resolution?:** Enable this to use the MTF logic.
- **Multiplier for Alternate Resolution:** How many charts higher the "filter" timeframe should be.
- **MA Type:** Select your preferred moving average smoothing method.
- **MA Period:** The length of the Open/Close averages.
- **Delay Open/Close MA:** Use `1` or higher to force non-repainting behavior.
### Risk Management Settings
- **Use Trailing Stop Loss?:** Enables the TSL system.
- **Trailing Stop %:** The distance the stop follows behind the price (Optimized Default: 1.5%).
- **TSL Activation % (Delay):** The profit % required before the TSL starts moving. (Optimized Default: 2.0% to ensure 0.5% profit is locked immediately).
- **Initial Fixed Stop Loss %:** Your hard stop if the trade immediately goes against you.
- **Take Profit %:** Your ultimate profit target for the trade.
---
## How to Trade with This Strategy
1. **Identify the Trend:** Look for the Moving Average lines (Close vs Open) to cross.
2. **Wait for Confirmation:** If using MTF, ensure the higher timeframe also shows a trend change.
3. **Manage the Trade:** Let the TSL work. With the default **2.0% Activation** and **1.5% Trail**, the strategy will automatically lock in **0.5% profit** the moment the threshold is hit, then follow the price higher.
4. **Position Sizing:** Adjust the `Properties` tab in the script settings to match your desired capital allocation (Default is 10% of equity).
---
## Recommended Settings
1. Trialing < Activation
2. Check ranging
## Credits
Original Strategy by: **JustUncleL**
Optimized and Enhanced by: **Antigravity AI**
Composite Fear & Greed IndexComposite Fear & Greed Index
This is an advanced, professional-grade sentiment analysis engine designed to quantify market psychology. Unlike standard oscillators that rely on a single metric, this script uses a weighted composite of four distinct technical components to generate a holistic "Fear & Greed" score.
It includes Multi-Timeframe (MTF) capabilities, proprietary FOMO/Panic detection logic, and Zero-Lag trend analysis.
1. Unique Mathematical Methodology
This script is not a simple overlay of existing indicators. It uses a Composite Normalization Engine to blend four distinct metrics into a single, bounded 0-100 oscillator.
The "Mashup" Problem Solved: Standard indicators like MACD are "unbounded" (they can go to infinity), while RSI is "bounded" (0-100). You cannot simply average them.
Our Solution: This script calculates the Z-Score of the MACD histogram relative to its historical deviation and normalizes it into a 0-100 percentile. This allows for a mathematically valid combination with RSI and Bollinger Bands.
The Component Logic:
Momentum (RSI): (Weight: 30%) Pure price velocity.
Volatility (Bollinger %B): (Weight: 25%) Relative position within volatility bands.
Trend Strength (Normalized MACD): (Weight: 25%) Uses the custom Z-Score logic described above.
Trend Integrity (ZLEMA): (Weight: 20%) We replaced the standard SMA with a custom Zero-Lag Exponential Moving Average (ZLEMA) algorithm. This removes the "lag" associated with traditional sentiment analysis, allowing the index to react to crypto volatility in real-time.
The Calculation: These raw values are weighted and smoothed to produce the final Index Value.
Greater than 80: Extreme Greed (High risk of reversal)
Less than 20: Extreme Fear (Potential accumulation zone)
2. Unique Features
A. FOMO & Panic Event Detection The script does not just track price; it tracks behavior.
FOMO (Fear Of Missing Out): Triggered when Price breaks the Upper Bollinger Band + RSI is Overbought + Volume spikes > 2.5x the average. This often marks local tops.
PANIC: Triggered when Price drops significantly in one bar + Volume spikes > 3.0x the average + RSI is Oversold. This often marks capitulation bottoms.
B. Divergence Detection The script automatically detects and plots Regular Bullish and Bearish divergences between Price and the Sentiment Index.
Bullish Divergence: Price makes a Lower Low, but Sentiment makes a Higher Low (indicating waning selling pressure).
Bearish Divergence: Price makes a Higher High, but Sentiment makes a Lower High (indicating waning buying pressure). Note: The script plots these signals precisely on the indicator line corresponding to the pivot point.
C. Multi-Timeframe (MTF) Engine Users can view the "Daily" sentiment score while trading on a 5-minute or 15-minute chart. This allows scalpers to align their trades with the higher-timeframe market psychology.
3. Usage Guide
Step 1: Trend Alignment Look at the dashboard or the main line color. Green indicates Greed/Uptrend, Red indicates Fear/Downtrend.
Step 2: Extremes
Sell/Take Profit: When the Index crosses 80 (Extreme Greed) or a "FOMO" triangle appears.
Buy/Long: When the Index crosses 20 (Extreme Fear) or a "PANIC" triangle appears.
Step 3: Confirmation Use the Divergence Dots as confirmation. A "Panic" signal followed by a "Bullish Divergence" dot is a high-probability reversal setup.
Settings
Timeframe: Select the MTF resolution (default is Chart).
Weights: You can adjust the influence of RSI, MACD, BB, or Trend to fit your specific asset class.
Visuals: Fully customizable colors, table position, and toggle switches for shapes/backgrounds.
Disclaimer: This script is for informational purposes only and does not constitute financial advice.
Antigravity OCC Strategy (MA 5 + Delayed TSL)# OCC Strategy Optimized (MA 5 + Delayed TSL) - User Guide
## Introduction
The **OCC Strategy Optimized** is an enhanced version of the classic **Open Close Cross (OCC)** strategy. This strategy is designed for high-precision trend following, utilizing the crossover logic of Open and Close moving averages to identify market shifts. This optimized version incorporates advanced risk management, multi-timeframe analysis, and a variety of moving average types to provide a robust trading solution for modern markets.
>
> **Special Thanks:** This strategy is based on the original work of **JustUncleL**, a renowned Pine Script developer. You can find their work and profile on TradingView here: (in.tradingview.com).
---
## Key Features
### 1. Optimized Core Logic
- **MA Period (Default: 5):** The strategy is tuned with a shorter MA length to reduce lag and capture trends earlier.
- **Crossing Logic:** Signals are generated when the Moving Average of the **Close** crosses the Moving Average of the **Open**.
### 2. Multi-Timeframe (MTF) Analysis
- **Alternate Resolution:** Use a higher timeframe (Resolution Multiplier) to filter out noise. By default, it uses $3 \times$ your current chart timeframe to confirm the trend.
- **Non-Repainting:** Includes an optional delay offset to ensure signals are confirmed and do not disappear (repaint) after the bar closes.
### 3. Advanced Risk Management
This script features a hierarchical exit system to protect your capital and lock in profits:
- **Fixed Stop Loss (Initial):** Protects against sudden market reversals immediately after entry.
- **Delayed Trailing Stop Loss (TSL):**
- **Activation Delay:** The TSL only activates after the trade reaches a specific profit threshold (e.g., 1%). This prevents being stopped out too early in the trade's development.
- **Ratchet Trail:** Once activated, the stop loss "ratchets" up/down, never moving backward, ensuring you lock in profits as the trend continues.
- **Take Profit (TP):** A fixed percentage target to exit the trade at a pre-defined profit level.
### 4. Versatility
- **12 MA Types:** Choose from SMA, EMA, DEMA, TEMA, WMA, VWMA, SMMA, HullMA, LSMA, ALMA, SSMA, and TMA.
- **Trade Direction:** Toggle between Long-only, Short-only, or Both.
- **Visuals:** Optional bar coloring to visualize the trend directly on the candlesticks.
---
## User Input Guide
### Core Settings
- **Use Alternate Resolution?:** Enable this to use the MTF logic.
- **Multiplier for Alternate Resolution:** How many charts higher the "filter" timeframe should be.
- **MA Type:** Select your preferred moving average smoothing method.
- **MA Period:** The length of the Open/Close averages.
- **Delay Open/Close MA:** Use `1` or higher to force non-repainting behavior.
### Risk Management Settings
- **Use Trailing Stop Loss?:** Enables the TSL system.
- **Trailing Stop %:** The distance the stop follows behind the price.
- **TSL Activation % (Delay):** The profit % required before the TSL starts moving.
- **Initial Fixed Stop Loss %:** Your hard stop if the trade immediately goes against you.
- **Take Profit %:** Your ultimate profit target for the trade.
---
## How to Trade with This Strategy
1. **Identify the Trend:** Look for the Moving Average lines (Close vs Open) to cross.
2. **Wait for Confirmation:** If using MTF, ensure the higher timeframe also shows a trend change.
3. **Manage the Trade:** Let the TSL work. Once the trade hits the activation threshold, the TSL will take over, protecting your runner.
4. **Position Sizing:** Adjust the `Properties` tab in the script settings to match your desired capital allocation (Default is 10% of equity).
---
## Credits
Original Strategy by: **JustUncleL**
Optimized and Enhanced by: **Antigravity AI**
MACD + Divergence Indicator [Dynamic Filter]Title: MACD + Divergence
Description: This is an enhanced momentum analysis suite based on the classic Moving Average Convergence Divergence (MACD). It addresses the common weakness of the standard MACDโfalse signals during low-volatility consolidationโby integrating a Dynamic Volatility Filter and a Multi-Timeframe (MTF) Dashboard.
The Problem It Solves: Standard MACD indicators often generate "whipsaw" crossovers when the market is ranging (moving sideways). Traders often struggle to identify these consolidation zones until it is too late. This script solves this by calculating a dynamic "Consolidation Zone" based on Standard Deviation, visually warning traders when momentum is too weak to be reliable.
Key Features:
1. Dynamic Consolidation Filter (The Grey Zone)
The script calculates Upper and Lower bands around the MACD line using Standard Deviation (Volatility).
Grey Fill: When the MACD line is inside the grey bands, the market is in a "Squeeze" or low-volatility consolidation. Crossovers in this zone are often lower probability.
Breakout: When the MACD line exits the bands, it indicates a volatility expansion and a potentially stronger trend.
2. Automated Divergence Detection
Automatically scans for both Regular (Reversal) and Hidden (Continuation) divergences between Price and Momentum.
Bullish: Marked with Green lines/labels.
Bearish: Marked with Red lines/labels.
Customization: You can choose to calculate divergence based on the MACD Line or the Histogram via settings.
3. Multi-Timeframe (MTF) Dashboard
A customizable information table (optional) displays the MACD state across 4 different timeframes (e.g., 15m, 1H, 4H, Daily).
It checks for Trend Alignment (e.g., are all timeframes Bullish?) to help you trade in the direction of the higher timeframes.
4. Enhanced Visuals
4-Color Histogram: Visualizes momentum growing (bright) vs. momentum fading (pale) for both bullish and bearish phases.
Line Highlights: The MACD and Signal lines are clearly distinct, with configurable smoothing options (EMA/SMA).
Settings Guide:
Consolidation Filter: Increase the Dynamic Filter Multiplier (Default: 0.5) to widen the grey zone if you want to filter out more noise.
Oscillator Source: Switch between "MACD Line" or "Histogram" for divergence detection depending on your strategy.
Table: You can toggle the dashboard on/off or change its position to fit your chart layout.
Credits: Base MACD logic derived from standard technical analysis concepts. Dynamic filtering logic adapted from volatility band theories.
DarkPool's Gann High Low Activator DarkPool's Gann High-Low Activator.
It enhances the traditional trend-following logic by integrating Heikin Ashi smoothing, Multi-Timeframe (MTF) analysis, and volatility filtering. It is designed to filter out market noise and provide clearer trend signals during volatile conditions.
Underlying Concepts
Heikin Ashi Smoothing: Standard price candles can produce erratic signals due to wicks and short-term volatility. This script includes a "Calculation Mode" setting that allows the Gann logic to run on Heikin Ashi average prices. This smoothes out price data, helping traders stay in trends longer by ignoring temporary pullbacks.
Gann High-Low Logic: The core algorithm tracks the Simple Moving Average (SMA) of Highs and Lows over a user-defined period.
Bullish Trend: Price closes above the trailing SMA of Highs.
Bearish Trend: Price closes below the trailing SMA of Lows.
Volatility & Trend Filtering: To reduce false signals during sideways markets, this tool employs two filters:
ADX Filter (Choppiness): Uses the Average Directional Index to detect low-volatility environments. If the ADX is below the defined threshold (default 20), the indicator identifies the market as "choppy" and suppresses signals to preserve capital.
EMA Filter (Baseline): An optional Exponential Moving Average filter ensures trades are only taken in the direction of the longer-term trend (e.g., Longs only above the 200 EMA).
Features
Dual Calculation Modes: Switch between Standard price logic and Heikin Ashi smoothing logic.
Multi-Timeframe (MTF): Calculate the trend based on a higher timeframe (e.g., 4-Hour) while viewing a lower timeframe chart (e.g., 15-Minute).
Automated JSON Alerts: Generates machine-readable JSON alert payloads compatible with external trading bots and webhooks.
Live Dashboard: A data table displaying the current Trend State, Calculation Mode, ADX Value, and risk percentage.
How to Use
Buy Signal: Generated when the trend flips Bullish, provided the ADX indicates sufficient momentum and the price satisfies the EMA filter (if enabled).
Sell Signal: Generated when the trend flips Bearish, subject to the same momentum and trend filters.
Neutral State (Gray Cloud): When the cloud fill turns gray, the market is in consolidation. It is recommended to avoid entering new positions during this state.
Trailing Stop: The Gann Line serves as a dynamic trailing stop-loss level. A close beyond this line invalidates the current trend.
Settings Configuration
Calculation Mode: Select "Standard" for raw price action or "Heikin Ashi" for smoothed trend following.
Gann Length: Lower values (3-5) are suitable for short-term scalping; higher values (10+) are better for swing trading.
MTF Mode: Enable to lock the calculation to a specific higher timeframe.
ADX Threshold: Adjust based on asset volatility. Recommended: 20-25 for Crypto, 15-20 for Forex/Indices.
Disclaimer
This source code and the information presented here are for educational purposes only. This script does not constitute financial advice, trading recommendations, or a solicitation to buy or sell any financial instruments. Trading in financial markets involves a high degree of risk and may not be suitable for all investors. Past performance is not indicative of future results. The author assumes no responsibility for any losses incurred while using this indicator. Use this tool at your own discretion and risk.
Smart MACD Divergence ScannerOriginal Base Indicator: "CM_MacD_Ult_MTF" by ChrisMoody
This indicator builds upon ChrisMoody's excellent multi-timeframe MACD foundation and transforms it into a professional divergence scanner with advanced quality assessment and filtering capabilities. The original MACD visualization and MTF functionality have been preserved while adding completely new divergence detection, scoring, and filtering systems.
๐ฏ What Makes This Indicator Unique:
Smart MACD Divergence Scanner is a professional tool for detecting MACD-based divergences with an advanced filtering system and signal quality assessment. Unlike standard divergence indicators, this version includes innovative features:
Adaptive Quality Scoring System โ each signal receives a score from 0 to 100 based on multiple factors
Volatility Filter โ automatic signal suppression during low market volatility periods
Multi-Timeframe Confirmation โ divergence verification on higher timeframe for increased reliability
Divergence Strength Analysis โ calculation of percentage difference between price and indicator movement
Information Dashboard โ detailed real-time signal statistics
Cooldown System โ prevention of multiple consecutive signals
๐ก How It Works:
The indicator uses the classic divergence concept โ the divergence between price movement and the MACD oscillator. However, instead of simple pivot detection, the algorithm:
Scans the market for local extremes (pivots) on price and MACD histogram
Searches for divergences โ when price updates low/high while MACD shows opposite movement
Assesses quality โ analyzes divergence strength, volatility, higher timeframe confirmation
Filters noise โ eliminates weak signals through threshold system and cooldown
Generates signal โ only when all quality criteria are met
๐ง Key Parameters:
MACD Settings: Fast Length (12), Slow Length (26), Signal Length (9)
Divergence Detection: Pivot Lookback (5), Max Lookback Range (60), Min Divergence Strength (15%)
Quality Filters: Min Quality Score (60), Volatility Filter, MTF Confirmation, Signal Cooldown (5)
๐ How to Use:
Add indicator to chart โ it will automatically start scanning
Configure filters โ start with default settings, then adapt to your trading style
Watch for signals: ๐ข Green "BUY" label = bullish divergence, ๐ด Red "SELL" label = bearish divergence
Check quality score on labels (Q: XX)
Use information panel to monitor statistics and current market conditions
โ๏ธ Settings Guide:
For swing trading (4H-Daily): Increase Pivot Lookback to 7-10, set Min Quality Score to 70+
For day trading (15m-1H): Keep default settings, enable all filters
For scalping (1m-5m): Decrease Min Quality Score to 50, disable MTF Confirmation
For volatile markets (crypto): Increase Min Divergence Strength to 20-25%, enable Volatility Filter
โ ๏ธ Important Notes:
Divergences are probabilistic signals, not guaranteed reversals
Use additional confirmation (support/resistance levels, volume, price action)
Adjust parameters for specific asset and timeframe
Signals appear with Pivot Lookback bars delay (retrospective confirmation)
On volatile markets, increase Min Quality Score to reduce false signals
Momentum Divergence Oscillator by JJMomentum Divergence Oscillator by JJ
A powerful, all-in-one momentum tool designed to streamline trade confluence, combining multi-timeframe trend analysis with automatic divergence spotting and classic MACD signals.
How to Use This Indicator
This oscillator is designed to be used in the lower pane of your chart, beneath your primary price chart. It provides three main types of signals:
1. Multi-Timeframe (MTF) Trend Confirmation
The background shading is your primary trend filter. It looks at the MACD trend on two higher timeframes (30m and 60m by default) to confirm the market's overarching direction.
Green Shading: Indicates that both higher timeframes are in a bullish trend (MACD above signal line). Focus on looking for BUY signals during this time.
Red Shading: Indicates that both higher timeframes are in a bearish trend. Focus on looking for SELL signals during this time.
Grey/No Shading: The higher timeframes are not in agreement or are consolidating. Exercise caution or stick to standard price action rules.
2. Automatic Divergence Signals
Divergence is a powerful early warning system where the indicator moves in the opposite direction of the price. The indicator automatically flags these occurrences:
"Bull RSI Div" (Green Label-Up): Bullish divergence identified using the RSI oscillator. This suggests a potential reversal to the upside after a downtrend.
"Bear RSI Div" (Red Label-Down): Bearish divergence identified using the RSI oscillator. This suggests a potential reversal to the downside after an uptrend.
Tip: These signals are often most reliable when they occur within the corresponding MTF background colour (e.g., a "Bull RSI Div" during a Green MTF background).
3. Momentum Shifts and Crossovers
The standard plots provide immediate insight into market momentum:
Blue/Orange Lines: The traditional MACD line (Blue) and Signal line (Orange).
Histogram (Green/Red Bars): Represents the momentum difference between the MACD and Signal lines.
Zero-Line Crosses (Triangles): Tiny triangles appear when the MACD line crosses the zero line, indicating a shift in long-term momentum.
Peaks & Troughs (X-Crosses): The 'X' markers identify local peaks and troughs in the histogram, sometimes indicating short-term exhaustion of the current move.
Disclaimer: Trading involves significant risk and is not suitable for every investor. This indicator is for educational purposes only and should not be considered financial advice. Always use appropriate risk management.
LibTmFrLibrary "LibTmFr"
This is a utility library for handling timeframes and
multi-timeframe (MTF) analysis in Pine Script. It provides a
collection of functions designed to handle common tasks related
to period detection, session alignment, timeframe construction,
and time calculations, forming a foundation for
MTF indicators.
Key Capabilities:
1. **MTF Period Engine:** The library includes functions for
managing higher-timeframe (HTF) periods.
- **Period Detection (`isNewPeriod`):** Detects the first bar
of a given timeframe. It includes custom logic to handle
multi-month and multi-year intervals where
`timeframe.change()` may not be sufficient.
- **Bar Counting (`sinceNewPeriod`):** Counts the number of
bars that have passed in the current HTF period or
returns the final count for a completed historical period.
2. **Automatic Timeframe Selection:** Offers functions for building
a top-down analysis framework:
- **Automatic HTF (`autoHTF`):** Suggests a higher timeframe
(HTF) for broader context based on the current timeframe.
- **Automatic LTF (`autoLTF`):** Suggests an appropriate lower
timeframe (LTF) for granular intra-bar analysis.
3. **Timeframe Manipulation and Comparison:** Includes tools for
working with timeframe strings:
- **Build & Split (`buildTF`, `splitTF`):** Functions to
programmatically construct valid Pine Script timeframe
strings (e.g., "4H") and parse them back into their
numeric and unit components.
- **Comparison (`isHigherTF`, `isActiveTF`, `isLowerTF`):**
A set of functions to check if a given timeframe is
higher, lower, or the same as the script's active timeframe.
- **Multiple Validation (`isMultipleTF`):** Checks if a
higher timeframe is a practical multiple of the current
timeframe. This is based on the assumption that checking
if recent, completed HTF periods contained more than one
bar is a valid proxy for preventing data gaps.
4. **Timestamp Interpolation:** Contains an `interpTimestamp()`
function that calculates an absolute timestamp by
interpolating at a given percentage across a specified
range of bars (e.g., 50% of the way through the last
20 bars), enabling time calculations at a resolution
finer than the chart's native bars.
---
**DISCLAIMER**
This library is provided "AS IS" and for informational and
educational purposes only. It does not constitute financial,
investment, or trading advice.
The author assumes no liability for any errors, inaccuracies,
or omissions in the code. Using this library to build
trading indicators or strategies is entirely at your own risk.
As a developer using this library, you are solely responsible
for the rigorous testing, validation, and performance of any
scripts you create based on these functions. The author shall
not be held liable for any financial losses incurred directly
or indirectly from the use of this library or any scripts
derived from it.
buildTF(quantity, unit)
โโBuilds a Pine Script timeframe string from a numeric quantity and a unit enum.
The resulting string can be used with `request.security()` or `input.timeframe`.
โโParameters:
โโโโ quantity (int) : series int Number to specifie how many `unit` the timeframe spans.
โโโโ unit (series TFUnit) : series TFUnit The size category for the bars.
โโReturns: series string A Pine-style timeframe identifier, e.g.
"5S" โ 5-seconds bars
"30" โ 30-minute bars
"120" โ 2-hour bars
"1D" โ daily bars
"3M" โ 3-month bars
"24M" โ 2-year bars
splitTF(tf)
โโSplits a Pineโtimeframe identifier into numeric quantity and unit (TFUnit).
โโParameters:
โโโโ tf (string) : series string Timeframe string, e.g.
"5S", "30", "120", "1D", "3M", "24M".
โโReturns:
quantity series int The numeric value of the timeframe (e.g., 15 for "15", 3 for "3M").
unit series TFUnit The unit of the timeframe (e.g., TFUnit.minutes, TFUnit.months).
Notes on strings without a suffix:
โข Pure digits are minutes; if divisible by 60, they are treated as hours.
โข An "M" suffix is months; if divisible by 12, it is converted to years.
autoHTF(tf)
โโPicks an appropriate **higher timeframe (HTF)** relative to the selected timeframe.
It steps up along a coarse ladder to produce sensible jumps for topโdown analysis.
Mapping โ chosen HTF:
โค 1 min โ 60 (1h) โ ร60
โค 3 min โ 180 (3h) โ ร60
โค 5 min โ 240 (4h) โ ร48
โค 15 min โ D (1 day) โ ร26โร32 (regular session 6.5โ8 h)
> 15 min โ W (1 week) โ ร64โร80 for 30m; varies with input
โค 1 h โ W (1 week) โ ร32โร40
โค 4 h โ M (1 month) โ ร36โร44 (~22 trading days / month)
> 4 h โ 3M (3 months) โ ร36โร66 (e.g., 12hโร36โร44; 8hโร53โร66)
โค 1 day โ 3M (3 months) โ ร60โร66 (~20โ22 trading days / month)
> 1 day โ 12M (1 year) โ ร(252โ264)/quantity
โค 1 week โ 12M (1 year) โ ร52
> 1 week โ 48M (4 years) โ ร(208)/quantity
= 1 M โ 48M (4 years) โ ร48
> 1 M โ error ("HTF too big")
any โ error ("HTF too big")
Notes:
โข Inputs in months or years are restricted: only 1M is allowed; larger months/any years throw.
โข Returns a Pine timeframe string usable in `request.security()` and `input.timeframe`.
โโParameters:
โโโโ tf (string) : series string Selected timeframe (e.g., "D", "240", or `timeframe.period`).
โโReturns: series string Suggested higher timeframe.
autoLTF(tf)
โโSelects an appropriate **lower timeframe LTF)** for intraโbar evaluation
based on the selected timeframe. The goal is to keep intraโbar
loops performant while providing enough granularity.
Mapping โ chosen LTF:
โค 1 min โ 1S โ ร60
โค 5 min โ 5S โ ร60
โค 15 min โ 15S โ ร60
โค 30 min โ 30S โ ร60
> 30 min โ 60S (1m) โ ร31โร59 (for 31โ59 minute charts)
โค 1 h โ 1 (1m) โ ร60
โค 2 h โ 2 (2m) โ ร60
โค 4 h โ 5 (5m) โ ร48
> 4 h โ 15 (15m) โ ร24โร48 (e.g., 6hโร24, 8hโร32, 12hโร48)
โค 1 day โ 15 (15m) โ ร26โร32 (regular sessions ~6.5โ8h)
> 1 day โ 60 (60m) โ ร(26โ32) per day ร quantity
โค 1 week โ 60 (60m) โ ร32โร40 (โ5 sessions of ~6.5โ8h)
> 1 week โ 240 (4h) โ ร(8โ10) per week ร quantity
โค 1 M โ 240 (4h) โ ร33โร44 (~20โ22 sessions ร 6.5โ8h / 4h)
โค 3 M โ D (1d) โ ร(20โ22) per month ร quantity
> 3 M โ W (1w) โ ร(4โ5) per month ร quantity
โค 1 Y โ W (1w) โ ร52
> 1 Y โ M (1M) โ ร12 per year ร quantity
Notes:
โข Ratios for D/W/M are given as ranges because they depend on
**regular session length** (typically ~6.5โ8h, not 24h).
โข Returned strings can be used with `request.security()` and `input.timeframe`.
โโParameters:
โโโโ tf (string) : series string Selected timeframe (e.g., "D", "240", or timeframe.period).
โโReturns: series string Suggested lower TF to use for intraโbar work.
isNewPeriod(tf, offset)
โโReturns `true` when a new session-aligned period begins, or on the Nth bar of that period.
โโParameters:
โโโโ tf (string) : series string Target higher timeframe (e.g., "D", "W", "M").
โโโโ offset (simple int) : simple int 0 โ checks for the first bar of the new period.
1+ โ checks for the N-th bar of the period.
โโReturns: series bool `true` if the condition is met.
sinceNewPeriod(tf, offset)
โโCounts how many bars have passed within a higher timeframe (HTF) period.
For daily, weekly, and monthly resolutions, the period is aligned with the trading session.
โโParameters:
โโโโ tf (string) : series string Target parent timeframe (e.g., "60", "D").
โโโโ offset (simple int) : simple int 0 โ Running count for the current period.
1+ โ Finalized count for the Nth most recent *completed* period.
โโReturns: series int Number of bars.
isHigherTF(tf, main)
โโReturns `true` when the selected timeframe represents a
higher resolution than the active timeframe.
โโParameters:
โโโโ tf (string) : series string Selected timeframe.
โโโโ main (bool) : series bool When `true`, the comparison is made against the chart's main timeframe
instead of the script's active timeframe. Optional. Defaults to `false`.
โโReturns: series bool `true` if `tf` > active TF; otherwise `false`.
isActiveTF(tf, main)
โโReturns `true` when the selected timeframe represents the
exact resolution of the active timeframe.
โโParameters:
โโโโ tf (string) : series string Selected timeframe.
โโโโ main (bool) : series bool When `true`, the comparison is made against the chart's main timeframe
instead of the script's active timeframe. Optional. Defaults to `false`.
โโReturns: series bool `true` if `tf` == active TF; otherwise `false`.
isLowerTF(tf, main)
โโReturns `true` when the selected timeframe represents a
lower resolution than the active timeframe.
โโParameters:
โโโโ tf (string) : series string Selected timeframe.
โโโโ main (bool) : series bool When `true`, the comparison is made against the chart's main timeframe
instead of the script's active timeframe. Optional. Defaults to `false`.
โโReturns: series bool `true` if `tf` < active TF; otherwise `false`.
isMultipleTF(tf)
โโReturns `true` if the selected timeframe (`tf`) is a practical multiple
of the active skript's timeframe. It verifies this by checking if `tf` is a higher timeframe
that has consistently contained more than one bar of the skript's timeframe in recent periods.
The period detection is session-aware.
โโParameters:
โโโโ tf (string) : series string The higher timeframe to check.
โโReturns: series bool `true` if `tf` is a practical multiple; otherwise `false`.
interpTimestamp(offStart, offEnd, pct)
โโCalculates a precise absolute timestamp by interpolating within a bar range based on a percentage.
This version works with RELATIVE bar offsets from the current bar.
โโParameters:
โโโโ offStart (int) : series int The relative offset of the starting bar (e.g., 10 for 10 bars ago).
โโโโ offEnd (int) : series int The relative offset of the ending bar (e.g., 1 for 1 bar ago). Must be <= offStart.
โโโโ pct (float) : series float The percentage of the bar range to measure (e.g., 50.5 for 50.5%).
Values are clamped to the range.
โโReturns: series int The calculated, interpolated absolute Unix timestamp in milliseconds.






















