BRD Simple Moving Averages (12, 22, 55, 100, 200)Simple and clean moving averages. Easy to change the 5 values to your own in the script editor.
Movingavarage
RawCuts_01Library "RawCuts_01"
A collection of functions by:
mutantdog
The majority of these are used within published projects, some useful variants have been included here aswell.
This is volume one consisting mainly of smaller functions, predominantly the filters and standard deviations from Weight Gain 4000.
Also included at the bottom are various snippets of related code for demonstration. These can be copied and adjusted according to your needs.
A full up-to-date table of contents is located at the top of the main script.
WEIGHT GAIN FILTERS
A collection of moving average type filters with adjustable volume weighting.
Based upon the two most common methods of volume weighting.
'Simple' uses the standard method in which a basic VWMA is analogous to SMA.
'Elastic' uses exponential method found in EVWMA which is analogous to RMA.
Volume weighting is applied according to an exponent multiplier of input volume.
0 >> volume^0 (unweighted), 1 >> volume^1 (fully weighted), use float values for intermediate weighting.
Additional volume filter switch for smoothing of outlier events.
DIVA MODULAR DEVIATIONS
A small collection of standard and absolute deviations.
Includes the weightgain functionality as above.
Basic modular functionality for more creative uses.
Optional input (ct) for external central tendency (aka: estimator).
Can be assigned to alternative filter or any float value. Will default to internal filter when no ct input is received.
Some other useful or related functions included at the bottom along with basic demonstration use.
weightgain_sma(src, len, xVol, fVol)
Simple Moving Average (SMA): Weight Gain (Simple Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
Returns: Standard Simple Moving Average with Simple Weight Gain applied.
weightgain_hsma(src, len, xVol, fVol)
Harmonic Simple Moving Average (hSMA): Weight Gain (Simple Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
Returns: Harmonic Simple Moving Average with Simple Weight Gain applied.
weightgain_gsma(src, len, xVol, fVol)
Geometric Simple Moving Average (gSMA): Weight Gain (Simple Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
Returns: Geometric Simple Moving Average with Simple Weight Gain applied.
weightgain_wma(src, len, xVol, fVol)
Linear Weighted Moving Average (WMA): Weight Gain (Simple Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
Returns: Basic Linear Weighted Moving Average with Simple Weight Gain applied.
weightgain_hma(src, len, xVol, fVol)
Hull Moving Average (HMA): Weight Gain (Simple Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
Returns: Basic Hull Moving Average with Simple Weight Gain applied.
diva_sd_sma(src, len, xVol, fVol, ct)
Standard Deviation (SD SMA): Diva / Weight Gain (Simple Volume)
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
ct (float) : Central tendency (optional, na = bypass). Internal: weightgain_sma().
Returns:
diva_sd_wma(src, len, xVol, fVol, ct)
Standard Deviation (SD WMA): Diva / Weight Gain (Simple Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
ct (float) : Central tendency (optional, na = bypass). Internal: weightgain_wma().
Returns:
diva_aad_sma(src, len, xVol, fVol, ct)
Average Absolute Deviation (AAD SMA): Diva / Weight Gain (Simple Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
ct (float) : Central tendency (optional, na = bypass). Internal: weightgain_sma().
Returns:
diva_aad_wma(src, len, xVol, fVol, ct)
Average Absolute Deviation (AAD WMA): Diva / Weight Gain (Simple Volume) .
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
ct (float) : Central tendency (optional, na = bypass). Internal: weightgain_wma().
Returns:
weightgain_ema(src, len, xVol, fVol)
Exponential Moving Average (EMA): Weight Gain (Elastic Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
Returns: Exponential Moving Average with Elastic Weight Gain applied.
weightgain_dema(src, len, xVol, fVol)
Double Exponential Moving Average (DEMA): Weight Gain (Elastic Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
Returns: Double Exponential Moving Average with Elastic Weight Gain applied.
weightgain_tema(src, len, xVol, fVol)
Triple Exponential Moving Average (TEMA): Weight Gain (Elastic Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
Returns: Triple Exponential Moving Average with Elastic Weight Gain applied.
weightgain_rma(src, len, xVol, fVol)
Rolling Moving Average (RMA): Weight Gain (Elastic Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
Returns: Rolling Moving Average with Elastic Weight Gain applied.
weightgain_drma(src, len, xVol, fVol)
Double Rolling Moving Average (DRMA): Weight Gain (Elastic Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
Returns: Double Rolling Moving Average with Elastic Weight Gain applied.
weightgain_trma(src, len, xVol, fVol)
Triple Rolling Moving Average (TRMA): Weight Gain (Elastic Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
Returns: Triple Rolling Moving Average with Elastic Weight Gain applied.
diva_sd_ema(src, len, xVol, fVol, ct)
Standard Deviation (SD EMA): Diva / Weight Gain: (Elastic Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
ct (float) : Central tendency (optional, na = bypass). Internal: weightgain_ema().
Returns:
diva_sd_rma(src, len, xVol, fVol, ct)
Standard Deviation (SD RMA): Diva / Weight Gain: (Elastic Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
ct (float) : Central tendency (optional, na = bypass). Internal: weightgain_rma().
Returns:
weightgain_vidya_rma(src, len, xVol, fVol)
VIDYA v1 RMA base (VIDYA-RMA): Weight Gain (Elastic Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
Returns: VIDYA v1, RMA base with Elastic Weight Gain applied.
weightgain_vidya_ema(src, len, xVol, fVol)
VIDYA v1 EMA base (VIDYA-EMA): Weight Gain (Elastic Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
Returns: VIDYA v1, EMA base with Elastic Weight Gain applied.
diva_sd_vidya_rma(src, len, xVol, fVol, ct)
Standard Deviation (SD VIDYA-RMA): Diva / Weight Gain: (Elastic Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
ct (float) : Central tendency (optional, na = bypass). Internal: weightgain_vidya_rma().
Returns:
diva_sd_vidya_ema(src, len, xVol, fVol, ct)
Standard Deviation (SD VIDYA-EMA): Diva / Weight Gain: (Elastic Volume).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
xVol (float) : Volume exponent multiplier (0 = unweighted, 1 = fully weighted).
fVol (bool) : Volume smoothing filter.
ct (float) : Central tendency (optional, na = bypass). Internal: weightgain_vidya_ema().
Returns:
weightgain_sema(src, len, xVol, fVol)
Parameters:
src (float)
len (simple int)
xVol (float)
fVol (bool)
diva_sd_sema(src, len, xVol, fVol)
Parameters:
src (float)
len (simple int)
xVol (float)
fVol (bool)
diva_mad_mm(src, len, ct)
Median Absolute Deviation (MAD MM): Diva (no volume weighting).
Parameters:
src (float) : Source input.
len (int) : Length (number of bars).
ct (float) : Central tendency (optional, na = bypass). Internal: ta.median()
Returns:
source_switch(slct, aux1, aux2, aux3, aux4)
Custom Source Selector/Switch function. Features standard & custom 'weighted' sources with additional aux inputs.
Parameters:
slct (string) : Choose from custom set of string values.
aux1 (float) : Additional input for user-defined source, eg: standard input.source(). Optional, use na to bypass.
aux2 (float) : Additional input for user-defined source, eg: standard input.source(). Optional, use na to bypass.
aux3 (float) : Additional input for user-defined source, eg: standard input.source(). Optional, use na to bypass.
aux4 (float) : Additional input for user-defined source, eg: standard input.source(). Optional, use na to bypass.
Returns: Float value, to be used as src input for other functions.
colour_gradient_ma_div(ma1, ma2, div, bull, bear, mid, mult)
Colour Gradient for plot fill between two moving averages etc, with seperate bull/bear and divergence strength.
Parameters:
ma1 (float) : Input for fast moving average (eg: bullish when above ma2).
ma2 (float) : Input for slow moving average (eg: bullish when below ma1).
div (float) : Input deviation/divergence value used to calculate strength of colour.
bull (color) : Colour when ma1 above ma2.
bear (color) : Colour when ma1 below ma2.
mid (color) : Neutral colour when ma1 = ma2.
mult (int) : Opacity multiplier. 100 = maximum, 0 = transparent.
Returns: Colour with transparency (according to specified inputs)
Moving AveragesWhile this "Moving Averages" indicator may not revolutionize technical analysis, it certainly offers a valuable and efficient solution for traders seeking to streamline their chart analysis process. This all-in-one tool addresses a common frustration among traders: the need to constantly search for and compare different types and lengths of moving averages.
Key Features
The indicator allows for the configuration of up to 5 moving averages simultaneously, providing a comprehensive view of price trends. Users can choose from 7 types of moving averages for each line, including SMA, EMA, WMA, VWMA, HMA, SMMA, and TMA. This variety ensures that traders can apply their preferred moving average types without the need for multiple indicators.
Each moving average can be fully customized in terms of length, color, line style, and thickness, allowing for clear visual differentiation. However, what sets this indicator apart is its "Smart Opacity" feature. When activated, this option dynamically adjusts the transparency of the moving average lines based on their direction, with ascending lines appearing more opaque and descending lines more transparent. This subtle yet effective visual cue aids in quickly identifying trend changes and potential trading signals.
Advantages
The primary benefit of this indicator lies in its convenience. By consolidating multiple moving averages into a single, customizable tool, it saves traders valuable time and reduces chart clutter. The Smart Opacity feature, while not groundbreaking, does offer an intuitive way to visualize trend strength and direction at a glance.
Moreover, the indicator's flexibility makes it suitable for various trading styles and experience levels. Whether you're a novice trader learning to interpret basic trend signals or an experienced analyst fine-tuning a complex strategy, this tool can adapt to your needs.
In conclusion, while this "Moving Averages" indicator may not be a game-changer in the world of technical analysis, it represents a thoughtful refinement of a fundamental trading tool. By focusing on user convenience and visual clarity, it offers a practical solution for traders looking to optimize their chart analysis process and make more informed trading decisions.
Dynamic Score SMA [QuantAlgo]Dynamic Score SMA 📈🌊
The Dynamic Score SMA by QuantAlgo offers a powerful trend-following approach that combines the simplicity of the Simple Moving Average (SMA) with an innovative dynamic trend scoring technique . By continuously evaluating price movement relative to the SMA over a customizable window, this indicator adapts to varying market conditions, providing traders and investors with clearer, more adaptable trend signals. With this dynamic scoring approach, the Dynamic Score SMA helps identify trend shifts, allowing for more strategic decision-making.
🌟 Conceptual Foundation and Innovation
At the core of the Dynamic Score SMA is its dynamic trend score system , which assesses price movements by comparing them to the SMA over a series of historical data points. This technique goes beyond traditional SMA indicators by offering a dynamic, probabilistic evaluation of trend strength, delivering a more responsive and nuanced view of market direction. The integration of this scoring system enables traders and investors to navigate both trending and sideway markets with greater confidence and precision.
⚙️ Technical Composition and Calculation
The Dynamic Score SMA leverages the Simple Moving Average to establish a baseline trend, with customizable SMA length to control the indicator’s sensitivity. The dynamic trend scoring technique then evaluates price behavior relative to the SMA over a specified window, generating a trend score that reflects the current market bias.
When the score crosses the designated uptrend or downtrend thresholds, the indicator signals a potential trend shift. By adjusting the SMA length, window duration, and thresholds, users can refine the indicator’s responsiveness to match their preferred trading or investing strategy, making it suitable for both volatile and steady markets.
📈 Features and Practical Applications
Customizable SMA Length: Set the length of the SMA to control how sensitive the trend is to price changes. Longer lengths produce smoother trends, while shorter lengths increase responsiveness.
Window Length for Dynamic Scoring: Adjust the window length to determine how many data points are considered in the dynamic trend score calculation, allowing for more tailored analysis of recent versus long-term trends.
Uptrend/Downtrend Thresholds: Define thresholds for triggering trend signals. Higher thresholds reduce sensitivity, providing clearer signals in volatile markets, while lower thresholds capture shorter-term movements.
Bar and Background Coloring: Visual cues, including bar coloring and background fills, provide a quick reference for current trend direction, making it easier to monitor market conditions.
Trend Confirmation: The dynamic trend scoring system verifies trend strength, offering more reliable entry and exit points by filtering out potential false signals.
⚡️ How to Use
✅ Add the Indicator: Add the Dynamic Score SMA to your favourites, then apply it to your chart. Customize the SMA length, window size, and thresholds to match your trading or investing preferences.
👀 Monitor Trend Shifts: Observe the trend in relation to the SMA and watch for signals when the score crosses key thresholds. Bar and/or background coloring will help identify the current trend direction and any shifts in momentum.
🔔 Set Alerts: Configure alerts for significant trend crossovers and reversals, enabling you to act on market changes in real-time without needing constant chart observation.
💫 Summary and Usage Tips
The Dynamic Score SMA by QuantAlgo is a sophisticated trend-following indicator that combines the familiarity of the SMA with a dynamic trend scoring system, providing a more adaptable and probabilistic approach to trend analysis. By tailoring the SMA length, scoring window, and thresholds, traders and investors can fine-tune the indicator for both short-term adjustments and long-term trend following. For optimal use, adjust sensitivity based on market volatility, and rely on the visual cues for clear trend confirmation. Whether you’re navigating choppy markets or stable trends, the Dynamic Score SMA offers a refined approach to capturing market direction with enhanced precision.
CPR by NKDCentral Pivot Range (CPR) Trading Strategy:
The Central Pivot Range (CPR) is a widely-used tool in technical analysis, helping traders pinpoint potential support and resistance levels in the market. By using the CPR effectively, traders can better gauge market trends and determine favorable entry and exit points. This guide explores how the CPR works, outlines its calculation, and describes how traders can enhance their strategies using an extended 10-line version of CPR.
What Really Central Pivot Range (CPR) is?
At its core, the CPR consists of three key lines:
Pivot Point (PP) – The central line, calculated as the average of the previous day’s high, low, and closing prices.
Upper Range (R1) – Positioned above the Pivot Point, acting as a potential ceiling where price may face resistance.
Lower Range (S1) – Found below the Pivot Point, serving as a potential floor where price might find support.
Advanced traders often expand on the traditional three-line CPR by adding extra levels above and below the pivot, creating up to a 10-line system. This extended CPR allows for a more nuanced understanding of the market and helps identify more detailed trading opportunities.
Applying CPR for Trading Success
1. How CPR is Calculation
The CPR relies on the previous day's high (H), low (L), and close (C) prices to create its structure:
Pivot Point (PP) = (H + L + C) / 3
First Resistance (R1) = (2 * PP) - L
First Support (S1) = (2 * PP) - H
Additional resistance levels (R2, R3) and support levels (S2, S3) are calculated by adding or subtracting multiples of the previous day’s price range (H - L) from the Pivot Point.
2. Recognizing the Market Trend
To effectively trade using CPR, it’s essential to first determine whether the market is trending up (bullish) or down (bearish). In an upward-trending market, traders focus on buying at support levels, while in a downward market, they look to sell near resistance.
3. Finding Ideal Entry Points
Traders often look to enter trades when price approaches key levels within the CPR range. Support levels (S1, S2) offer buying opportunities, while resistance levels (R1, R2) provide selling opportunities. These points are considered potential reversal zones, where price may bounce or reverse direction.
4. Managing Risk with Stop-Loss Orders
Proper risk management is crucial in any trading strategy. A stop-loss should be set slightly beyond the support level for buy positions and above the resistance level for sell positions, ensuring that losses are contained if the market moves against the trader’s position.
5. Determining Profit Targets
Profit targets are typically set based on the distance between entry points and the next support or resistance level. Many traders apply a risk-reward ratio, aiming for larger potential profits compared to the potential losses. However, if the next resistance and support level is far then middle levels are used for targets (i.e. 50% of R1 and R2)
6. Confirmation Through Other Indicators
While CPR provides strong support and resistance levels, traders often use additional indicators to confirm potential trade setups. Indicators such as moving averages can
help validate the signals provided by the CPR.
7. Monitoring Price Action At CPR Levels
Constantly monitoring price movement near CPR levels is essential. If the price fails to break through a resistance level (R1) or holds firm at support (S1), it can offer cues on when to exit or adjust a trade. However, a strong price break past these levels often signals a continued trend.
8. Trading Breakouts with CPR
When the price breaks above resistance or below support with strong momentum, it may signal a potential breakout. Traders can capitalize on these movements by entering positions in the direction of the breakout, ideally confirmed by volume or other technical indicators.
9. Adapting to Changing Market Conditions
CPR should be used in the context of broader market influences, such as economic reports, news events, or geopolitical shifts. These factors can dramatically affect market direction and how price reacts to CPR levels, making it important to stay informed about external market conditions.
10. Practice and Backtesting for Improvements
Like any trading tool, the CPR requires practice. Traders are encouraged to backtest their strategies on historical price data to get a better sense of how CPR works in different market environments. Continuous analysis and practice help improve decision-making and strategy refinement.
The Advantages of Using a 10-Line CPR System
An extended 10-line CPR system—comprising up to five resistance and five support levels—provides more granular control and insight into market movements. This expanded view helps traders better gauge trends and identify more opportunities for entry and exit. Key benefits include:
R2, S2 Levels: These act as secondary resistance or support zones, giving traders additional opportunities to refine their trade entries and exits.
R3, S3 Levels: Provide an even wider range for identifying reversals or trend continuations in more volatile markets.
Flexibility: The broader range of levels allows traders to adapt to changing market conditions and make more precise decisions based on market momentum.
So in Essential:
The Central Pivot Range is a valuable tool for traders looking to identify critical price levels in the market. By providing a clear framework for identifying potential support and resistance zones, it helps traders make informed decisions about entering and exiting trades. However, it’s important to combine CPR with sound risk management and additional confirmation through other technical indicators for the best results.
Although no trading tool guarantees success, the CPR, when used effectively and combined with practice, can significantly enhance a trader’s ability to navigate market fluctuations.
Options Series - Supertrend, HalfTrend, Ichimoku Cloud and P_SAR➤ Supertrend:
➤ HalfTrend:
➤ Ichimoku Cloud:
➤ Parabolic SAR:
⭐ Overview and How It Works:
This script combines multiple popular technical indicators—Supertrend, HalfTrend, Ichimoku Cloud, and Parabolic SAR—into a single, cohesive tool for analyzing price trends and reversals. Designed for traders who prefer multi-layered confirmation, it displays non-overlay signals in a candlestick format, helping users make sense of intricate market dynamics. It also includes a "Master Candle" condition, which aggregates the signals from all indicators, providing a powerful snapshot of market sentiment.
References for study,
Supertrend and HalfTrend and Ichimoku Cloud and Parabolic SAR
⭐ Key Features and Functionality:
The script integrates four indicators and visually represents them in a non-overlay fashion, meaning that each indicator's signal appears on separate candlestick layers. It uses color coding to differentiate between bullish and bearish signals. The Master Candle is a unique feature that aggregates the signals from all indicators to show the overall sentiment.
Supertrend: It uses ATR and a multiplier factor to create a trailing stop, identifying bullish and bearish trends.
HalfTrend: It analyzes market volatility that provides buy and sell signals based on volatility channels and historical highs and lows.
Ichimoku Cloud: It leverages historical highs and lows to form the conversion and baseline, which are compared to assess market strength.
Parabolic SAR: A stop-and-reverse system that highlights potential reversals. It is based on time and price, offering traders potential reversal points.
Master Candle: It computes a score based on the confluence of all four indicators, adding another layer of confirmation.
🎨 Visualizations and User Experience:
The script's user interface is highly visual, with color-coded candlesticks plotted across multiple layers. Each indicator has its own color coding for bullish and bearish signals, ensuring clarity:
➤ Green for bullish signals.
➤ Red for bearish signals.
➤ Each candlestick layer represents a different indicator (e.g., Supertrend, HalfTrend, etc.), making it easy for the trader to isolate and interpret signals.
➤ The "Master Candle" provides an overarching view of the market by displaying a consolidated signal, which can reduce confusion from mixed indicator signals.
⭐ Settings and Customization:
The script is highly customizable, allowing users to adjust the settings for each indicator. Key customizable parameters include:
• Supertrend ATR Period and Factor
• HalfTrend Amplitude and Channel Deviation
• Ichimoku Conversion, Base, and Lagging Span Periods
• Parabolic SAR Start, Increment, and Maximum value
Additionally, users can toggle the visibility of each indicator and customize the look of the plot to suit their preferences.
⭐ Uniqueness of the Concept:
No repaints. This is the advanced representation and the combination of multiple indicators into a single script, along with a powerful "Master Candle" that aggregates them, makes this tool unique. Most scripts provide isolated indicator signals, while this one brings together four powerful indicators and visually simplifies the analysis. The non-overlay style and color-coded candlesticks offer traders an easy-to-understand, actionable visual cue, which stands out from traditional indicator overlays.
🚀 Conclusion:
This script is a comprehensive, multi-indicator trading tool suitable for traders looking for reliable trend-following and reversal detection. Its ability to provide an aggregated "Master Candle" signal reduces noise and aids in better decision-making. Customization options allow users to tailor it to their trading style, while its clear visualizations provide an excellent user experience.
Intramarket Difference Index StrategyIntramarket Difference Indicator (IDI) Strategy:
In layman’s terms this strategy compares two indicators across (correlated) markets and exploits their differences.
📍 Import Notes:
This Strategy calculates trade position size independently, this means that the ‘Order size’ input in the ‘Properties’ tab will have no effect on the strategy. Why ? because this allows us to define custom position size algorithms which we can use to improve our risk management and equity growth over time. Here we have the option to have fixed quantity or fixed percentage of equity ATR (Average True Range) based stops in addition to the turtle trading position size algorithm.
‘Pyramiding’ does not work for this strategy’, similar to the order size input togeling this input will have no effect on the strategy as the strategy explicitly defines the maximum order size to be 1.
This strategy is not perfect, and as of writing of this post I have not traded this algo.
Always take your time to backtests and debug the strategy.
🔷 The IDI Strategy:
By default this strategy pulls data from your current TV chart and then compares it to the base market, be default BINANCE:BTCUSD . The strategy pulls SMA and RSI data from either market (we call this the difference data), standardizes the data (solving the different unit problem across markets) such that it is comparable and then differentiates the data, calling the result of this transformation and difference the Intramarket Difference (ID). The formula for the the ID is
ID = market1_diff_data - market2_diff_data (1)
Where
market(i)_diff_data = diff_data / ATR(j)_market(i)^0.5,
where i = {1, 2} and j = the natural numbers excluding 0
Formula (1) interpretation is the following
When ID > 0: this means the current market outperforms the base market
When ID = 0: Markets are at long run equilibrium
When ID < 0: this means the current market underperforms the base market
To form the strategy we define one of two strategy type’s which are Trend and Mean Revesion respectively.
🔸 Trend Case:
Given the ‘‘Strategy Type’’ is equal to TREND we define a threshold for which if the ID crosses over we go long and if the ID crosses under the negative of the threshold we go short.
The motivating idea is that the ID is an indicator of the two symbols being out of sync, and given we know volatility clustering, momentum and mean reversion of anomalies to be a stylised fact of financial data we can construct a trading premise. Let's first talk more about this premise.
For some markets (cryptocurrency markets - synthetic symbols in TV) the stylised fact of momentum is true, this means that higher momentum is followed by higher momentum, and given we know momentum to be a vector quantity (with magnitude and direction) this momentum can be both positive and negative i.e. when the ID crosses above some threshold we make an assumption it will continue in that direction for some time before executing back to its long run equilibrium of 0 which is a reasonable assumption to make if the market are correlated. For example for the BTCUSD - ETHUSD pair, if the ID > +threshold (inputs for MA and RSI based ID thresholds are found under the ‘‘INTRAMARKET DIFFERENCE INDEX’’ group’), ETHUSD outperforms BTCUSD, we assume the momentum to continue so we go long ETHUSD.
In the standard case we would exit the market when the IDI returns to its long run equilibrium of 0 (for the positive case the ID may return to 0 because ETH’s difference data may have decreased or BTC’s difference data may have increased). However in this strategy we will not define this as our exit condition, why ?
This is because we want to ‘‘let our winners run’’, to achieve this we define a trailing Donchian Channel stop loss (along with a fixed ATR based stop as our volatility proxy). If we were too use the 0 exit the strategy may print a buy signal (ID > +threshold in the simple case, market regimes may be used), return to 0 and then print another buy signal, and this process can loop may times, this high trade frequency means we fail capture the entire market move lowering our profit, furthermore on lower time frames this high trade frequencies mean we pay more transaction costs (due to price slippage, commission and big-ask spread) which means less profit.
Note it is possible that after printing a buy the strategy then prints many sell signals before returning to a buy, which again has the same implications. The image below showcases the theory above, by allowing our winner to run we may capture more profit.
Valid trades are denoted by solid green and red arrows respectively and all other valid trades which occur within the original signal are light green and red small arrows, if we were to close our trades when the IDI returns to its equilibrium of 0 our average bars per trade would be very low and we would not capture the general trend.
Note by capturing the sum of many momentum moves we are essentially following the trend hence the trend following strategy type.
Here we also print the IDI (with default strategy settings with the MA difference type), we can see that by letting our winners run we may catch many valid momentum moves, that results in a larger final pnl that if we would otherwise exit based on the equilibrium condition.
Note if you would like to plot the IDI separately copy and paste the following code in a new Pine Script indicator template.
indicator("IDI")
// INTRAMARKET INDEX
var string g_idi = "intramarket diffirence index"
ui_index_1 = input.symbol("BINANCE:BTCUSD", title = "Base market", group = g_idi)
// ui_index_2 = input.symbol("BINANCE:ETHUSD", title = "Quote Market", group = g_idi)
type = input.string("MA", title = "Differrencing Series", options = , group = g_idi)
ui_ma_lkb = input.int(24, title = "lookback of ma and volatility scaling constant", group = g_idi)
ui_rsi_lkb = input.int(14, title = "Lookback of RSI", group = g_idi)
ui_atr_lkb = input.int(300, title = "ATR lookback - Normalising value", group = g_idi)
ui_ma_threshold = input.float(5, title = "Threshold of Upward/Downward Trend (MA)", group = g_idi)
ui_rsi_threshold = input.float(20, title = "Threshold of Upward/Downward Trend (RSI)", group = g_idi)
//>>+----------------------------------------------------------------+}
// CUSTOM FUNCTIONS |
//<<+----------------------------------------------------------------+{
// construct UDT (User defined type) containing the IDI (Intramarket Difference Index) source values
// UDT will hold many variables / functions grouped under the UDT
type functions
float Close // close price
float ma // ma of symbol
float rsi // rsi of the asset
float atr // atr of the asset
// the security data
getUDTdata(symbol, malookback, rsilookback, atrlookback) =>
indexHighTF = barstate.isrealtime ? 1 : 0
= request.security(symbol, timeframe = timeframe.period,
expression = [close , // Instentiate UDT variables
ta.sma(close, malookback) ,
ta.rsi(close, rsilookback) ,
ta.atr(atrlookback) ])
data = functions.new(close_, ma_, rsi_, atr_)
data
// Intramerket Difference Index
idi(type, symbol1, malookback, rsilookback, atrlookback, mathreshold, rsithreshold) =>
threshold = float(na)
index1 = getUDTdata(symbol1, malookback, rsilookback, atrlookback)
index2 = getUDTdata(syminfo.tickerid, malookback, rsilookback, atrlookback)
// declare difference variables for both base and quote symbols, conditional on which difference type is selected
var diffindex1 = 0.0, var diffindex2 = 0.0,
// declare Intramarket Difference Index based on series type, note
// if > 0, index 2 outpreforms index 1, buy index 2 (momentum based) until equalibrium
// if < 0, index 2 underpreforms index 1, sell index 1 (momentum based) until equalibrium
// for idi to be valid both series must be stationary and normalised so both series hae he same scale
intramarket_difference = 0.0
if type == "MA"
threshold := mathreshold
diffindex1 := (index1.Close - index1.ma) / math.pow(index1.atr*malookback, 0.5)
diffindex2 := (index2.Close - index2.ma) / math.pow(index2.atr*malookback, 0.5)
intramarket_difference := diffindex2 - diffindex1
else if type == "RSI"
threshold := rsilookback
diffindex1 := index1.rsi
diffindex2 := index2.rsi
intramarket_difference := diffindex2 - diffindex1
//>>+----------------------------------------------------------------+}
// STRATEGY FUNCTIONS CALLS |
//<<+----------------------------------------------------------------+{
// plot the intramarket difference
= idi(type,
ui_index_1,
ui_ma_lkb,
ui_rsi_lkb,
ui_atr_lkb,
ui_ma_threshold,
ui_rsi_threshold)
//>>+----------------------------------------------------------------+}
plot(intramarket_difference, color = color.orange)
hline(type == "MA" ? ui_ma_threshold : ui_rsi_threshold, color = color.green)
hline(type == "MA" ? -ui_ma_threshold : -ui_rsi_threshold, color = color.red)
🔸 Mean Reversion Case:
We stated prior that mean reversion of anomalies is an standerdies fact of financial data, how can we exploit this ?
We exploit this by normalizing the ID by applying the Ehlers fisher transformation. We now assume our series is approximately normally distributed. To form the strategy we employ the same logic as for e the z score, if the FT normalized ID >< 2.5 or -2.5 respectively we buy or short respectively. We also employ the same exit conditions (fixed ATR stop and trailing Donchian Trailing stop)
🔷 Position Sizing:
If ‘‘Fixed Risk From Initial Balance’’ is toggled true this means we risk a fixed percentage of our initial balance, if false we risk a fixed percentage of our equity (current balance).
Note we also employ a volatility adjusted position sizing formula, the turtle training method which is defined as follows.
Turtle position size = (1/ r * ATR * DV) * C
Where,
r = risk factor coefficient (default is 20)
ATR(j) = risk proxy, over j times steps
DV = Dollar Volatility, where DV = (1/Asset Price) * Capital at Risk
🔷 Risk Management:
Correct money management means we can limit risk and increase reward (theoretically). Here we employ
Max loss and gain per day
Max loss per trade
Max number of consecutive losing trades until trade skip
To read more see the tooltips (info circle).
Note the ATR stop losses and take profits are defined, with the prior being default.
ATR SL and TP defined
🔷 Hurst Regime (Regime Filter):
The Hurst Exponent (H) aims to segment the market into three different states, Trending (H > 0.5), Random Geometric Brownian Motion (H = 0.5) and Mean Reverting / Contrarian (H < 0.5). In my interpretation this can be used as a trend filter that eliminates market noise.
We utilize the trending and mean reverting based states, as extra conditions required for valid trades both strategy types respectively, in the process increasing our trade entry quality.
🔷 Example model Architecture:
Here is an example of one configuration of this strategy, combining all aspect discussed in this post.
Fear/Greed Zone Reversals [UAlgo]The "Fear/Greed Zone Reversals " indicator is a custom technical analysis tool designed for TradingView, aimed at identifying potential reversal points in the market based on sentiment zones characterized by fear and greed. This indicator utilizes a combination of moving averages, standard deviations, and price action to detect when the market transitions from extreme fear to greed or vice versa. By identifying these critical turning points, traders can gain insights into potential buy or sell opportunities.
🔶 Key Features
Customizable Moving Averages: The indicator allows users to select from various types of moving averages (SMA, EMA, WMA, VWMA, HMA) for both fear and greed zone calculations, enabling flexible adaptation to different trading strategies.
Fear Zone Settings:
Fear Source: Select the price data point (e.g., close, high, low) used for Fear Zone calculations.
Fear Period: This defines the lookback window for calculating the Fear Zone deviation.
Fear Stdev Period: This sets the period used to calculate the standard deviation of the Fear Zone deviation.
Greed Zone Settings:
Greed Source: Select the price data point (e.g., close, high, low) used for Greed Zone calculations.
Greed Period: This defines the lookback window for calculating the Greed Zone deviation.
Greed Stdev Period: This sets the period used to calculate the standard deviation of the Greed Zone deviation.
Alert Conditions: Integrated alert conditions notify traders in real-time when a reversal in the fear or greed zone is detected, allowing for timely decision-making.
🔶 Interpreting Indicator
Greed Zone: A Greed Zone is highlighted when the price deviates significantly above the chosen moving average. This suggests market sentiment might be leaning towards greed, potentially indicating a selling opportunity.
Fear Zone Reversal: A Fear Zone is highlighted when the price deviates significantly below the chosen moving average of the selected price source. This suggests market sentiment might be leaning towards fear, potentially indicating a buying opportunity. When the indicator identifies a reversal from a fear zone, it suggests that the market is transitioning from a period of intense selling pressure to a more neutral or potentially bullish state. This is typically indicated by an upward arrow (▲) on the chart, signaling a potential buy opportunity. The fear zone is characterized by high price volatility and overselling, making it a crucial point for traders to consider entering the market.
Greed Zone Reversal: Conversely, a Greed Zone is highlighted when the price deviates significantly above the chosen moving average. This suggests market sentiment might be leaning towards greed, potentially indicating a selling opportunity. When the indicator detects a reversal from a greed zone, it indicates that the market may be moving from an overbought condition back to a more neutral or bearish state. This is marked by a downward arrow (▼) on the chart, suggesting a potential sell opportunity. The greed zone is often associated with overconfidence and high buying activity, which can precede a market correction.
🔶 Why offer multiple moving average types?
By providing various moving average types (SMA, EMA, WMA, VWMA, HMA) , the indicator offers greater flexibility for traders to tailor the indicator to their specific trading strategies and market preferences. Different moving averages react differently to price data and can produce varying signals.
SMA (Simple Moving Average): Provides an equal weighting to all data points within the specified period.
EMA (Exponential Moving Average): Gives more weight to recent data points, making it more responsive to price changes.
WMA (Weighted Moving Average): Allows for custom weighting of data points, providing more flexibility in the calculation.
VWMA (Volume Weighted Moving Average): Considers both price and volume data, giving more weight to periods with higher trading volume.
HMA (Hull Moving Average): A combination of weighted moving averages designed to reduce lag and provide a smoother curve.
Offering multiple options allows traders to:
Experiment: Traders can try different moving averages to see which one produces the most accurate signals for their specific market.
Adapt to different market conditions: Different market conditions may require different moving average types. For example, a fast-moving market might benefit from a faster moving average like an EMA, while a slower-moving market might be better suited to a slower moving average like an SMA.
Personalize: Traders can choose the moving average that best aligns with their personal trading style and risk tolerance.
In essence, providing a variety of moving average types empowers traders to create a more personalized and effective trading experience.
🔶 Disclaimer
Use with Caution: This indicator is provided for educational and informational purposes only and should not be considered as financial advice. Users should exercise caution and perform their own analysis before making trading decisions based on the indicator's signals.
Not Financial Advice: The information provided by this indicator does not constitute financial advice, and the creator (UAlgo) shall not be held responsible for any trading losses incurred as a result of using this indicator.
Backtesting Recommended: Traders are encouraged to backtest the indicator thoroughly on historical data before using it in live trading to assess its performance and suitability for their trading strategies.
Risk Management: Trading involves inherent risks, and users should implement proper risk management strategies, including but not limited to stop-loss orders and position sizing, to mitigate potential losses.
No Guarantees: The accuracy and reliability of the indicator's signals cannot be guaranteed, as they are based on historical price data and past performance may not be indicative of future results.
Swing Trend AnalysisIntroducing the Swing Trend Analyzer: A Powerful Tool for Swing and Positional Trading
The Swing Trend Analyzer is a cutting-edge indicator designed to enhance your swing and positional trading by providing precise entry points based on volatility contraction patterns and other key technical signals. This versatile tool is packed with features that cater to traders of all timeframes, offering flexibility, clarity, and actionable insights.
Key Features:
1. Adaptive Moving Averages:
The Swing Trend Analyzer offers multiple moving averages tailored to the timeframe you are trading on. On the daily chart, you can select up to four different moving average lengths, while all other timeframes provide three moving averages. This flexibility allows you to fine-tune your analysis according to your trading strategy. Disabling a moving average is as simple as setting its value to zero, making it easy to customize the indicator to your needs.
2. Dynamic Moving Average Colors Based on Relative Strength:
This feature allows you to compare the performance of the current ticker against a major index or any symbol of your choice. The moving average will change color based on whether the ticker is outperforming or underperforming the selected index over the chosen period. For example, on a daily chart, if the 21-day moving average turns blue, it indicates that the ticker has outperformed the selected index over the last 21 days. This visual cue helps you quickly identify relative strength, a key factor in successful swing trading.
3. Visual Identification of Price Contractions:
The Swing Trend Analyzer changes the color of price bars to white (on a dark theme) or black (on a light theme) when a contraction in price is detected. Price contractions are highlighted when either of the following conditions is met: a) the current bar is an inside bar, or b) the price range of the current bar is less than the 14-period Average Daily Range (ADR). This feature makes it easier to spot price contractions across all timeframes, which is crucial for timing entries in swing trading.
4. Overhead Supply Detection with Automated Resistance Lines:
The indicator intelligently detects the presence of overhead supply and draws a single resistance line to avoid clutter on the chart. As price breaches the resistance line, the old line is automatically deleted, and a new resistance line is drawn at the appropriate level. This helps you focus on the most relevant resistance levels, reducing noise and improving decision-making.
5. Buyable Gap Up Marker: The indicator highlights bars in blue when a candle opens with a gap that remains unfilled. These bars are potential Buyable Gap Up (BGU) candidates, signaling opportunities for long-side entries.
6. Comprehensive Swing Trading Information Table:
The indicator includes a detailed table that provides essential data for swing trading:
a. Sector and Industry Information: Understand the sector and industry of the ticker to identify stocks within strong sectors.
b. Key Moving Averages Distances (10MA, 21MA, 50MA, 200MA): Quickly assess how far the current price is from key moving averages. The color coding indicates whether the price is near or far from these averages, offering vital visual cues.
c. Price Range Analysis: Compare the current bar's price range with the previous bar's range to spot contraction patterns.
d. ADR (20, 10, 5): Displays the Average Daily Range over the last 20, 10, and 5 periods, crucial for identifying contraction patterns. On the weekly chart, the ADR continues to provide daily chart information.
e. 52-Week High/Low Data: Shows how close the stock is to its 52-week high or low, with color coding to highlight proximity, aiding in the identification of potential breakout or breakdown candidates.
f. 3-Month Price Gain: See the price gain over the last three months, which helps identify stocks with recent momentum.
7. Pocket Pivot Detection with Visual Markers:
Pocket pivots are a powerful bullish signal, especially relevant for swing trading. Pocket pivots are crucial for swing trading and are effective across all timeframes. The indicator marks pocket pivots with circular markers below the price bar:
a. 10-Day Pocket Pivot: Identified when the volume exceeds the maximum selling volume of the last 10 days. These are marked with a blue circle.
b. 5-Day Pocket Pivot: Identified when the volume exceeds the maximum selling volume of the last 5 days. These are marked with a green circle.
The Swing Trend Analyzer is designed to provide traders with the tools they need to succeed in swing and positional trading. Whether you're looking for precise entry points, analyzing relative strength, or identifying key price contractions, this indicator has you covered. Experience the power of advanced technical analysis with the Swing Trend Analyzer and take your trading to the next level.
VWAP Bands [TradingFinder] 26 Brokers Data (Forex + Crypto)🔵 Introduction
Indicators are tools that help analysts predict the price trend of a stock through mathematical calculations on price or trading volume. It is evident that trading volume significantly impacts the price trend of a stock symbol.
The Volume-Weighted Average Price (VWAP) indicator combines the influence of trading volume and price, providing technical analysts with a practical tool.
This technical indicator determines the volume-weighted average price of a symbol over a specified time period. Consequently, this indicator can be used to identify trends and entry or exit points.
🟣 Calculating the VWAP Indicator
Adding the VWAP indicator to a chart will automatically perform all calculations for you. However, if you wish to understand how this indicator is calculated, the following explains the steps involved.
Consider a 5-minute chart. In the first candle of this chart (which represents price information in the first 5 minutes), sum the high, low, and close prices, and divide by 3. Multiply the resulting number by the volume for the period and call it a variable (e.g., X).
Then, divide the resulting output by the total volume for that period to calculate your VWAP. To maintain the VWAP sequence throughout the trading day, it is necessary to add the X values obtained from each period to the previous period and divide by the total volume up to that time. It is worth noting that the calculation method is the same for intervals shorter than a day.
The mathematical formula for this VWAP indicator : VWAP = ∑ (Pi×Vi) / ∑ Vi
🔵 How to Use
Traders might consider the VWAP indicator as a tool for predicting trends. For example, they might buy a stock when the price is above the VWAP level and sell it when the price is below the VWAP.
In other words, when the price is above the VWAP, the price is rising, and when it is below the VWAP, the price is falling. Major traders and investment funds also use the VWAP ratio to help enter or exit stocks with the least possible market impact.
It is important to note that one should not rely solely on the VWAP indicator when analyzing symbols. This is because if prices rise quickly, the VWAP indicator may not adequately describe the conditions. This indicator is generally used for daily or shorter time frames because using longer intervals can distort the average.
Since this indicator uses past data in its calculations, it can be considered a lagging indicator. As a result, the more data there is, the greater the delay.
🟣 Difference Between VWAP and Simple Moving Average
On a chart, the VWAP and the simple moving average may look similar, but these two indicators have different calculations. The VWAP calculates the total price considering volume, while the simple moving average does not consider volume.
In simpler terms, the VWAP indicator measures each day's price change relative to the trading volume that occurred that day. In contrast, the simple moving average implicitly assumes that all trading days have the same volume.
🟣 Reasons Why Traders Like the VWAP Indicator
The VWAP Considers Volume: Since VWAP takes volume into account, it can be more reliable than a simple arithmetic average of prices. Theoretically, one person can buy 200,000 shares of a symbol in one transaction at a single price.
However, during the same time frame, 100 other people might place 200 different orders at various prices that do not total 100,000 shares. In this case, if you only consider the average price, you might be mistaken because trading volume is ignored.
The Indicator Can Help Day Traders: While reviewing your trades, you might notice that the shares you bought at market price are trading below the VWAP indicator.
In this case, there's no need to worry because with the help of VWAP, you always get a price below the average. By knowing the volume-weighted average price of a stock, you can easily make an informed decision about paying more or less than other traders for the stock.
VWAP Can Signal Market Trend Changes: Buying low and selling high can be an excellent strategy for individuals. However, you are looking to buy when prices start to rise and sell your shares when prices start to fall.
Since the VWAP indicator simulates a balanced price in the market, when the price crosses above the VWAP line, one can assume that traders are willing to pay more to acquire shares, and as a result, the market will grow. Conversely, when the price crosses below the line, this can be considered a sign of a downward movement.
🔵 Setting
Period : Indicator calculation time frame.
Source : The Price used for calculations.
Market Ultra Data : If you turn on this feature, 26 large brokers will be included in the calculation of the trading volume.
The advantage of this capability is to have more reliable volume data. You should be careful to specify the market you are in, FOREX brokers and Crypto brokers are different.
Multiplier : Coefficient of band lines.
Stochastic Biquad Band Pass FilterThis indicator combines the power of a biquad band pass filter with the popular stochastic oscillator to provide a unique tool for analyzing price movements.
The Filter Length parameter determines the center frequency of the biquad band pass filter, affecting which frequency band is isolated. Adjusting this parameter allows you to focus on different parts of the price movement spectrum.
The Bandwidth (BW) controls the width of the frequency band in octaves. It represents the bandwidth between -3 dB frequencies for the band pass filter. A narrower bandwidth results in a more focused filtering effect, isolating a tighter range of frequencies.
The %K Length parameter sets the period for the stochastic calculation, determining the range over which the stochastic values are calculated.
The %K Smoothing parameter applies a simple moving average to the %K values to smooth out the oscillator line.
The %D Length parameter sets the period for the %D line, which is a simple moving average of the %K line, providing a signal line for the oscillator.
Key Features of the Stochastic Biquad Band Pass Filter
Biquad filters are known for their smooth response and minimal phase distortion, making them ideal for technical analysis. In this implementation, the biquad filter is configured as a band pass filter, which allows frequencies within a specified band to pass while attenuating frequencies outside this band. This is particularly useful in trading to isolate specific price movements, making it easier to detect patterns and trends within a targeted frequency range.
The stochastic oscillator is a popular momentum indicator that shows the location of the close relative to the high-low range over a set number of periods. Combining it with a biquad band pass filter enhances its effectiveness by focusing on specific frequency bands of price movements.
By incorporating this stochastic biquad band pass filter into your trading toolkit, you can enhance your chart analysis with clearer insights into specific frequency bands of price movements, leading to more informed trading decisions.
Internal Bar Strength IBS [Anan]This indicator calculates and displays the Internal Bar Strength (IBS) along with its moving average. The IBS is a measure that represents where the closing price is relative to the high-low range of a given period.
█ Main Formula
The core of this indicator is the Internal Bar Strength (IBS) calculation. The basic IBS formula is:
ibs = (close - low) / (high - low)
I enhanced the original formula by incorporating a user-defined length parameter. This modification allows for greater flexibility in analysis and interpretation. The extended version enables users to adjust the indicator's length according to their specific needs or market conditions. Notably, setting the length parameter to 1 reproduces the behavior of the original formula, maintaining backward compatibility while offering expanded functionality:
ibs = (close - ta.lowest(low, ibs_length)) / (ta.highest(high, ibs_length) - ta.lowest(low, ibs_length))
Where:
- `close` is the closing price of the current bar
- `lowest low` is the lowest low price over the specified IBS length
- `highest high` is the highest high price over the specified IBS length
█ Key Features
- Calculates IBS using a user-defined length
- Applies a moving average to the IBS values
- Offers multiple moving average types
- Includes optional Bollinger Bands or Donchian Channel overlays
- Visualizes bull and bear areas
█ Inputs
- IBS Length: The period used for IBS calculation
- MA Type: The type of moving average applied to IBS (options: SMA, EMA, SMMA, WMA, VWMA, Bollinger Bands, Donchian)
- MA Length: The period used for the moving average calculation
- BB StdDev: Standard deviation multiplier for Bollinger Bands
█ How to Use and Interpret
1. IBS Line Interpretation:
- IBS values range from 0 to 1
- Values close to 1 indicate the close was near the high, suggesting a bullish sentiment
- Values close to 0 indicate the close was near the low, suggesting a bearish sentiment
- Values around 0.5 suggest the close was near the middle of the range
2. Overbought/Oversold Conditions:
- IBS values above 0.8 (teal zone) may indicate overbought conditions
- IBS values below 0.2 (red zone) may indicate oversold conditions
- These zones can be used to identify potential reversal points
3. Trend Identification:
- Consistent IBS values above 0.5 may indicate an uptrend
- Consistent IBS values below 0.5 may indicate a downtrend
4. Using Moving Averages:
- The yellow MA line can help smooth out IBS fluctuations
- Crossovers between the IBS and its MA can signal potential trend changes
5. Bollinger Bands/Donchian Channel:
- When enabled, these can provide additional context for overbought/oversold conditions
- IBS touching or exceeding the upper band may indicate overbought conditions
- IBS touching or falling below the lower band may indicate oversold conditions
Remember that no single indicator should be used in isolation. Always combine IBS analysis with other technical indicators, price action analysis, and broader market context for more reliable trading decisions.
Versatile Moving Average StrategyVersatile Moving Average Strategy (VMAS)
Overview:
The Versatile Moving Average Strategy (VMAS) is designed to provide traders with a flexible approach to trend-following, utilizing multiple types of moving averages. This strategy allows for customization in choosing the moving average type and length, catering to various market conditions and trading styles.
Key Features:
- Multiple Moving Average Types: Choose from SMA, EMA, SMMA (RMA), WMA, VWMA, HULL, LSMA, and ALMA to best suit your trading needs.
- Customizable Inputs: Adjust the moving average length, source of price data, and stop-loss source to fine-tune the strategy.
- Target Percent: Set the percentage difference between successive profit targets to manage your risk and rewards effectively.
- Position Management: Enable or disable long and short positions, allowing for versatility in different market conditions.
- Commission and Slippage: The strategy includes realistic commission settings to ensure accurate backtesting results.
Strategy Logic:
1. Moving Average Calculation: The selected moving average is calculated based on user-defined parameters.
2. Entry Conditions:
- A long position is entered when the entry source crosses over the moving average, if long positions are enabled.
- A short position is entered when the entry source crosses under the moving average, if short positions are enabled.
3. Stop-Loss: Positions are closed if the stop-loss source crosses the moving average in the opposite direction.
4. Profit Targets: Multiple profit targets are defined, with each target set at an incremental percentage above (for long positions) or below (for short positions) the entry price.
Default Properties:
- Account Size: $10000
- Commission: 0.01% per trade
- Risk Management: Positions are sized to risk 80% of the equity per trade, because we get very tight stoploss when position is open.
- Sample Size: Backtesting has been conducted to ensure a sufficient sample size of trades, ideally more than 100 trades.
How to Use:
1. Configure Inputs: Set your preferred moving average type, length, and other input parameters.
2. Enable Positions: Choose whether to enable long, short, or both types of positions.
3. Backtest and Analyze: Run backtests with realistic settings and analyze the results to ensure the strategy aligns with your trading goals.
4. Deploy and Monitor: Once satisfied with the backtesting results, deploy the strategy in a live environment and monitor its performance.
This strategy is suitable for traders looking to leverage moving averages in a versatile and customizable manner. Adjust the parameters to match your trading style and market conditions for optimal results.
Note: Ensure the strategy settings used for publication are the same as those described here. Always conduct thorough backtesting before deploying any strategy in a live trading environment.
Nasan Moving AverageNasan Moving Average belong to the group of moving average which provides a high degree of smoothness with very low lag.
The calculation process involves several steps to analyze the typical price of a financial asset over specific periods. It starts by computing a simple moving average and standard deviation of the typical price. Then, it standardizes (differencing TP - Average Typical price over previous n periods) the price and applies an inverse hyperbolic sine transformation to the standardized value. The transformed values are summed cumulatively, and various weighted moving averages are calculated to adjust and smooth the data. The final output is a smoothed signal with reduced lag.
Input Parameters:
len: Differencing length (default 21, Use a minimum of 5 and for lower time frames less than 15 min use values between 300 -3000)
len1: Correction Factor Length 1 (default 21, this determines the length of the MA you want , eg. 10 MA, 50 MA, 100 MA, )
len2: Correction Factor Length 2 (default 9, this works best if it is ~ </=1/2 of len1 )
len3: Smoothing Length (default 5, I would not change this and only use if I want to introduce lag where you want to use it for cross over strategies).
Differencing and Standardization:
The code calculates the standardized price a by differencing the typical price and normalizing it using the mean and standard deviation. This step standardizes the price changes.
Transformation:
The transformation using logarithms and square roots (b) aim to stabilize the variance and make the distribution more normal-like, improving the robustness of the cumulative sum c.
Cumulative Sum:
The cumulative sum c of the transformed series helps in integrating the series over time, capturing the overall trend and movement.
Correction Factors:
Correction factors c1 and c4 adjust the cumulative sum based on weighted averages, to correct any biases or to align it with the typical price.
Smoothing:
The final result c6 is smoothed using a weighted moving average, reducing noise and making it easier to interpret trends.
Moving average to price cloudHi all!
This indicator shows when the price crosses the defined moving average. It plots a green or red cloud (depending on trend) and the moving average. It also plots an arrow when the trend changes (this can be disabled in 'style'->'labels' in the settings).
The moving average itself can be used as dynamic support/resistance. The trend will change based on your settings (described below). By default the trend will change when the whole bar is above/below the moving average for 2 bars (that's closed). This can be changed by "Source" and "Bars".
Settings
• Length (choose the length of the moving average. Defaults to 21)
• Type (choose what type of moving average).
- "SMA" (Simple Moving Average)
- "EMA" (Exponential Moving Average)
- "HMA" (Hull Moving Average)
- "WMA" (Weighted Moving Average)
- "VWMA" (Volume Weighted Moving Average)
- "DEMA" (Double Exponential Moving Average)
Defaults to"EMA".
• Source (Define the price source that must be above/below the moving average for the trend to change. Defaults to 'High/low (passive)')
- 'Open' The open of the bar has to cross the moving average
- 'Close' The close of the bar has to cross the moving average
- 'High/low (passive)' In a down trend: the low of the bar has to cross the moving average
- 'High/low (aggressive)' In a down trend: the high of the bar has to cross the moving average
• Source bar must be close. Defaults to 'true'.
• Bars (Define the number bars whose value (defined in 'Source') must be above/below the moving average. All the bars (defined by this number) must be above/below the moving average for the trend to change. Defaults to 2.)
Let me know if you have any questions.
Best of trading luck!
Moving Average Bands with Signals [UAlgo]The "Moving Average Bands with Signals combines various moving average types with ATR-based bands to help traders identify potential support and resistance levels.
It plots moving average bands with upper and lower support/resistance levels based on the Average True Range (ATR) and user-defined settings.Additionally, the script generates buy/sell signals based on price crossing above or below the bands.
🔶 Key Features
Multiple Moving Average Types:
Supports various moving average calculations including Arnaud Legoux Moving Average (ALMA), Exponential Moving Average (EMA), Double Exponential Moving Average (DEMA), Triple Exponential Moving Average (TEMA), Kaufman Adaptive Moving Average (KAMA), Hull Moving Average (HMA), Least Squares Moving Average (LSMA), Simple Moving Average (SMA), Triangular Moving Average (TMA), Volume-Weighted Moving Average (VWMA), Weighted Moving Average (WMA), and Zero-Lag Moving Average (ZLMA).
Customizable ATR Bands:
Integrates the Average True Range (ATR) to calculate dynamic support and resistance bands around the moving average. The multiplier for the bands is user-adjustable, allowing for finer control over the sensitivity and width of the bands.
Signal Generation:
Provides visual signals on the chart when the price interacts with the support or resistance bands. Users can choose between using the wick or the close price to generate these signals, adding an extra layer of customization based on their trading style.
Flexible Input Parameters:
Allows users to input parameters for moving average length, ATR length, band multiplier, and signal type. Additional settings are available for specific moving average types, such as ALMA's offset and sigma, KAMA's fast and slow periods, and LSMA's offset.
🔶 Disclaimer
This script is provided for educational purposes only and should not be considered financial advice.
Trading financial instruments involves substantial risk and can result in significant financial losses.
The script’s performance in the past is not indicative of future results, and no guarantees are made regarding its accuracy, reliability, or performance.
Entry Fragger - Strategy
For basic instructions please visit my other script "Entry Fragger".
The Signal Logic is explained there.
v1.4:
- Added advanced backtesting with fully customizable entries.
- Fully automated Buy Signals (profitable).
- Adjustable timeframes for signal logic. (requested)
Every setting affects the accuracy and profitability greatly now, based on settings applied.
The strategy performs best on high timeframes with larger capital and no leverage.
Useless for Forex, but absolutely smashes stocks and crypto on mid to high timeframes.
Please read through my other scripts description.
Set values as preferred and try your assets.
It does NOT work on low timeframes and forex!
Hint: BTC 4H, Custom Timeframe 1h, Moon Mode and Show Sell Signals enabled, R2R: 2.
Johnny's Adjusted BB Buy/Sell Signal"Johnny's Adjusted BB Buy/Sell Signal" leverages Bollinger Bands and moving averages to provide dynamic buy and sell signals based on market conditions. This indicator is particularly useful for traders looking to identify strategic entry and exit points based on volatility and trend analysis.
How It Works
Bollinger Bands Setup: The indicator calculates Bollinger Bands using a specified length and multiplier. These bands serve to identify potential overbought (upper band) or oversold (lower band) conditions.
Moving Averages: Two moving averages are calculated — a trend moving average (trendMA) and a long-term moving average (longTermMA) — to gauge the market's direction over different time frames.
Market Phase Determination: The script classifies the market into bullish or bearish phases based on the relationship of the closing price to the long-term moving average.
Strong Buy and Sell Signals: Enhanced signals are generated based on how significantly the price deviates from the Bollinger Bands, coupled with the average candle size over a specified lookback period. The signals are adjusted based on whether the market is bullish or bearish:
In bullish markets, a strong buy signal is triggered if the price significantly drops below the lower Bollinger Band. Conversely, a strong sell signal is activated when the price rises well above the upper band.
In bearish markets, these signals are modified to be more conservative, adjusting the thresholds for triggering strong buy and sell signals.
Features:
Flexibility: Users can adjust the length of the Bollinger Bands and moving averages, as well as the multipliers and factors that determine the strength of buy and sell signals, making it highly customizable to different trading styles and market conditions.
Visual Aids: The script vividly plots the Bollinger Bands and moving averages, and signals are visually represented on the chart, allowing traders to quickly assess trading opportunities:
Regular buy and sell signals are indicated by simple shapes below or above price bars.
Strong buy and sell signals are highlighted with distinctive colors and placed prominently to catch the trader's attention.
Background Coloring: The background color changes based on the market phase, providing an immediate visual cue of the market's overall sentiment.
Usage:
This indicator is ideal for traders who rely on technical analysis to guide their trading decisions. By integrating both Bollinger Bands and moving averages, it provides a multi-faceted view of market trends and volatility, making it suitable for identifying potential reversals and continuation patterns. Traders can use this tool to enhance their understanding of market dynamics and refine their trading strategies accordingly.
Alligator + MA Trend Catcher [TradeDots]The "Alligator + MA Trend Catcher" is a trading strategy that integrates the William Alligator indicator with a Moving Average (MA) to establish robust entry and exit conditions, optimized for capturing trends.
HOW IT WORKS
This strategy combines the traditional William Alligator set up with an additional Moving Average indicator for enhanced trend confirmation, creating a user-friendly backtesting tool for traders who prefer the Alligator method.
The original Alligator strategy can frequently present fluctuations, even in well-established trends, leading to potentially premature exits. To mitigate this, we incorporate a Moving Average as a secondary confirmation measure to ensure the market trend has indeed shifted.
Here’s the operational flow for long orders:
Entry Signal: When the price rises above the Moving Average, it confirms a bullish market state. Enter if Alligator spread in an upward direction. The trade remains active even if the Alligator indicator suggests a trend reversal.
Exit Signal: The position is closed when the price falls below the Moving Average, and the Alligator spreads in the downward direction. This setup helps traders to maintain positions through the entirety of the trend for maximum gain.
APPLICATION
This strategy is tailored for assets with significant, well-defined trends, such as Bitcoin and Ethereum, which are known for their high volatility and substantial price movements.
This strategy offers a low win-rate but high reward configuration, making asset selection critical for long-term profitability. If you choose assets that lack strong price momentum, there's a high chance that this strategy may not be effective.
For traders seeking to maximize gains from large trends without exiting prematurely, this strategy provides an aggressive yet controlled approach to riding out substantial market waves.
DEFAULT SETUP
Commission: 0.01%
Initial Capital: $10,000
Equity per Trade: 80%
RISK DISCLAIMER
Trading entails substantial risk, and most day traders incur losses. All content, tools, scripts, articles, and education provided by TradeDots serve purely informational and educational purposes. Past performances are not definitive predictors of future results.
First In, First Out Moving AverageThis script is a tool designed to calculate a First In, First Out (FIFO) Moving Average (MA) using traded prices and volumes. Additionally, it computes the Point of Control (PoC) from, which identifies the price levels (developing POC) with the maximum volume. The script is built to provide traders with a comprehensive analysis of price movements and volume dynamics, enhancing their understanding of market trends and potential entry/exit points.
Understanding the Mechanics:
The script maintains arrays for prices and volumes, where hypothetical trades are added.
For long trades (identified by red candles/bars), traded prices and volumes are appended to the respective arrays.
Short trades (identified by green candles/bars) trigger the removal of volumes from the arrays following the FIFO principle.
This process ensures the adjustment of partial or complete removal of oldest entries based on traded volume.
Analyzing Profit and Loss (PnL):
The script also tracks a hypothetical Profit and Loss (PnL) to understand whether the outcome is in red (negative) or green (positive) - color of the FIFO MA.
Interpreting the Results:
Once the script is applied to the chart, traders can observe the FIFO Moving Average (MA) and Point of Control (PoC) lines plotted.
By analyzing these lines and the associated colors (indicating positive or negative PnL), traders can make informed decisions regarding market trends, support/resistance levels and potential trading opportunities.
Range Finder [UAlgo]🔶 Description:
The "Range Finder " indicator aims at identifying and visualizing price ranges within a specified number of candles. By utilizing the Average True Range (ATR) indicator and Simple Moving Average (SMA), it detects potential breakout conditions and tracks consecutive candles that remain within the breakout range. This indicator offers flexibility by allowing users to customize settings such as range length, method for determining range breaks (based on either candle close or wick), and visualization options for displaying range breaks on the chart.
🔶 Key Features
Identifying Ranges: The Range Finder automatically adapts to the market by continuously evaluating the Average True Range (ATR) and its Simple Moving Average (SMA). This helps in dynamically adjusting the range based on market volatility.
Range Length: Users can specify the number of candles to be used for constructing the range via the "Range Length" input setting. This allows for customization based on trading strategies and preferences.
Range Break Method: The indicator offers the flexibility to choose between two methods for identifying range breaks. Users can select between "Close" or "Wick" based on their preference for using the closing price or the highs and lows (including wicks) of candles for defining the breakout.
Show Range Breaks: This option enables visual representation of range breaks on the chart. When activated, labels with the letter "B" will appear at the breakout point, colored according to the breakout direction (upward breakouts in the chosen up range color and downward breakouts in the chosen down range color).
Range Color Customization: The indicator provides the ability to personalize the visual appearance of the range by selecting preferred colors for ranges indicating potential upward and downward breakouts.
🔶 Disclaimer
It's important to understand that the Range Finder indicator is intended for informational purposes only and should not be solely relied upon for making trading decisions. Trading financial instruments involves inherent risks, and past performance is not necessarily indicative of future results.
DynamicFunctionsLibrary "DynamicFunctions"
Custom Dynamic functions that allow an adaptive calculation beginning from the first bar
RoC(src, period)
Dynamic RoC
Parameters:
src (float) : and period
Custom function to calculate the actual period considering non-na source values
period (int)
dynamicMedian(src, length)
Dynamic Median
Parameters:
src (float) : and length
length (int)
kernelRegression(src, bandwidth, kernel_type)
Dynamic Kernel Regression Calculation Uses either of the following inputs for kernel_type: Epanechnikov Logistic Wave
Parameters:
src (float)
bandwidth (int)
kernel_type (string)
waveCalculation(source, bandwidth, width)
Use together with kernelRegression function to get chart applicable band
Parameters:
source (float)
bandwidth (int)
width (float)
Rsi(src, length)
Dynamic RSI function
Parameters:
src (float)
length (int)
dynamicStdev(src, period)
Dynamic SD function
Parameters:
src (float)
period (int)
stdv_bands(src, length, mult)
Dynamic SD Bands
Parameters:
src (float)
length (int)
mult (float)
Returns: Basis, Positive SD, Negative SD
Adx(dilen, adxlen)
Dynamic ADX
Parameters:
dilen (int)
adxlen (int)
Returns: adx
Atr(length)
Dynamic ATR
Parameters:
length (int)
Returns: ATR
Macd(source, fastLength, slowLength, signalSmoothing)
Dynamic MACD
Parameters:
source (float)
fastLength (int)
slowLength (int)
signalSmoothing (int)
Returns: macdLine, signalLine, histogram
Moving Average PropertiesThis indicator calculates and visualizes the Relative Smoothness (RS) and Relative Lag (RL) or call it accuracy of a selected moving average (MA) in comparison to the SMA of length 2 (the lowest possible length for a moving average and also the one closest to the price).
Median RS (Relative Smoothness):
Interpretation: The median RS represents the median value of the Relative Smoothness calculated for the selected moving average across a specified look-back period (max bar lookback is set at 3000).
Significance: A more negative (larger) median RS suggests that the chosen moving average has exhibited smoother price behavior compared to a simple moving average over the analyzed period. A less negative value indicates a relatively choppier price movement.
Median RL (Relative Lag):
Interpretation: The median RL represents the median value of the Relative Lag calculated for the selected moving average compared to a simple moving average of length 2.
Significance: A higher median RL indicates that the chosen moving average tends to lag more compared to a simple moving average. Conversely, lower values suggest less lag in the selected moving average.
Ratio of Median RS to Median RL:
Interpretation: This ratio is calculated by dividing the median RS by the median RL.
Significance: Traders might use this ratio to assess the balance between smoothness and lag in the chosen moving average. This a measure of for every % of lag what is the smoothness achieved. This can be used a benchmark to decide what length to choose for a MA to get an equivalent value between two stocks. For example a TESLA stock on a 15 minute time frame with a length of 12 has a value (ratio of RS/RL) of -150 , where as APPLE stock of length 35 on a 15 minute chart also has a value (ratio of RS/RL) of -150.
I imply that a MA of length 12 working on TESLA stock is equivalent to MA of length 35 on a APPLE stock. (THIS IS A EXAMPLE).
My assumption is that finding the right moving average length for a stock isn't a one-size-fits-all situation. It's not just about using a fixed length; it's about adapting to the unique characteristics of each stock. I believe that what works for one stock might not work for another because they have different levels of smoothness or lag in their price movements. So, instead of applying the same length to all stocks, I suggest adjusting the length of the moving average to match the values that we know work best for achieving the desired smoothness or lag or its ratio (RS/RL). This way, we're customizing the indicator for each stock, tailoring it to their individual behaviors rather than sticking to a one-size-fits-all approach.
Users can choose from various types of moving averages (EMA, SMA, WMA, VWMA, HMA) and customize the length of the moving average. RS measures the smoothness of the MA, while RL measures its lag compared to a simple moving average. The script plots the median RS and RL values, the selected MA, and the ratio of median RS to median RL on the price chart. Traders can use this information to assess the performance of different moving averages and potentially inform their trading decisions.