Multi-Step FlexiSuperTrend - Indicator [presentTrading]This version of the indicator is built upon the foundation of a strategy version published earlier. However, this indicator version focuses on providing visual insights and alerts for traders, rather than executing trades. This one is mostly for @thorcmt.
█ Introduction and How it is Different
The **Multi-Step FlexiSuperTrend Indicator** is a versatile tool designed to provide traders with a highly customizable and flexible approach to trend analysis. Unlike traditional supertrend indicators, which focus on a single factor or threshold, the **FlexiSuperTrend** allows users to define multiple levels of take-profit targets and incorporate different trend normalization methods.
It comes with several advanced customization features, including multi-step take profits, deviation plotting, and trend normalization, making it suitable for both novice and expert traders.
BTCUSD 6hr Performance
█ Strategy, How It Works: Detailed Explanation
The **Multi-Step FlexiSuperTrend** works by calculating a supertrend based on multiple factors and incorporating oscillations from trend deviations. Here’s a breakdown of how it functions:
🔶 SuperTrend Calculation
At the heart of the indicator is the SuperTrend formula, which dynamically adjusts based on price movements.
🔶 Normalization of Deviations
To enhance accuracy, the **FlexiSuperTrend** calculates multiple deviations from the trend and normalizes them.
🔶 Multi-Step Take Profit Levels
The indicator allows setting up to three take profit levels, which are displayed via price level alerts. lows traders to exit part of their position at various profit intervals.
For more detail, please check the strategy version - Multi-Step-FlexiSuperTrend-Strategy:
and 'FlexiSuperTrend-Strategy'
█ Trade Direction
The **Multi-Step FlexiSuperTrend Indicator** supports both long and short trade directions.
This flexibility allows traders to adapt to trending, volatile, or sideways markets.
█ Usage
To use the **FlexiSuperTrend Indicator**, traders can set up their preferences for the following key features:
- **Trading Direction**: Choose whether to focus on long, short, or both signals.
- **Indicator Source**: The price source to calculate the trend (e.g., close, hl2).
- **Indicator Length**: The number of periods to calculate the ATR and trend (the larger the value, the smoother the trend).
- **Starting and Increment Factor**: These adjust how reactive the trend is to price movements. The starting factor dictates how far the initial trend band is from the price, and the increment factor adjusts subsequent trend deviations.
The indicator then displays buy and sell signals on the chart, along with alerts for each take-profit level.
Local picture
█ Default Settings
The default settings of the **Multi-Step FlexiSuperTrend** are carefully designed to provide an optimal balance between sensitivity and accuracy. Let’s examine these default parameters and their effect on performance:
🔶 Indicator Length (Default: 10)
The **Indicator Length** determines the lookback period for the ATR calculation. A smaller value makes the indicator more reactive to price changes, but may generate more false signals. A longer length smooths the trend and reduces noise but may delay signals.
Effect on performance: Shorter lengths perform better in volatile markets, while longer lengths excel in trending markets.
🔶 Starting Factor (Default: 0.618)
This factor adjusts the starting distance of the SuperTrend from the current price. The smaller the starting factor, the closer the trend is to the price, making it more sensitive. Conversely, a larger factor allows more distance, reducing sensitivity but filtering out false signals.
Effect on performance: A smaller factor provides quicker signals but can lead to frequent false positives. A larger factor generates fewer but more reliable signals.
🔶 Increment Factor (Default: 0.382)
The **Increment Factor** controls how the trend bands adjust as the price moves. It increases the distance of the bands from the price with each iteration.
Effect on performance: A higher increment factor can result in wider stop-loss or trend reversal bands, allowing for longer trends to develop without frequent exits. A lower factor keeps the bands closer to the price and is more suited for shorter-term trades.
🔶 Take Profit Levels (Default: 2%, 8%, 18%)
The default take-profit levels are set at 2%, 8%, and 18%. These values represent the thresholds at which the trader can partially exit their positions. These multi-step levels are highly customizable depending on the trader’s risk tolerance and strategy.
Effect on performance: Lower take-profit levels (e.g., 2%) capture small, quick profits in volatile markets, while higher levels (8%-18%) allow for a more gradual exit in strong trends.
🔶 Normalization Method (Default: None)
The default normalization method is **None**, meaning the deviations are not normalized. However, enabling normalization (e.g., **Max-Min**) can improve the clarity of the indicator’s signals in volatile or choppy markets by smoothing out the noise.
Effect on performance: Using a normalization method can reduce the effect of extreme deviations, making signals more stable and less prone to false positives.
Normalized
Multi-Step FlexiMA - Strategy [presentTrading]It's time to come back! hope I can not to be busy for a while.
█ Introduction and How It Is Different
The FlexiMA Variance Tracker is a unique trading strategy that calculates a series of deviations between the price (or another indicator source) and a variable-length moving average (MA). Unlike traditional strategies that use fixed-length moving averages, the length of the MA in this system varies within a defined range. The length changes dynamically based on a starting factor and an increment factor, creating a more adaptive approach to market conditions.
This strategy integrates Multi-Step Take Profit (TP) levels, allowing for partial exits at predefined price increments. It enables traders to secure profits at different stages of a trend, making it ideal for volatile markets where taking full profits at once might lead to missed opportunities if the trend continues.
BTCUSD 6hr Performance
█ Strategy, How It Works: Detailed Explanation
🔶 FlexiMA Concept
The FlexiMA (Flexible Moving Average) is at the heart of this strategy. Unlike traditional MA-based strategies where the MA length is fixed (e.g., a 50-period SMA), the FlexiMA varies its length with each iteration. This is done using a **starting factor** and an **increment factor**.
The formula for the moving average length at each iteration \(i\) is:
`MA_length_i = indicator_length * (starting_factor + i * increment_factor)`
Where:
- `indicator_length` is the user-defined base length.
- `starting_factor` is the initial multiplier of the base length.
- `increment_factor` increases the multiplier in each iteration.
Each iteration applies a **simple moving average** (SMA) to the chosen **indicator source** (e.g., HLC3) with a different length based on the above formula. The deviation between the current price and the moving average is then calculated as follows:
`deviation_i = price_current - MA_i`
These deviations are normalized using one of the following methods:
- **Max-Min normalization**:
`normalized_i = (deviation_i - min(deviations)) / range(deviations)`
- **Absolute Sum normalization**:
`normalized_i = deviation_i / sum(|deviation_i|)`
The **median** and **standard deviation (stdev)** of the normalized deviations are then calculated as follows:
`median = median(normalized deviations)`
For the standard deviation:
`stdev = sqrt((1/(N-1)) * sum((normalized_i - mean)^2))`
These values are plotted to provide a clear indication of how the price is deviating from its variable-length moving averages.
For more detail:
🔶 Multi-Step Take Profit
This strategy uses a multi-step take profit system, allowing for exits at different stages of a trade based on the percentage of price movement. Three take-profit levels are defined:
- Take Profit Level 1 (TP1): A small, quick profit level (e.g., 2%).
- Take Profit Level 2 (TP2): A medium-level profit target (e.g., 8%).
- Take Profit Level 3 (TP3): A larger, more ambitious target (e.g., 18%).
At each level, a corresponding percentage of the trade is exited:
- TP Percent 1: E.g., 30% of the position.
- TP Percent 2: E.g., 20% of the position.
- TP Percent 3: E.g., 15% of the position.
This approach ensures that profits are locked in progressively, reducing the risk of market reversals wiping out potential gains.
Local
🔶 Trade Entry and Exit Conditions
The entry and exit signals are determined by the interaction between the **SuperTrend Polyfactor Oscillator** and the **median** value of the normalized deviations:
- Long entry: The SuperTrend turns bearish, and the median value of the deviations is positive.
- Short entry: The SuperTrend turns bullish, and the median value is negative.
Similarly, trades are exited when the SuperTrend flips direction.
* The SuperTrend Toolkit is made by @EliCobra
█ Trade Direction
The strategy allows users to specify the desired trade direction:
- Long: Only long positions will be taken.
- Short: Only short positions will be taken.
- Both: Both long and short positions are allowed based on the conditions.
This flexibility allows the strategy to adapt to different market conditions and trading styles, whether you're looking to buy low and sell high, or sell high and buy low.
█ Usage
This strategy can be applied across various asset classes, including stocks, cryptocurrencies, and forex. The primary use case is to take advantage of market volatility by using a flexible moving average and multiple take-profit levels to capture profits incrementally as the market moves in your favor.
How to Use:
1. Configure the Inputs: Start by adjusting the **Indicator Length**, **Starting Factor**, and **Increment Factor** to suit your chosen asset. The defaults work well for most markets, but fine-tuning them can improve performance.
2. Set the Take Profit Levels: Adjust the three **TP levels** and their corresponding **percentages** based on your risk tolerance and the expected volatility of the market.
3. Monitor the Strategy: The SuperTrend and the FlexiMA variance tracker will provide entry and exit signals, automatically managing the positions and taking profits at the pre-set levels.
█ Default Settings
The default settings for the strategy are configured to provide a balanced approach that works across different market conditions:
Indicator Length (10):
This controls the base length for the moving average. A lower length makes the moving average more responsive to price changes, while a higher length smooths out fluctuations, making the strategy less sensitive to short-term price movements.
Starting Factor (1.0):
This determines the initial multiplier applied to the moving average length. A higher starting factor will increase the average length, making it slower to react to price changes.
Increment Factor (1.0):
This increases the moving average length in each iteration. A larger increment factor creates a wider range of moving average lengths, allowing the strategy to track both short-term and long-term trends simultaneously.
Normalization Method ('None'):
Three methods of normalization can be applied to the deviations:
- None: No normalization applied, using raw deviations.
- Max-Min: Normalizes based on the range between the maximum and minimum deviations.
- Absolute Sum: Normalizes based on the total sum of absolute deviations.
Take Profit Levels:
- TP1 (2%): A quick exit to capture small price movements.
- TP2 (8%): A medium-term profit target for stronger trends.
- TP3 (18%): A long-term target for strong price moves.
Take Profit Percentages:
- TP Percent 1 (30%): Exits 30% of the position at TP1.
- TP Percent 2 (20%): Exits 20% of the position at TP2.
- TP Percent 3 (15%): Exits 15% of the position at TP3.
Effect of Variables on Performance:
- Short Indicator Lengths: More responsive to price changes but prone to false signals.
- Higher Starting Factor: Slows down the response, useful for longer-term trend following.
- Higher Increment Factor: Widens the variability in moving average lengths, making the strategy adapt to both short-term and long-term price trends.
- Aggressive Take Profit Levels: Allows for quick profit-taking in volatile markets but may exit positions prematurely in strong trends.
The default configuration offers a moderate balance between short-term responsiveness and long-term trend capturing, suitable for most traders. However, users can adjust these variables to optimize performance based on market conditions and personal preferences.
Multi-Step FlexiSuperTrend - Strategy [presentTrading]At the heart of this endeavor is a passion for continuous improvement in the art of trading
█ Introduction and How it is Different
The "Multi-Step FlexiSuperTrend - Strategy " is an advanced trading strategy that integrates the well-known SuperTrend indicator with a nuanced and dynamic approach to market trend analysis. Unlike conventional SuperTrend strategies that rely on static thresholds and fixed parameters, this strategy introduces multi-step take profit mechanisms that allow traders to capitalize on varying market conditions in a more controlled and systematic manner.
What sets this strategy apart is its ability to dynamically adjust to market volatility through the use of an incremental factor applied to the SuperTrend calculation. This adjustment ensures that the strategy remains responsive to both minor and major market shifts, providing a more accurate signal for entries and exits. Additionally, the integration of multi-step take profit levels offers traders the flexibility to scale out of positions, locking in profits progressively as the market moves in their favor.
BTC 6hr Long/Short Performance
█ Strategy, How it Works: Detailed Explanation
The Multi-Step FlexiSuperTrend strategy operates on the foundation of the SuperTrend indicator, but with several enhancements that make it more adaptable to varying market conditions. The key components of this strategy include the SuperTrend Polyfactor Oscillator, a dynamic normalization process, and multi-step take profit levels.
🔶 SuperTrend Polyfactor Oscillator
The SuperTrend Polyfactor Oscillator is the heart of this strategy. It is calculated by applying a series of SuperTrend calculations with varying factors, starting from a defined "Starting Factor" and incrementing by a specified "Increment Factor." The indicator length and the chosen price source (e.g., HLC3, HL2) are inputs to the oscillator.
The SuperTrend formula typically calculates an upper and lower band based on the average true range (ATR) and a multiplier (the factor). These bands determine the trend direction. In the FlexiSuperTrend strategy, the oscillator is enhanced by iteratively applying the SuperTrend calculation across different factors. The iterative process allows the strategy to capture both minor and significant trend changes.
For each iteration (indexed by `i`), the following calculations are performed:
1. ATR Calculation: The Average True Range (ATR) is calculated over the specified `indicatorLength`:
ATR_i = ATR(indicatorLength)
2. Upper and Lower Bands Calculation: The upper and lower bands are calculated using the ATR and the current factor:
Upper Band_i = hl2 + (ATR_i * Factor_i)
Lower Band_i = hl2 - (ATR_i * Factor_i)
Here, `Factor_i` starts from `startingFactor` and is incremented by `incrementFactor` in each iteration.
3. Trend Determination: The trend is determined by comparing the indicator source with the upper and lower bands:
Trend_i = 1 (uptrend) if IndicatorSource > Upper Band_i
Trend_i = 0 (downtrend) if IndicatorSource < Lower Band_i
Otherwise, the trend remains unchanged from the previous value.
4. Output Calculation: The output of each iteration is determined based on the trend:
Output_i = Lower Band_i if Trend_i = 1
Output_i = Upper Band_i if Trend_i = 0
This process is repeated for each iteration (from 0 to 19), creating a series of outputs that reflect different levels of trend sensitivity.
Local
🔶 Normalization Process
To make the oscillator values comparable across different market conditions, the deviations between the indicator source and the SuperTrend outputs are normalized. The normalization method can be one of the following:
1. Max-Min Normalization: The deviations are normalized based on the range of the deviations:
Normalized Value_i = (Deviation_i - Min Deviation) / (Max Deviation - Min Deviation)
2. Absolute Sum Normalization: The deviations are normalized based on the sum of absolute deviations:
Normalized Value_i = Deviation_i / Sum of Absolute Deviations
This normalization ensures that the oscillator values are within a consistent range, facilitating more reliable trend analysis.
For more details:
🔶 Multi-Step Take Profit Mechanism
One of the unique features of this strategy is the multi-step take profit mechanism. This allows traders to lock in profits at multiple levels as the market moves in their favor. The strategy uses three take profit levels, each defined as a percentage increase (for long trades) or decrease (for short trades) from the entry price.
1. First Take Profit Level: Calculated as a percentage increase/decrease from the entry price:
TP_Level1 = Entry Price * (1 + tp_level1 / 100) for long trades
TP_Level1 = Entry Price * (1 - tp_level1 / 100) for short trades
The strategy exits a portion of the position (defined by `tp_percent1`) when this level is reached.
2. Second Take Profit Level: Similar to the first level, but with a higher percentage:
TP_Level2 = Entry Price * (1 + tp_level2 / 100) for long trades
TP_Level2 = Entry Price * (1 - tp_level2 / 100) for short trades
The strategy exits another portion of the position (`tp_percent2`) at this level.
3. Third Take Profit Level: The final take profit level:
TP_Level3 = Entry Price * (1 + tp_level3 / 100) for long trades
TP_Level3 = Entry Price * (1 - tp_level3 / 100) for short trades
The remaining portion of the position (`tp_percent3`) is exited at this level.
This multi-step approach provides a balance between securing profits and allowing the remaining position to benefit from continued favorable market movement.
█ Trade Direction
The strategy allows traders to specify the trade direction through the `tradeDirection` input. The options are:
1. Both: The strategy will take both long and short positions based on the entry signals.
2. Long: The strategy will only take long positions.
3. Short: The strategy will only take short positions.
This flexibility enables traders to tailor the strategy to their market outlook or current trend analysis.
█ Usage
To use the Multi-Step FlexiSuperTrend strategy, traders need to set the input parameters according to their trading style and market conditions. The strategy is designed for versatility, allowing for various market environments, including trending and ranging markets.
Traders can also adjust the multi-step take profit levels and percentages to match their risk management and profit-taking preferences. For example, in highly volatile markets, traders might set wider take profit levels with smaller percentages at each level to capture larger price movements.
The normalization method and the incremental factor can be fine-tuned to adjust the sensitivity of the SuperTrend Polyfactor Oscillator, making the strategy more responsive to minor market shifts or more focused on significant trends.
█ Default Settings
The default settings of the strategy are carefully chosen to provide a balanced approach between risk management and profit potential. Here is a breakdown of the default settings and their effects on performance:
1. Indicator Length (10): This parameter controls the lookback period for the ATR calculation. A shorter length makes the strategy more sensitive to recent price movements, potentially generating more signals. A longer length smooths out the ATR, reducing sensitivity but filtering out noise.
2. Starting Factor (0.618): This is the initial multiplier used in the SuperTrend calculation. A lower starting factor makes the SuperTrend bands closer to the price, generating more frequent trend changes. A higher starting factor places the bands further away, filtering out minor fluctuations.
3. Increment Factor (0.382): This parameter controls how much the factor increases with each iteration of the SuperTrend calculation. A smaller increment factor results in more gradual changes in sensitivity, while a larger increment factor creates a wider range of sensitivity across the iterations.
4. Normalization Method (None): The default is no normalization, meaning the raw deviations are used. Normalization methods like Max-Min or Absolute Sum can make the deviations more consistent across different market conditions, improving the reliability of the oscillator.
5. Take Profit Levels (2%, 8%, 18%): These levels define the thresholds for exiting portions of the position. Lower levels (e.g., 2%) capture smaller profits quickly, while higher levels (e.g., 18%) allow positions to run longer for more significant gains.
6. Take Profit Percentages (30%, 20%, 15%): These percentages determine how much of the position is exited at each take profit level. A higher percentage at the first level locks in more profit early, reducing exposure to market reversals. Lower percentages at higher levels allow for a portion of the position to benefit from extended trends.
Normalized Hull Moving Average Oscillator w/ ConfigurationsThis indicator uniquely uses normalization techniques applied to the Hull Moving Average (HMA) and allows the user to choose between a number of different types of normalization, each with their own advantages. This indicator is one in a series of experiments I've been working on in looking at different methods of transforming data. In particular, this is a more usable example of the power of data transformation, as it takes the Hull Moving Average of Alan Hull and turns it into a powerful oscillating indicator.
The indicator offers multiple types of normalization, each with its own set of benefits and drawbacks. My personal favorites are the Mean Normalization , which turns the data series into one centered around 0, and the Quantile Transformation , which converts the data into a data set that is normally distributed.
I've also included the option of showing the mean, median, and mode of the data over the period specified by the length of normalization. Using this will allow you to gather additional insights into how these transformations affect the distribution of the data series.
Types of Normalization:
1. Z-Score
Overview: Standardizes the data by subtracting the mean and dividing by the standard deviation.
Benefits: Centers the data around 0 with a standard deviation of 1, reducing the impact of outliers.
Disadvantages: Works best on data that is normally distributed
Notes: Best used with a mid-longer length of transformation.
2. Min-Max
Overview: Scales the data to fit within a specified range, typically 0 to 1.
Benefits: Simple and fast to compute, preserves the relationships among data points.
Disadvantages: Sensitive to outliers, which can skew the normalization.
Notes: Best used with mid-longer length of transformation.
3. Mean Normalization
Overview: Subtracts the mean and divides by the range (max - min).
Benefits: Centers data around 0, making it easier to compare different datasets.
Disadvantages: Can be affected by outliers, which influence the range.
Notes: Best used with a mid-longer length of transformation.
4. Max Abs Scaler
Overview: Scales each feature by its maximum absolute value.
Benefits: Retains sparsity and is robust to large outliers.
Disadvantages: Only shifts data to the range , which might not always be desirable.
Notes: Best used with a mid-longer length of transformation.
5. Robust Scaler
Overview: Uses the median and the interquartile range for scaling.
Benefits: Robust to outliers, does not shift data as much as other methods.
Disadvantages: May not perform well with small datasets.
Notes: Best used with a longer length of transformation.
6. Feature Scaling to Unit Norm
Overview: Scales data such that the norm (magnitude) of each feature is 1.
Benefits: Useful for models that rely on the magnitude of feature vectors.
Disadvantages: Sensitive to outliers, which can disproportionately affect the norm. Not normally used in this context, though it provides some interesting transformations.
Notes: Best used with a shorter length of transformation.
7. Logistic Function
Overview: Applies the logistic function to squash data into the range .
Benefits: Smoothly compresses extreme values, handling skewed distributions well.
Disadvantages: May not preserve the relative distances between data points as effectively.
Notes: Best used with a shorter length of transformation. This feature is actually two layered, we first put it through the mean normalization to ensure that it's generally centered around 0.
8. Quantile Transformation
Overview: Maps data to a uniform or normal distribution using quantiles.
Benefits: Makes data follow a specified distribution, useful for non-linear scaling.
Disadvantages: Can distort relationships between features, computationally expensive.
Notes: Best used with a very long length of transformation.
Conclusion
This indicator is a powerful example into how normalization can alter and improve the usability of a data series. Each method offers unique insights and benefits, making this indicator a useful tool for any trader. Try it out, and don't hesitate to reach out if you notice any glaring flaws in the script, room for improvement, or if you just have questions.
CofG Oscillator w/ Added Normalizations/TransformationsThis indicator is a unique study in normalization/transformation techniques, which are applied to the CG (center of gravity) Oscillator, a popular oscillator made by John Ehlers.
The idea to transform the data from this oscillator originated from observing the original indicator, which exhibited numerous whips. Curious about the potential outcomes, I began experimenting with various normalization/transformation methods and discovered a plethora of interesting results.
The indicator offers 10 different types of normalization/transformation, each with its own set of benefits and drawbacks. My personal favorites are the Quantile Transformation , which converts the dataset into one that is mostly normally distributed, and the Z-Score , which I have found tends to provide better signaling than the original indicator.
I've also included the option of showing the mean, median, and mode of the data over the period specified by the transformation period. Using this will allow you to gather additional insights into how these transformations effect the distribution of the data series.
I've also included some notes on what each transformation does, how it is useful, where it fails, and what I've found to be the best inputs for it (though I'd encourage you to play around with it yourself).
Types of Normalization/Transformation:
1. Z-Score
Overview: Standardizes the data by subtracting the mean and dividing by the standard deviation.
Benefits: Centers the data around 0 with a standard deviation of 1, reducing the impact of outliers.
Disadvantages: Works best on data that is normally distributed
Notes: Best used with a mid-longer transformation period.
2. Min-Max
Overview: Scales the data to fit within a specified range, typically 0 to 1.
Benefits: Simple and fast to compute, preserves the relationships among data points.
Disadvantages: Sensitive to outliers, which can skew the normalization.
Notes: Best used with mid-longer transformation period.
3. Decimal Scaling
Overview: Normalizes data by moving the decimal point of values.
Benefits: Simple and straightforward, useful for data with varying scales.
Disadvantages: Not commonly used, less intuitive, less advantageous.
Notes: Best used with a mid-longer transformation period.
4. Mean Normalization
Overview: Subtracts the mean and divides by the range (max - min).
Benefits: Centers data around 0, making it easier to compare different datasets.
Disadvantages: Can be affected by outliers, which influence the range.
Notes: Best used with a mid-longer transformation period.
5. Log Transformation
Overview: Applies the logarithm function to compress the data range.
Benefits: Reduces skewness, making the data more normally distributed.
Disadvantages: Only applicable to positive data, breaks on zero and negative values.
Notes: Works with varied transformation period.
6. Max Abs Scaler
Overview: Scales each feature by its maximum absolute value.
Benefits: Retains sparsity and is robust to large outliers.
Disadvantages: Only shifts data to the range , which might not always be desirable.
Notes: Best used with a mid-longer transformation period.
7. Robust Scaler
Overview: Uses the median and the interquartile range for scaling.
Benefits: Robust to outliers, does not shift data as much as other methods.
Disadvantages: May not perform well with small datasets.
Notes: Best used with a longer transformation period.
8. Feature Scaling to Unit Norm
Overview: Scales data such that the norm (magnitude) of each feature is 1.
Benefits: Useful for models that rely on the magnitude of feature vectors.
Disadvantages: Sensitive to outliers, which can disproportionately affect the norm. Not normally used in this context, though it provides some interesting transformations.
Notes: Best used with a shorter transformation period.
9. Logistic Function
Overview: Applies the logistic function to squash data into the range .
Benefits: Smoothly compresses extreme values, handling skewed distributions well.
Disadvantages: May not preserve the relative distances between data points as effectively.
Notes: Best used with a shorter transformation period. This feature is actually two layered, we first put it through the mean normalization to ensure that it's generally centered around 0.
10. Quantile Transformation
Overview: Maps data to a uniform or normal distribution using quantiles.
Benefits: Makes data follow a specified distribution, useful for non-linear scaling.
Disadvantages: Can distort relationships between features, computationally expensive.
Notes: Best used with a very long transformation period.
Conclusion
Feel free to explore these normalization/transformation techniques to see how they impact the performance of the CG Oscillator. Each method offers unique insights and benefits, making this study a valuable tool for traders, especially those with a passion for data analysis.
Normalized Performance ComparisonThis script visualizes the relative performance of a primary asset against a benchmark composed of three reference assets. Here's how it works:
User Inputs:
- Users specify ticker symbols for three reference assets (default: Platinum, Palladium, Rhodium).
Data Retrieval:
- Fetches closing prices for the primary asset (the one the script is applied to) and the three reference assets.
Normalization:
- Each asset's price is normalized by dividing its current price by its initial price at the start of the chart. This allows for performance comparison on a common scale.
Benchmark Creation:
- The normalized prices of the three reference assets are combined to create a composite benchmark.
Ratio Calculation:
- Computes the ratio of the normalized primary asset price to the combined normalized benchmark price, highlighting relative performance.
Plotting:
- Plots this ratio as a blue line on the chart, showing the primary asset's performance relative to the benchmark over time.
This script helps users quickly assess how well the primary asset is performing compared to a set of reference assets.
Adaptive Trend Lines [MAMA and FAMA]Updated my previous algo on the Adaptive Trend lines, however I have added new functionalities and sorted out the settings.
You can now switch between normalized and non-normalized settings, the colors have also been updated and look much better.
The MAMA and FAMA
These indicators was originally developed by John F. Ehlers (Stocks & Commodities V. 19:10: MESA Adaptive Moving Averages). Everget wrote the initial functions for these in pine script. I have simply normalized the indicators and chosen to use the Laplace transformation instead of the hilbert transformation
How the Indicator Works:
The indicator employs a series of complex calculations, but we'll break it down into key steps to understand its functionality:
LaplaceTransform: Calculates the Laplace distribution for the given src input. The Laplace distribution is a continuous probability distribution, also known as the double exponential distribution. I use this because of the assymetrical return profile
MESA Period: The indicator calculates a MESA period, which represents the dominant cycle length in the price data. This period is continuously adjusted to adapt to market changes.
InPhase and Quadrature Components: The InPhase and Quadrature components are derived from the Hilbert Transform output. These components represent different aspects of the price's cyclical behavior.
Homodyne Discriminator: The Homodyne Discriminator is a phase-sensitive technique used to determine the phase and amplitude of a signal. It helps in detecting trend changes.
Alpha Calculation: Alpha represents the adaptive factor that adjusts the sensitivity of the indicator. It is based on the MESA period and the phase of the InPhase component. Alpha helps in dynamically adjusting the indicator's responsiveness to changes in market conditions.
MAMA and FAMA Calculation: The MAMA and FAMA values are calculated using the adaptive factor (alpha) and the input price data. These values are essentially adaptive moving averages that aim to capture the current trend more effectively than traditional moving averages.
But Omar, why would anyone want to use this?
The MAMA and FAMA lines offer benefits:
The indicator offers a distinct advantage over conventional moving averages due to its adaptive nature, which allows it to adjust to changing market conditions. This adaptability ensures that investors can stay on the right side of the trend, as the indicator becomes more responsive during trending periods and less sensitive in choppy or sideways markets.
One of the key strengths of this indicator lies in its ability to identify trends effectively by combining the MESA and MAMA techniques. By doing so, it efficiently filters out market noise, making it highly valuable for trend-following strategies. Investors can rely on this feature to gain clearer insights into the prevailing trends and make well-informed trading decisions.
This indicator is primarily suppoest to be used on the big timeframes to see which trend is prevailing, however I am not against someone using it on a timeframe below the 1D, just be careful if you are using this for modern portfolio theory, this is not suppoest to be a mid-term component, but rather a long term component that works well with proper use of detrended fluctuation analysis.
Dont hesitate to ask me if you have any questions
Again, I want to give credit to Everget and ChartPrime!
Code explanation as required by House Rules:
fastLimit = input.float(title='Fast Limit', step=0.01, defval=0.01, group = "Indicator Settings")
slowLimit = input.float(title='Slow Limit', step=0.01, defval=0.08, group = "Indicator Settings")
src = input(title='Source', defval=close, group = "Indicator Settings")
input.float: Used to create input fields for the user to set the fastLimit and slowLimit values.
input: General function to get user inputs, like the data source (close price) used for calculations.
norm_period = input.int(3, 'Normalization Period', 1, group = "Normalized Settings")
norm = input.bool(defval = true, title = "Use normalization", group = "Normalized Settings")
input.int: Creates an input field for the normalization period.
input.bool: Allows the user to toggle normalization on or off.
Color settings in the code:
col_up = input.color(#22ab94, group = "Color Settings")
col_dn = input.color(#f7525f, group = "Color Settings")
Constants and functions
var float PI = math.pi
laplace(src) =>
(0.5) * math.exp(-math.abs(src))
_computeComponent(src, mesaPeriodMult) =>
out = laplace(src) * mesaPeriodMult
out
_smoothComponent(src) =>
out = 0.2 * src + 0.8 * nz(src )
out
math.pi: Represents the mathematical constant π (pi).
laplace: A function that applies the Laplace transform to the source data.
_computeComponent: Computes a component of the data using the Laplace transform.
_smoothComponent: Smooths data by averaging the current value with the previous one (nz function is used to handle null values).
Alpha function:
_computeAlpha(src, fastLimit, slowLimit) =>
mesaPeriod = 0.0
mesaPeriodMult = 0.075 * nz(mesaPeriod ) + 0.54
...
alpha = math.max(fastLimit / deltaPhase, slowLimit)
out = alpha
out
_computeAlpha: Calculates the adaptive alpha value based on the fastLimit and slowLimit. This value is crucial for determining the MAMA and FAMA lines.
Calculating MAMA and FAMA:
mama = 0.0
mama := alpha * src + (1 - alpha) * nz(mama )
fama = 0.0
fama := alpha2 * mama + (1 - alpha2) * nz(fama )
Normalization:
lowest = ta.lowest(mama_fama_diff, norm_period)
highest = ta.highest(mama_fama_diff, norm_period)
normalized = (mama_fama_diff - lowest) / (highest - lowest) - 0.5
ta.lowest and ta.highest: Find the lowest and highest values of mama_fama_diff over the normalization period.
The oscillator is normalized to a range, making it easier to compare over different periods.
And finally, the plotting:
plot(norm == true ? normalized : na, style=plot.style_columns, color=col_wn, title = "mama_fama_diff Oscillator Normalized")
plot(norm == false ? mama_fama_diff : na, style=plot.style_columns, color=col_wnS, title = "mama_fama_diff Oscillator")
Example of Normalized settings:
Example for setup:
Try to make sure the lower timeframe follows the higher timeframe if you take a trade based on this indicator!
Exponentially Weighted Moving Average Oscillator [BackQuant]Exponentially Weighted Moving Average (EWMA)
The Exponentially Weighted Moving Average (EWMA) is a quantitative or statistical measure used to model or describe a time series. The EWMA is widely used in finance, the main applications being technical analysis and volatility modeling.
The moving average is designed as such that older observations are given lower weights. The weights fall exponentially as the data point gets older – hence the name exponentially weighted.
Applications of the EWMA
The EWMA is widely used in technical analysis. It may not be used directly, but it is used in conjunction with other indicators to generate trading signals. A well-known example is the Negative Volume Index (NVI), which is used in conjunction with its EWMA.
Why is it different from the In-Built TradingView EWMA
Adaptive Algorithms: If your strategy requires the alpha parameter to change adaptively based on certain conditions (for example, based on market volatility), a for loop can be used to adjust the weights dynamically within the loop as opposed to the fixed decay rate in the standard EWMA.
Customization: A for loop allows for more complex and nuanced calculations that may not be directly supported by built-in functions. For example, you might want to adjust the weights in a non-standard way that the typical EWMA calculation doesn't allow for.
Use of the Oscillator
This mainly comes from 3 main premises, this is something I like to do personally since it is easier to work with them in the context of my system. E.g. Using them to spot clear trends without noise on longer timeframes.
Clarity: Plotting the EWMA as an oscillator provides a clear visual representation of the momentum or trend strength. It allows traders to see overbought or oversold conditions relative to a normalized range.
Comparison: An oscillator can make it easier to compare different securities or timeframes on a similar scale, especially when normalized. This is because the oscillator values are typically bounded within a range (like -1 to 1 or 0 to 100), whereas the actual price series can vary significantly.
Focus on Change: When plotted as an oscillator, the focus is on the rate of change or the relative movement of the EWMA, not on the absolute price levels. This can help traders spot divergences or convergences that may not be as apparent when the EWMA is plotted directly on the price chart. This is also one reason there is a conditional plotting on the chart.
Trend Strength: When normalized, the distance of the oscillator from its midpoint can be interpreted as the strength of the trend, providing a quantitative measure that can be used to make systematic trading decisions.
Here are the backtests on the 1D Timeframe for
BITSTAMP:BTCUSD
BITSTAMP:ETHUSD
COINBASE:SOLUSD
When using this script the user is able to define a source and period, which by extension calculates the alpha. An option to colour the bars accord to trend.
This makes it super easy to use in a system.
I recommend using this as above the midline (0) for a positive trend and below the midline for negative trend.
Hence why I put a label on the last bar to ensure it is easier for traders to read.
Lastly, The decreasing colour relative to RoC, this also helps traders to understand the strength of the indicator and gain insight into when to potentially reduce position size.
This indicator is best used in the medium timeframe.
FlexiMA x FlexiST - Strategy [presentTrading]█ Introduction and How it is Different
The FlexiMA x FlexiST Strategy blends two analytical methods - FlexiMA and FlexiST, which are opened in my early post.
- FlexiMA calculates deviations between an indicator source and a dynamic moving average, controlled by a starting factor and increment factor.
- FlexiST, on the other hand, leverages the SuperTrend model, adjusting the Average True Range (ATR) length for a comprehensive trend-following oscillator.
This synergy offers traders a more nuanced and multifaceted tool for market analysis.
BTC 6H L/S Performance
Local
█ Strategy, How It Works: Detailed Explanation
The strategy combines two components: FlexiMA and FlexiST, each utilizing unique methodologies to analyze market trends.
🔶FlexiMA Component:
- Calculates deviations between an indicator source and moving averages of variable lengths.
- Moving average lengths are dynamically adjusted using a starting factor and increment factor.
- Deviations are normalized and analyzed to produce median and standard deviation values, forming the FlexiMA oscillator.
Length indicator (50)
🔶FlexiST Component:
- Uses SuperTrend indicators with varying ATR (Average True Range) lengths.
- Trends are identified based on the position of the indicator source relative to the SuperTrend bands.
- Deviations between the indicator source and SuperTrend values are calculated and normalized.
Starting Factor (5)
🔶Combined Strategy Logic:
- Entry Signals:
- Long Entry: Triggered when median values of both FlexiMA and FlexiST are positive.
- Short Entry: Triggered when median values of both FlexiMA and FlexiST are negative.
- Exit Signals:
- Long Exit: Triggered when median values of FlexiMA or FlexiST turn negative.
- Short Exit: Triggered when median values of FlexiMA or FlexiST turn positive.
This strategic blend of FlexiMA and FlexiST allows for a nuanced analysis of market trends, providing traders with signals based on a comprehensive view of market momentum and trend strength.
█ Trade Direction
The strategy is designed to cater to various trading preferences, offering "Long", "Short", and "Both" options. This flexibility allows traders to align the strategy with their specific market outlook, be it bullish, bearish, or a combination of both.
█ Usage
Traders can effectively utilize the FlexiMA x FlexiST Strategy by first selecting their desired trade direction. The strategy then generates entry signals when the conditions for either the FlexiMA or FlexiST are met, indicating potential entry points in the market. Conversely, exit signals are generated when the conditions for these indicators diverge, thus signaling a potential shift in market trends and suggesting a strategic exit point.
█ Default Settings
1. Indicator Source (HLC3): Provides a balanced and stable price source, reducing the impact of extreme market fluctuations.
2. Indicator Lengths (20 for FlexiMA, 10 for FlexiST): Longer FlexiMA length smooths out short-term fluctuations, while shorter FlexiST length allows for quicker response to market changes.
3. Starting Factors (1.0 for FlexiMA, 0.618 for FlexiST): Balanced start for FlexiMA and a harmonized approach for FlexiST, resonating with natural market cycles.
4. Increment Factors (1.0 for FlexiMA, 0.382 for FlexiST): FlexiMA captures a wide range of market behaviors, while FlexiST provides a gradual transition to capture finer trend shifts.
5. Normalization Methods ('None'): Uses raw deviations, suitable for markets where absolute price movements are more significant.
6. Trade Direction ('Both'): Allows strategy to consider both long and short opportunities, ideal for versatile market engagement.
*More details:
1. FlexiMA
2. FlexiST
FlexiSuperTrend - Strategy [presentTrading]█ Introduction and How it is Different
The "FlexiSuperTrend - Strategy" by PresentTrading is a cutting-edge trading strategy that redefines market analysis through the integration of the SuperTrend indicator and advanced variance tracking.
BTC 6H L/S
This strategy stands apart from conventional methods by its dynamic adaptability, capturing market trends and momentum shifts with increased sensitivity. It's designed for traders seeking a more responsive tool to navigate complex market movements.
Local
█ Strategy, How It Works: Detailed Explanation
The "FlexiSuperTrend - Strategy" employs a multifaceted approach, combining the adaptability of the SuperTrend indicator with variance tracking. The strategy's core lies in its unique formulation and application of these components:
🔶 SuperTrend Polyfactor Oscillator:
- Basic Concept: The oscillator is a series of SuperTrend calculations with varying ATR lengths and multipliers. This approach provides a broader and more nuanced perspective of market trends.
- Calculation:
- For each iteration, `i`, the SuperTrend is calculated using:
- `ATR Length = indicatorLength * (startingFactor + i * incrementFactor)`.
- `Multiplier = dynamically adjusted based on market conditions`.
- The SuperTrend output for each iteration is compared with the indicator source (like hlc3), and the deviation is recorded.
SuperTrend Calculation:
- `Upper Band (UB) = hl2 + (ATR Length * Multiplier)`
- `Lower Band (LB) = hl2 - (ATR Length * Multiplier)`
- Where `hl2` is the average of high and low prices.
Deviation Calculation:
- `Deviation = indicatorSource - SuperTrend Value`
- This value is calculated for each SuperTrend setting in the oscillator series.
🔶 Indicator Source (`hlc3`):
- **Usage:** The strategy uses the average of high, low, and close prices, providing a balanced representation of market activity.
🔶 Adaptive ATR Lengths and Factors:
- Dynamic Adjustment: The strategy adjusts the ATR length and multiplier based on the `startingFactor` and `incrementFactor`. This adaptability is key in responding to changing market volatilities.
- Equation: ATR Length at each iteration `i` is given by `len = indicatorLength * (startingFactor + i * incrementFactor)`.
incrementFactor - 1
incrementFactor - 2
🔶 Normalization Methods:
Purpose: To standardize the deviations for comparability.
- Methods:
- 'Max-Min': Scales the deviation based on the range of values.
- 'Absolute Sum': Uses the sum of absolute deviations for normalization.
Normalization 'Absolute Sum'
- For 'Max-Min': `Normalized Deviation = (Deviation - Min(Deviations)) / (Max(Deviations) - Min(Deviations))`
- For 'Absolute Sum': `Normalized Deviation = Deviation / Sum(Absolute(Deviations))`
🔶 Trading Logic:
The strategy integrates the SuperTrend indicator, renowned for its effectiveness in identifying trend direction and reversals. The SuperTrend's incorporation enhances the strategy's ability to filter out false signals and confirm genuine market trends. * The SuperTrend Toolkit is made by @QuantiLuxe
- Long Entry Conditions: A buy signal is generated when the current trend, as indicated by the SuperTrend Polyfactor Oscillator, turns positive.
- Short Entry Conditions: A sell signal is triggered when the current trend turns negative.
- Entry and Exit Strategy: The strategy opens or closes positions based on these signals, aligning with the selected trade direction (long, short, or both).
█ Trade Direction
The strategy is versatile, allowing traders to choose their preferred trading direction: long, short, or both. This flexibility enables traders to tailor their strategies to their market outlook and risk appetite.
█ Usage
The FlexiSuperTrend strategy is suitable for various market conditions and can be adapted to different asset classes and time frames. Traders should set the strategy parameters according to their risk tolerance and trading goals. It's particularly useful for capturing long-term movements, ideal for swing traders, yet adaptable for short-term trading strategies.
█ Default Settings
1. Trading Direction: Choose from "Long", "Short", or "Both" to define the trade type.
2. Indicator Source (HLC3): Utilizes the HLC3 as the primary price reference.
3. Indicator Length (Default: 10): Influences the moving average calculation and trend sensitivity.
4. Starting Factor (0.618): Initiates the ATR length, influenced by Fibonacci ratios.
5. Increment Factor (0.382): Adjusts the ATR length incrementally for dynamic trend tracking.
6. Normalization Method: Options include "None", "Max-Min", and "Absolute Sum" for scaling deviations.
7. SuperTrend Settings: Varied ATR lengths and multipliers tailor the indicator's responsiveness.
8. Additional Settings: Features mesh style plotting and customizable colors for visual distinction.
The default settings provide a balanced approach, but users are encouraged to adjust them based on their individual trading style and market analysis.
FlexiMA Variance Tracker - Strategy [presentTrading]█ Introduction and How It Is Different
The FlexiMA Variance Tracker by PresentTrading introduces a novel approach to technical trading strategies. Unlike traditional methods, it calculates deviations between a chosen indicator source (such as price or average) and a moving average with a variable length. This flexibility is achieved through a unique combination of a starting factor and an increment factor, allowing the moving average to adapt dynamically within a specified range. This strategy provides a more responsive and nuanced view of market trends, setting it apart from standard trading methodologies.
BTC 8h L/S
Local
█ Strategy, How It Works: Detailed Explanation
The FlexiMA Variance Tracker, developed by PresentTrading, stands at the forefront of trading strategies, distinguished by its adaptive and multifaceted approach to market analysis. This strategy intricately weaves various technical elements to construct a comprehensive trading logic. Here's an in-depth professional breakdown:
🔶Foundation on Variable-Length Moving Averages:
Central to this strategy is the concept of variable-length Moving Averages (MAs). Unlike traditional MAs with a fixed period, this strategy dynamically adjusts the length of the MA based on a starting factor and an incremental factor. This approach allows the strategy to adapt to market volatility and trend strength more effectively.
Each MA iteration offers a distinct temporal perspective, capturing short-term price movements to long-term trends. This aggregation of various time frames provides a richer and more nuanced market analysis, essential for making informed trading decisions.
🔶Deviation Analysis and Normalization:
The strategy calculates deviations of the price (or the chosen indicator source) from each of these MAs. These deviations are pivotal in identifying the immediate market direction relative to the average trend captured by each MA.
To standardize these deviations for comparability, they undergo a normalization process. The choice of normalization method (Max-Min or Absolute Sum) can significantly influence the interpretation of market conditions, offering distinct insights into price movements and trend strength.
🔹Normalization: Absolute Sum
🔶Composite Oscillator Construction:
A composite oscillator is derived from the median of these normalized deviations. The median serves as a balanced and robust central trend indicator, minimizing the impact of outliers and market noise.
Additionally, the standard deviation of these deviations is computed, providing a measure of market volatility. This volatility indicator is crucial for assessing market risk and can guide traders in setting appropriate stop-loss and take-profit levels.
🔶Integration with SuperTrend Indicator:
The FlexiMA strategy integrates the SuperTrend indicator, renowned for its effectiveness in identifying trend direction and reversals. The SuperTrend's incorporation enhances the strategy's ability to filter out false signals and confirm genuine market trends.
* The SuperTrend Toolkit is made by @QuantiLuxe
This combination of the variable-length MA oscillator with the SuperTrend indicator forms a potent duo, offering traders a dual-confirmation mechanism for trade signals.
🔹Supertrend's incorporation
🔶Strategic Trade Signal Generation:
Trade signals are generated when there is a confluence between the composite oscillator and the SuperTrend indicator. For example, a long position signal might be considered when the oscillator suggests an uptrend, and the SuperTrend flips to bullish.
The strategy's parameters are fully customizable, enabling traders to tailor the signal generation process to their specific trading style, risk tolerance, and market conditions.
█ Usage
To effectively employ the FlexiMA Variance Tracker strategy:
Traders should set their desired trade direction and fine-tune the starting and increment factors according to their market analysis and risk tolerance.
Indicator Length: 5
Indicator Length: 40
The strategy is suitable for a wide range of markets and can be adapted to different time frames, making it a versatile tool for various trading scenarios.
█ Default Settings Impact on Performance: FlexiMA Variance Tracker
1. Trade Direction (Configurable: Long, Short, Both): Determines trade types. 'Long' for buying, 'Short' for selling, 'Both' adapts to market trends.
2. Indicator Source: HLC3: Balances market sentiment by considering high, low, and close, providing comprehensive period analysis.
4. Indicator Length (Default: 10): Baseline for moving averages. Shorter lengths increase responsiveness but add noise, while longer lengths favor trends.
5. Starting and Increment Factor (Default: 1.0): Adjusts MA lengths range. Higher values capture broad market dynamics, lower values focus analysis.
6. Normalization Method (Options: None, Max-Min, Absolute Sum): Standardizes deviations. 'None' for raw deviations, 'Max-Min' for relative scaling, 'Absolute Sum' emphasizes relative strength.
7. SuperTrend Settings (ATR Length: 10, Multiplier: 15.0): Influences indicator sensitivity. Short ATR or high multiplier for short-term, long ATR or low multiplier for long-term trends.
8. Additional Settings (Mesh Style, Color Customization): Enhances visual clarity. Mesh style for detailed deviation view, colors for quick market condition identification.
FlexiMA Variance Tracker [presentTrading]🔶 Introduction and How it is Different
The FlexiMA Variance Tracker (FlexiMA-VT) represents a novel approach in technical analysis, distinctively standing out in the realm of financial market indicators. It leverages the concept of a variable Length Moving Average (MA) to create a versatile and dynamic oscillator. Unlike traditional oscillators that rely on a fixed-length MA, the FlexiMA-VT adapts to market conditions by varying the length of the MA, offering a more responsive and nuanced view of market trends. (*The achieved method took reference from SuperTrend Polyfactor Oscillator)
This innovative design allows the FlexiMA-VT to capture a broader spectrum of market movements, making it highly effective in diverse trading environments. Whether in stable or volatile markets, its adaptability ensures consistent relevance, providing traders with deeper insights into potential market swings.
The proposed oscillator accentuates several key aspects through a distinctive mesh of bars, which are derived from the differences between the price and a set of 20 Moving Averages, each altered by varying factors. The intensity of the mesh's colors serves as an indicator, with brighter hues signifying a greater convergence of Moving Average signals.
Starting Length = 5
Starting Length = 40
🔶 Strategy, How it Works: Detailed Explanation
1. Core Concept:
The FlexiMA-VT operates by comparing the price or an average value (indicator source) against a set of moving averages with varying lengths.
These lengths are dynamically adjusted through a starting factor and multiple increment factors, ensuring a comprehensive analysis over different time scales.
2. Normalization and Standard Deviation Calculation:
Once deviations are calculated, they undergo a normalization process, which can be set to 'None', 'Max-Min', or 'Absolute Sum'.
This step is crucial as it standardizes the deviations, allowing for a consistent scale of comparison.
The standard deviation of these normalized deviations is then calculated, offering insights into the market’s volatility and potential trend strength.
🔹Normalization
3. Median Value and Oscillator Creation:
The median of the normalized deviations forms the core of the FlexiMA-VT oscillator.
This median value provides a balanced central point, reflecting the consensus of various MA lengths.
The standard deviation bands plotted around the median enhance the interpretative power of the oscillator, indicating potential overbought or oversold conditions.
4. Multi-Factor Analysis:
The FlexiMA-VT uses multiple increment factors to generate a range of MAs, each factor representing a different scale of trend analysis.
By averaging the results from these different scales, the FlexiMA-VT forms a more comprehensive and reliable oscillator.
🔹Consensus
5. Practical Application:
Traders can use the FlexiMA-VT for various purposes, including identifying trend reversals, gauging market momentum, and determining overbought or oversold conditions.
Its dynamic nature makes it adaptable to different trading strategies, from short-term scalping to long-term position trading.
🔶 Settings
1. Indicator Source (indicatorSource): Determines the base data for calculations, typically a price average (HLC3).
2. Indicator Length (indicatorLength): Sets the base length for Moving Averages, influencing initial calculations.
3. Starting Factor (startingFactor): Initial multiplier for MA length, impacting the starting point of analysis.
4. Increment Factors (incrementFactor_1, incrementFactor_2, incrementFactor_3): Modulate the rate of change in MA lengths, adding variability.
5. Normalization Method (normalizeMethod): Standardizes deviations, with methods like 'Max-Min' and 'Absolute Sum' for comparability.
Rolling Volatility Indicator
Description :
The Rolling Volatility indicator calculates the volatility of an asset's price movements over a specified period. It measures the degree of variation in the price series over time, providing insights into the market's potential for price fluctuations.
This indicator utilizes a rolling window approach, computing the volatility by analyzing the logarithmic returns of the asset's price. The user-defined length parameter determines the timeframe for the volatility calculation.
How to Use :
Adjust the "Length" parameter to set the rolling window period for volatility calculation.
Ajust "trading_days" for the sampling period, this is the total number of trading days (usually 252 days for stocks and 365 for crypto)
Higher values for the length parameter will result in a smoother, longer-term view of volatility, while lower values will provide a more reactive, shorter-term perspective.
Volatility levels can assist in identifying periods of increased market activity or potential price changes. Higher volatility may suggest increased risk and potential opportunities, while lower volatility might indicate periods of reduced market activity.
Key Features :
Customizable length parameter for adjusting the calculation period and trading days such that it can also be applied to stock market or any markets.
Visual representation of volatility with a plotted line on the chart.
The Rolling Volatility indicator can be a valuable tool for traders and analysts seeking insights into market volatility trends, aiding in decision-making processes and risk management strategies.
Bull Bear Power with Optional Normalization FunctionThis indicator is designed to provide traders with insights into market sentiment and potential trend reversals. This indicator enhances the traditional Bull Bear Power (BBP) by adding valuable visualizations and customization options to assist traders in making informed trading decisions.
Indicator Overview:
The NBBP indicator calculates Bull Bear Power, which measures the strength of bullish and bearish forces in the market. It does so by taking the difference between the high and the exponential moving average (EMA) of the closing price for a specified length. This raw BBP is represented on the chart as a line.
Key Features:
-- Zero Line : The NBBP indicator introduces a central reference line at zero. This line serves as a pivotal point for interpreting market sentiment. When the BBP line is above zero, it is colored green, indicating a predominance of bullish sentiment. Conversely, when the BBP line is below zero, it turns red, signaling a prevalence of bearish sentiment. This coloration helps traders quickly identify shifts in market sentiment.
-- OPTIONAL Normalization Function : One of the standout features of the NBBP indicator is its optional normalization function. When activated in the settings menu, this function scales the BBP values from -1 to +1. This means that BBP values are adjusted to fit within a standardized range, making it easier for traders to compare sentiment across different timeframes or assets. Normalization is particularly valuable for identifying extreme sentiment conditions and potential reversals.
-- Moving Average : To provide additional context and smooth out BBP fluctuations, the indicator includes an exponential moving average (EMA). The EMA of BBP is plotted on the chart as a white line. Traders can use this moving average to identify trends and potential trend reversals.
-- Fill Between Lines : The indicator visually enhances the BBP by filling the area between the BBP line and the zero line with a translucent color. This fill helps traders visualize the strength and duration of bullish or bearish sentiment.
Interpretation:
-- BBP Line : Traders can assess the raw BBP line for shifts in sentiment. When the line crosses above zero, it may suggest a shift from bearish to bullish sentiment, potentially indicating a buying opportunity. Conversely, when the line crosses below zero, it may signal a shift from bullish to bearish sentiment, suggesting a potential selling opportunity.
-- Normalization Function : The optional normalization function allows traders to gauge sentiment on a standardized scale. Values above 0 indicate bullish sentiment, while values below 0 suggest bearish sentiment. The closer the values are to their polar ends (-1 or +1), the stronger the sentiment.
-- Moving Average : The EMA of BBP helps identify trends. When BBP crosses above the EMA, it may indicate a strengthening bullish trend, while a crossover below the EMA may suggest a bearish trend.
Customization:
The NBBP indicator provides traders with flexibility through customizable settings. Users can adjust the BBP length, EMA length, and choose to activate or deactivate the normalization function based on their trading preferences and strategy.
Limitations:
The NBBP indicator is most effective when used in conjunction with other technical analysis tools and market context. Traders should consider multiple factors when making trading decisions.
Normalization function results may vary depending on the chosen length and market conditions. If the desired result is not achieved through default settings, try changing timeframes or toggling on/off the normalization function. Users should exercise caution and combine it with other indicators and analysis techniques.
In conclusion, the NBBP indicator is a versatile tool that empowers traders to assess market sentiment, identify potential reversals, and follow trends. Its intuitive visualizations, normalization function, and customizable settings make it a valuable addition to any trader's toolkit.
SuperTrend Polyfactor Oscillator [LuxAlgo]The SuperTrend Polyfactor Oscillator is an oscillator based on the popular SuperTrend indicator that aims to highlight information returned by a collection of SuperTrends with varying factors inputs.
A general consensus is calculated from all this information, returning an indication of the current market sentiment.
🔶 USAGE
Multiple elements are highlighted by the proposed oscillator. A mesh of bars is constructed from the difference between the price and a total of 20 SuperTrends with varying factors. Brighter colors of the mesh indicate a higher amount of aligned SuperTrends indications.
The factor input of the SuperTrends is determined by the user from the Starting Factor setting which determines the factor of the shorter-term SuperTrend, and the Increment settings which control the step between each factor inputs.
Using higher values for these settings will return information for longer-term term price variations.
🔹 Consensus
From the collection of SuperTrends, a consensus is obtained. It is calculated as the median of all the differences between the price and the collection of SuperTrends.
This consensus is highlighted in the script by a blue and orange line, with a blue color indicating an overall bullish market, and orange indicating a bearish market.
Both elements can be used together to highlight retracements within a trend. If we see various red bars while the general consensus is bullish, we can interpret it as the presence of a retracement.
🔹 StDev Area
The indicator includes an area constructed from the standard deviation of all the differences between the price and the collection of SuperTrends.
This area can be useful to see if the market is overall trending or ranging, with a consensus over the area indicative of a trending market.
🔹 Normalization
Users can decide to normalize the results and constrain them within a specific range, this can allow obtaining a lower degree of variations of the indicator outputs. Two methods are proposed "Absolute Sum", and "Max-Min".
The "Absolute Sum" method will divide any output returned by the indicator by the absolute sum of all the differences between the price and SuperTrends. This will constrain all the indicator elements in a (1, -1) scale.
The "Max-Min" method will apply min-max normalization to the indicator outputs (with the exception of the stdev area). This will constrain all the indicator elements in a (0, 1) scale.
🔶 SETTINGS
Length: ATR Length of all calculated SuperTrends.
Starting Factor: Factor input of the shorter-term SuperTrend.
Increment: Step value between all SuperTrends factors.
Normalize: Normalization method used to rescale the indicator output.
Standardized MACD Heikin-Ashi TransformedThe Standardized MACD Heikin-Ashi Transformed (St. MACD) is an advanced indicator designed to overcome the limitations of the traditional MACD. It offers a more robust and standardized measure of momentum, making it comparable across different timeframes and securities. By incorporating the Heikin-Ashi transformation, the St. MACD provides a smoother visualization of trends and potential reversals, enhancing its utility for traders seeking a clearer view of the underlying market direction.
Methodology:
The calculation of St. MACD begins with the traditional MACD, which computes the difference between two exponential moving averages (EMAs) of the price. To address the issue of non-comparability across assets, the St. MACD normalizes its values using the exponential average of the price's height. This normalization process ensures that the indicator's readings are not influenced by the absolute price levels, allowing for objective and quantitatively defined comparisons of momentum strength.
Furthermore, St. MACD utilizes the Heikin-Ashi transformation, which involves deriving candles from the price data. These Heikin-Ashi candles provide a smoother representation of trends and help filter out noise in the market. A predictive curve of Heikin-Ashi candles within the St. MACD turns blue or red, indicating the prevailing trend direction. This feature enables traders to easily identify trend shifts and make better informed trading decisions.
Advantages:
St. MACD offers several key advantages over the traditional MACD-
Standardization: By normalizing the indicator's values, St. MACD becomes comparable across different assets and timeframes. This makes it a valuable tool for traders analyzing various markets and seeking consistent momentum measurements.
Heikin-Ashi Transformation: The integration of the Heikin-Ashi transformation smoothes out the indicator's fluctuations and enhances trend visibility. Traders can more easily identify trends and potential reversal points, improving their market analysis.
Quantifiable Momentum: St. MACD's key levels represent the strength of momentum, providing traders with a quantifiable framework to gauge the intensity of market movements. This feature helps identify periods of increased or decreased momentum.
Utility:
The St. MACD indicator offers versatile utility for traders-
Trend Identification: Traders can use the color-coded predictive curve of Heikin-Ashi candles to swiftly determine the prevailing trend direction. This aids in identifying potential entry and exit points in the market.
Reversal Signals: Colored extremes within the St. MACD signal potential price reversals, alerting traders to potential turning points in the market. This assists in making timely decisions during market inflection points.
Overbought/Oversold Conditions: The histogram version of St. MACD can be used in conjunction with the bands to detect short-term overbought or oversold market conditions, allowing traders to adjust their strategies accordingly.
In conclusion, this tool addresses the limitations of the traditional MACD by providing a standardized and comparable momentum indicator. Its incorporation of the Heikin-Ashi transformation enhances trend visibility and assists traders in making more informed decisions. With its quantifiable momentum measurements and various utility features, the St. MACD is a valuable tool for traders seeking a clearer and more objective view of market trends and reversals.
Key Features:
Display Modes: MACD, Histogram or Hybrid
Reversion Triangles by adjustable thresholds
Bar Coloring Methods: MidLine, Candles, Signal Cross, Extremities, Reversions
Example Charts:
-Traditional limitations-
-Comparisons across time and securities-
-Showcase-
See Also:
-Other Heikin-Ashi Transforms-
MACD Normalized [ChartPrime]Overview of MACD Normalized Indicator
The MACD Normalized indicator, serves as an asset for traders seeking to harness the power of the moving average convergence divergence (MACD) combined with the advantages of the stochastic oscillator. This novel indicator introduces a normalized MACD, offering a potentially enhanced flexibility and adaptability to numerous market conditions and trading techniques.
This indicator stands out by normalizing the MACD to its average high and average low, also factoring in the deviation of the high-low position from the mean. This approach incorporates the high and low in the calculations, providing the benefits of stochastic without its common drawbacks, such as clipping problems. As a result, the indicator becomes exceptionally versatile and suitable for various trading strategies, including both faster and slower settings.
The MACD Normalized Indicator boasts a variety of options and settings. The features include:
Enable Ribbon: Toggle the display of the ribbon accompanying the MACD Normalized, as desired.
Fast Length: Determine the movement speed of the fast line to receive advance notice of potential market opportunities.
Slow Length: Control the movement pace of the slow line for smoother signals and a comprehensive outlook on market trends.
Average Length: Specify the length used to calculate the high and low averages, providing greater control over the indicator's granularity.
Upper Deviation: Establish the extent to which the high and low values deviate from the mean, ensuring adaptability to diverse market situations.
Inner Band (Middle Deviation): Adjust the balance between the high and low deviations to create an inner band signal, giving traders a secondary level of market analysis and decision-making support.
Enable Candle Color: Enable the coloring of candles based on the MACD Normalized value for effortless visualization of trading potential.
Use Cases for the MACD Normalized Indicator
In addition to analyzing market trends and identifying potential trading opportunities, ChartPrime's MACD Normalized Indicator offers a range of applications for traders. These use cases encompass distinct trading scenarios and strategies:
Overbought and Oversold Regions
One of the key applications of the MACD Normalized Indicator is identifying overbought and oversold regions. Overbought refers to a situation where an asset's price has risen significantly and is expected to face a downturn, while oversold indicates a price drop that may subsequently lead to a reversal.
By adjusting the indicator's parameters, such as the upper and inner deviation levels, traders can set precise boundaries to determine overbought and oversold areas. When the MACD moves into the upper region, it may signal that the asset is overbought and due for a price correction. Conversely, if the MACD enters the lower region, it possibly indicates an oversold condition with the potential for a price rebound.
Signal Line Crossovers
The MACD Normalized Indicator displays two lines: the fast line and the slow line (inner band). A common trading strategy involves observing the intersection of these two lines, known as a crossover. When the fast line crosses above the slow line, it may signify a bullish trend or a potential buying opportunity. Conversely, a crossover with the fast line moving below the slow line typically indicates a bearish trend or a selling opportunity.
Divergence and Convergence
Divergence occurs when the price movement of an asset does not align with the corresponding MACD values. If the price establishes a new high while the MACD fails to do the same, a bearish divergence emerges, suggesting a potential downtrend. Similarly, a bullish divergence takes place when the price forms a new low but the MACD does not follow suit, hinting at an upcoming uptrend.
Convergence, on the other hand, is represented by the MACD lines moving closer together. This movement signifies a potential change in the trend, providing traders with a timely opportunity to enter or exit the market.
Normalized KAMA Oscillator | Ikke OmarThis indicator demonstrates the creation of a normalized KAMA (Kaufman Adaptive Moving Average) oscillator with a table display. I will explain how the code works, providing a step-by-step breakdown. This is personally made by me:)
Input Parameters:
fast_period and slow_period: Define the periods for calculating the KAMA.
er_period: Specifies the period for calculating the Efficiency Ratio.
norm_period: Determines the lookback period for normalizing the oscillator.
Efficiency Ratio (ER) Calculation:
Measures the efficiency of price changes over a specified period.
Calculated as the ratio of the absolute price change to the total price volatility.
Smoothing Constant Calculation:
Determines the smoothing constant (sc) based on the Efficiency Ratio (ER) and the fast and slow periods.
The formula accounts for the different periods to calculate an appropriate smoothing factor.
KAMA Calculation:
Uses the Exponential Moving Average (EMA) and the smoothing constant to compute the KAMA.
Combines the fast EMA and the adjusted price change to adapt to market conditions.
Oscillator Normalization:
Normalizes the oscillator values to a range between -0.5 and 0.5 for better visualization and comparison.
Determines the highest and lowest values of the KAMA within the specified normalization period.
Transforms the KAMA values into a normalized range.
By incorporating the Efficiency Ratio, smoothing constant, and normalization techniques, the indicator actually allows for the identification of trends on different timeframes, even in extreme market conditions.
The normalization makes it much more adaptive than if you were to just use a normal KAMA line. This way you actually get a lot more data by looking at the histogram, rather than just the KAMA line.
I essentially made the KAMA into an oscillator! Please ask if you want me to code another indicator
I hope you enjoyed this.
Please ask if you have any questions<3
Vector ScalerVector Scaler is like Stochastic but it uses a different method to scale the input. The method is very similar to vector normalization but instead of keeping the "vector" we just sum the three points and average them. The blue line is the signal line and the orange line is the smoothed signal line. I have added the "J" line from the KDJ indicator to help spot divergences. Differential mode uses the delta of the input for the calculations. Here are some pictures to help illustrate how this works relative to other popular indicators.
Vector Scaler vs Stochastic
Vector Scaler vs Smooth Stochastic RSI
average set to 100
average set to 200
Normalized VolatilityOVERVIEW
The Normalized Volatility indicator is a technical indicator that gauges the amount of volatility currently present in the market, relative to the average volatility in the market. The purpose of this indicator is to filter out with-trend signals during ranging/non-trending/consolidating conditions.
CONCEPTS
This indicator assists traders in capitalizing on the assumption that trends are more likely to start during periods of high volatility compared to periods of low volatility. This is because high volatility indicates that there are bigger players currently in the market, which is necessary to begin a sustained trending move.
So, to determine whether the current volatility is "high", it is compared to an average volatility for however number of candles back the user specifies.
If the current volatility is greater than the average volatility, it is reasonable to assume we are in a high-volatility period. Thus, this is the ideal time to enter a trending trade due to the assumption that trends are more likely to start during these high-volatility periods.
HOW DO I READ THIS INDICATOR
When the column's color is red, don't take any trend trades since the current volatility is less than the average volatility experienced in the market.
When the column's color is green, take all valid with-trend trades since the current volatility is greater than the average volatility experienced in the market.
Normalized VolumeOVERVIEW
The Normalized Volume indicator is a technical indicator that gauges the amount of volume currently present in the market, relative to the average volume in the market. The purpose of this indicator is to filter out with-trend signals during ranging/non-trending/consolidating conditions.
CONCEPTS
This indicator assists traders in capitalizing on the assumption that trends are more likely to start during periods of high volume compared to periods of low volume. This is because high volume indicates that there are bigger players currently in the market, which is necessary to begin a sustained trending move.
So, to determine whether the current volume is "high", it is compared to an average volume for however number of candles back the user specifies.
If the current volume is greater than the average volume, it is reasonable to assume we are in a high-volume period. Thus, this is the ideal time to enter a trending trade due to the assumption that trends are more likely to start during these high-volume periods.
More information on this indicator can be found on NNFX's video on it in his Indicator Profile series and on Stonehill Forex's blog post on it .
HOW DO I READ THIS INDICATOR
When the column's color is red, don't take any trend trades since the current volume is less than the average volume experienced in the market.
When the column's color is green, take all valid with-trend trades since the current volume is greater than the average volume experienced in the market.
Possible RSI [Loxx]Possible RSI is a normalized, variety second-pass normalized, Variety RSI with Dynamic Zones and optionl High-Pass IIR digital filtering of source price input. This indicator includes 7 types of RSI.
High-Pass Fitler (optional)
The Ehlers Highpass Filter is a technical analysis tool developed by John F. Ehlers. Based on aerospace analog filters, this filter aims at reducing noise from price data. Ehlers Highpass Filter eliminates wave components with periods longer than a certain value. This reduces lag and makes the oscialltor zero mean. This turns the RSI output into something more similar to Stochasitc RSI where it repsonds to price very quickly.
First Normalization Pass
RSI (Relative Strength Index) is already normalized. Hence, making a normalized RSI seems like a nonsense... if it was not for the "flattening" property of RSI. RSI tends to be flatter and flatter as we increase the calculating period--to the extent that it becomes unusable for levels trading if we increase calculating periods anywhere over the broadly recommended period 8 for RSI. In order to make that (calculating period) have less impact to significant levels usage of RSI trading style in this version a sort of a "raw stochastic" (min/max) normalization is applied.
Second-Pass Variety Normalization Pass
There are three options to choose from:
1. Gaussian (Fisher Transform), this is the default: The Fisher Transform is a function created by John F. Ehlers that converts prices into a Gaussian normal distribution. The normaliztion helps highlights when prices have moved to an extreme, based on recent prices. This may help in spotting turning points in the price of an asset. It also helps show the trend and isolate the price waves within a trend.
2. Softmax: The softmax function, also known as softargmax: or normalized exponential function, converts a vector of K real numbers into a probability distribution of K possible outcomes. It is a generalization of the logistic function to multiple dimensions, and used in multinomial logistic regression. The softmax function is often used as the last activation function of a neural network to normalize the output of a network to a probability distribution over predicted output classes, based on Luce's choice axiom.
3. Regular Normalization (devaitions about the mean): Converts a vector of K real numbers into a probability distribution of K possible outcomes without using log sigmoidal transformation as is done with Softmax. This is basically Softmax without the last step.
Dynamic Zones
As explained in "Stocks & Commodities V15:7 (306-310): Dynamic Zones by Leo Zamansky, Ph .D., and David Stendahl"
Most indicators use a fixed zone for buy and sell signals. Here’ s a concept based on zones that are responsive to past levels of the indicator.
One approach to active investing employs the use of oscillators to exploit tradable market trends. This investing style follows a very simple form of logic: Enter the market only when an oscillator has moved far above or below traditional trading lev- els. However, these oscillator- driven systems lack the ability to evolve with the market because they use fixed buy and sell zones. Traders typically use one set of buy and sell zones for a bull market and substantially different zones for a bear market. And therein lies the problem.
Once traders begin introducing their market opinions into trading equations, by changing the zones, they negate the system’s mechanical nature. The objective is to have a system automatically define its own buy and sell zones and thereby profitably trade in any market — bull or bear. Dynamic zones offer a solution to the problem of fixed buy and sell zones for any oscillator-driven system.
An indicator’s extreme levels can be quantified using statistical methods. These extreme levels are calculated for a certain period and serve as the buy and sell zones for a trading system. The repetition of this statistical process for every value of the indicator creates values that become the dynamic zones. The zones are calculated in such a way that the probability of the indicator value rising above, or falling below, the dynamic zones is equal to a given probability input set by the trader.
To better understand dynamic zones, let's first describe them mathematically and then explain their use. The dynamic zones definition:
Find V such that:
For dynamic zone buy: P{X <= V}=P1
For dynamic zone sell: P{X >= V}=P2
where P1 and P2 are the probabilities set by the trader, X is the value of the indicator for the selected period and V represents the value of the dynamic zone.
The probability input P1 and P2 can be adjusted by the trader to encompass as much or as little data as the trader would like. The smaller the probability, the fewer data values above and below the dynamic zones. This translates into a wider range between the buy and sell zones. If a 10% probability is used for P1 and P2, only those data values that make up the top 10% and bottom 10% for an indicator are used in the construction of the zones. Of the values, 80% will fall between the two extreme levels. Because dynamic zone levels are penetrated so infrequently, when this happens, traders know that the market has truly moved into overbought or oversold territory.
Calculating the Dynamic Zones
The algorithm for the dynamic zones is a series of steps. First, decide the value of the lookback period t. Next, decide the value of the probability Pbuy for buy zone and value of the probability Psell for the sell zone.
For i=1, to the last lookback period, build the distribution f(x) of the price during the lookback period i. Then find the value Vi1 such that the probability of the price less than or equal to Vi1 during the lookback period i is equal to Pbuy. Find the value Vi2 such that the probability of the price greater or equal to Vi2 during the lookback period i is equal to Psell. The sequence of Vi1 for all periods gives the buy zone. The sequence of Vi2 for all periods gives the sell zone.
In the algorithm description, we have: Build the distribution f(x) of the price during the lookback period i. The distribution here is empirical namely, how many times a given value of x appeared during the lookback period. The problem is to find such x that the probability of a price being greater or equal to x will be equal to a probability selected by the user. Probability is the area under the distribution curve. The task is to find such value of x that the area under the distribution curve to the right of x will be equal to the probability selected by the user. That x is the dynamic zone.
7 Types of RSI
See here to understand which RSI types are included:
Included:
Bar coloring
4 signal types
Alerts
Loxx's Expanded Source Types
Loxx's Variety RSI
Loxx's Dynamic Zones
Leavitt Convolution Slope [CC]The Leavitt Convolution Slope indicator was created by Jay Leavitt (Stocks and Commodities Oct 2019, page 11), who is most well known for creating the Volume-Weighted Average Price indicator. This indicator is very similar to the Leavitt Convolution indicator but the big difference is that it is getting the slope instead of predicting the next Convolution value. I changed quite a few things from the original source code so let me know if you like these changes. I added a normalization function using code from a good friend @loxx that I recommend to leave on but feel free to experiment with it. Last but not least, the unsure levels are essentially acting as a buy or sell threshold. I personally recommend to buy or sell for zero crossovers but another option would be to buy or sell for crossovers using the unsure levels. I have color coded the lines to turn light green for a normal buy signal or dark green for a strong buy signal and light red for a normal sell signal, and dark red for a strong sell signal.
This is another indicator in a series that I'm publishing to fulfill a special request from @ashok1961 so let me know if you ever have any special requests for me.