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.
Trend Analysis
Ichimoku Crosses_RSI_AITIchimoku Crosser_RSI_AIT
Overview
The "Ichimoku Cloud Crosses_AIT" strategy is a technical trading strategy that combines the Ichimoku Cloud components with the Relative Strength Index (RSI) to generate trade signals. This strategy leverages the crossovers of the Tenkan-sen and Kijun-sen lines of the Ichimoku Cloud, along with RSI levels, to identify potential entry and exit points for long and short trades. This guide explains the strategy components, conditions, and how to use it effectively in your trading.
1. Strategy Parameters
User Inputs
Tenkan-sen Period (tenkanLength): Default value is 21. This is the period used to calculate the Tenkan-sen line (conversion line) of the Ichimoku Cloud.
Kijun-sen Period (kijunLength): Default value is 120. This is the period used to calculate the Kijun-sen line (base line) of the Ichimoku Cloud.
Senkou Span B Period (senkouBLength): Default value is 52. This is the period used to calculate the Senkou Span B line (leading span B) of the Ichimoku Cloud.
RSI Period (rsiLength): Default value is 14. This period is used to calculate the Relative Strength Index (RSI).
RSI Long Entry Level (rsiLongLevel): Default value is 60. This level indicates the minimum RSI value for a long entry signal.
RSI Short Entry Level (rsiShortLevel): Default value is 40. This level indicates the maximum RSI value for a short entry signal.
2. Strategy Components
Ichimoku Cloud
Tenkan-sen: A short-term trend indicator calculated as the simple moving average (SMA) of the highest high and the lowest low over the Tenkan-sen period.
Kijun-sen: A medium-term trend indicator calculated as the SMA of the highest high and the lowest low over the Kijun-sen period.
Senkou Span A: Calculated as the average of the Tenkan-sen and Kijun-sen, plotted 26 periods ahead.
Senkou Span B: Calculated as the SMA of the highest high and lowest low over the Senkou Span B period, plotted 26 periods ahead.
Chikou Span: The closing price plotted 26 periods behind.
Relative Strength Index (RSI)
RSI: A momentum oscillator that measures the speed and change of price movements. It ranges from 0 to 100 and is used to identify overbought or oversold conditions.
3. Entry and Exit Conditions
Entry Conditions
Long Entry:
The Tenkan-sen crosses above the Kijun-sen (bullish crossover).
The RSI value is greater than or equal to the rsiLongLevel.
Short Entry:
The Tenkan-sen crosses below the Kijun-sen (bearish crossover).
The RSI value is less than or equal to the rsiShortLevel.
Exit Conditions
Exit Long Position: The Tenkan-sen crosses below the Kijun-sen.
Exit Short Position: The Tenkan-sen crosses above the Kijun-sen.
4. Visual Representation
Tenkan-sen Line: Plotted on the chart. The color changes based on its relation to the Kijun-sen (green if above, red if below) and is displayed with a line width of 2.
Kijun-sen Line: Plotted as a white line with a line width of 1.
Entry Arrows:
Long Entry: Displayed as a yellow triangle below the bar.
Short Entry: Displayed as a fuchsia triangle above the bar.
5. How to Use
Apply the Strategy: Apply the "Ichimoku Cloud Crosses_AIT" strategy to your chart in TradingView.
Configure Parameters: Adjust the strategy parameters (Tenkan-sen, Kijun-sen, Senkou Span B, and RSI settings) according to your trading preferences.
Interpret the Signals:
Long Entry: A yellow triangle appears below the bar when a long entry signal is generated.
Short Entry: A fuchsia triangle appears above the bar when a short entry signal is generated.
Monitor Open Positions: The strategy automatically exits positions based on the defined conditions.
Backtesting and Live Trading: Use the strategy for backtesting and live trading. Adjust risk management settings in the strategy properties as needed.
Conclusion
The "Ichimoku Cloud Crosses_AIT" strategy uses Ichimoku Cloud crossovers and RSI to generate trading signals. This strategy aims to capture market trends and potential reversals, providing a structured way to enter and exit trades. Make sure to backtest and optimize the strategy parameters to suit your trading style and market conditions before using it in a live trading environment.
Trend Magic with EMA, SMA, and Auto-TradingRelease Notes
Strategy Name: Trend Magic with EMA, SMA, and Auto-Trading
Purpose: This strategy is designed to capture entry and exit points in the market using the Trend Magic indicator and three moving averages (EMA45, SMA90, and SMA180). Specifically, it uses the perfect order of the moving averages and the color changes in Trend Magic to identify trend reversals and potential trading opportunities.
Uniqueness and Usefulness
Uniqueness: The strategy utilizes the Trend Magic indicator, which is based on price and volatility, along with three moving averages to assess the strength of trends. The signals are generated only when the moving averages are in perfect order, and the Trend Magic color changes, ensuring that the entry is made during established trends. This combination provides a higher degree of reliability compared to strategies that rely solely on price action or single indicators.
Usefulness: This strategy is particularly useful for traders looking to capture trends over longer periods. It is effective at reducing noise in the market, only providing signals when the moving averages align and the Trend Magic indicator confirms a trend reversal. It works well in both trending and volatile markets.
Entry Conditions
Long Entry:
Condition: A perfect order (EMA45 > SMA90 > SMA180) is established, and Trend Magic changes color from red to blue.
Signal: A buy signal is generated, indicating the start of an uptrend.
Short Entry:
Condition: A perfect order (EMA45 < SMA90 < SMA180) is established, and Trend Magic changes color from blue to red.
Signal: A sell signal is generated, indicating the start of a downtrend.
Exit Conditions
Exit Strategy:
This strategy automatically enters and exits trades based on signals, but traders are encouraged to manage exits manually according to their own risk management preferences. The strategy includes stop loss and take profit settings based on risk-to-reward ratios for better risk management.
Risk Management
The strategy includes built-in risk management by using the SMA90 level at the time of entry as the stop-loss point and setting the take profit at a 1:1.5 risk-to-reward ratio. The stop-loss level is fixed at the entry point and does not move as the market progresses. Traders are advised to implement additional risk management, such as trailing stops, for added protection.
Account Size: ¥100,000
Commissions and Slippage: Assumes 94 pips for commissions and 1 pip for slippage per trade
Risk per Trade: 10% of account equity (adjust this based on personal risk tolerance)
Configurable Options
Configurable Options:
CCI Period: Set the period for the CCI used to calculate the Trend Magic indicator (default is 21).
ATR Multiplier: Set the multiplier for ATR used in the Trend Magic calculation (default is 1.0).
EMA/SMA Periods: The periods for the three moving averages (default is EMA45, SMA90, and SMA180).
Signal Display Control: An option to toggle the display of buy and sell signals on the chart.
Adequate Sample Size
To ensure the robustness and reliability of this strategy, it is recommended to backtest it with a sufficiently long period of historical data. Testing across different market conditions, including high and low volatility periods, is also advised.
Credits
Acknowledgments:
This strategy is based on the Trend Magic indicator combined with moving averages and draws on contributions from the technical analysis and trading community.
Clean Chart Description
Chart Appearance:
To maintain a clean and simple chart, this strategy includes options to turn off the display of Trend Magic, moving averages, and entry signals. Traders can adjust these display settings as needed to minimize visual clutter and focus on effective trend analysis.
Addressing the House Rule Violations
Omissions and Unrealistic Claims
Clarification:
This strategy does not make any unrealistic or unsupported claims about its performance. All signals are intended for educational purposes only and do not guarantee future results. It is important to note that past performance does not guarantee future outcomes, and proper risk management is crucial.
TPS Short Strategy by Larry ConnersThe TPS Short strategy aims to capitalize on extreme overbought conditions in an ETF by employing a scaling-in approach when certain technical indicators signal potential reversals. The strategy is designed to short the ETF when it is deemed overextended, based on the Relative Strength Index (RSI) and moving averages.
Components:
200-Day Simple Moving Average (SMA):
Purpose: Acts as a long-term trend filter. The ETF must be below its 200-day SMA to be eligible for shorting.
Rationale: The 200-day SMA is widely used to gauge the long-term trend of a security. When the price is below this moving average, it is often considered to be in a downtrend (Tushar S. Chande & Stanley Kroll, "The New Technical Trader: Boost Your Profit by Plugging Into the Latest Indicators").
2-Period RSI:
Purpose: Measures the speed and change of price movements to identify overbought conditions.
Criteria: Short 10% of the position when the 2-period RSI is above 75 for two consecutive days.
Rationale: A high RSI value (above 75) indicates that the ETF may be overbought, which could precede a price reversal (J. Welles Wilder, "New Concepts in Technical Trading Systems").
Scaling-In Mechanism:
Purpose: Gradually increase the short position as the ETF price rises beyond previous entry points.
Scaling Strategy:
20% more when the price is higher than the first entry.
30% more when the price is higher than the second entry.
40% more when the price is higher than the third entry.
Rationale: This incremental approach allows for an increased position size in a worsening trend, potentially increasing profitability if the trend continues to align with the strategy’s premise (Marty Schwartz, "Pit Bull: Lessons from Wall Street's Champion Day Trader").
Exit Conditions:
Criteria: Close all positions when the 2-period RSI drops below 30 or the 10-day SMA crosses above the 30-day SMA.
Rationale: A low RSI value (below 30) suggests that the ETF may be oversold and could be poised for a rebound, while the SMA crossover indicates a potential change in the trend (Martin J. Pring, "Technical Analysis Explained").
Risks and Considerations:
Market Risk:
The strategy assumes that the ETF will continue to decline once shorted. However, markets can be unpredictable, and price movements might not align with the strategy's expectations, especially in a volatile market (Nassim Nicholas Taleb, "The Black Swan: The Impact of the Highly Improbable").
Scaling Risks:
Scaling into a position as the price increases may increase exposure to adverse price movements. This method can amplify losses if the market moves against the position significantly before any reversal occurs.
Liquidity Risk:
Depending on the ETF’s liquidity, executing large trades in increments might affect the price and increase trading costs. It is crucial to ensure that the ETF has sufficient liquidity to handle large trades without significant slippage (James Altucher, "Trade Like a Hedge Fund").
Execution Risk:
The strategy relies on timely execution of trades based on specific conditions. Delays or errors in order execution can impact performance, especially in fast-moving markets.
Technical Indicator Limitations:
Technical indicators like RSI and SMA are based on historical data and may not always predict future price movements accurately. They can sometimes produce false signals, leading to potential losses if used in isolation (John Murphy, "Technical Analysis of the Financial Markets").
Conclusion
The TPS Short strategy utilizes a combination of long-term trend filtering, overbought conditions, and incremental shorting to potentially profit from price reversals. While the strategy has a structured approach and leverages well-known technical indicators, it is essential to be aware of the inherent risks, including market volatility, liquidity issues, and potential limitations of technical indicators. As with any trading strategy, thorough backtesting and risk management are crucial to its successful implementation.
Optimized Heikin Ashi Strategy with Buy/Sell OptionsStrategy Name:
Optimized Heikin Ashi Strategy with Buy/Sell Options
Description:
The Optimized Heikin Ashi Strategy is a trend-following strategy designed to capitalize on market trends by utilizing the smoothness of Heikin Ashi candles. This strategy provides flexible options for trading, allowing users to choose between Buy Only (long-only), Sell Only (short-only), or using both in alternating conditions based on the Heikin Ashi candle signals. The strategy works on any market, but it performs especially well in markets where trends are prevalent, such as cryptocurrency or Forex.
This script offers customizable parameters for the backtest period, Heikin Ashi timeframe, stop loss, and take profit levels, allowing traders to optimize the strategy for their preferred markets or assets.
Key Features:
Trade Type Options:
Buy Only: Enter a long position when a green Heikin Ashi candle appears and exit when a red candle appears.
Sell Only: Enter a short position when a red Heikin Ashi candle appears and exit when a green candle appears.
Stop Loss and Take Profit:
Customizable stop loss and take profit percentages allow for flexible risk management.
The default stop loss is set to 2%, and the default take profit is set to 4%, maintaining a favorable risk/reward ratio.
Heikin Ashi Timeframe:
Traders can select the desired timeframe for Heikin Ashi candle calculation (e.g., 4-hour Heikin Ashi candles for a 1-hour chart).
The strategy smooths out price action and reduces noise, providing clearer signals for entry and exit.
Inputs:
Backtest Start Date / End Date: Specify the period for testing the strategy’s performance.
Heikin Ashi Timeframe: Select the timeframe for Heikin Ashi candle generation. A higher timeframe helps smooth the trend, which is beneficial for trading lower timeframes.
Stop Loss (in %) and Take Profit (in %): Enable or disable stop loss and take profit, and adjust the levels based on market conditions.
Trade Type: Choose between Buy Only or Sell Only based on your market outlook and strategy preference.
Strategy Performance:
In testing with BTC/USD, this strategy performed well in a 4-hour Heikin Ashi timeframe applied on a 1-hour chart over a period from January 1, 2024, to September 12, 2024. The results were as follows:
Initial Capital: 1 USD
Order Size: 100% of equity
Net Profit: +30.74 USD (3,073.52% return)
Percent Profitable: 78.28% of trades were winners.
Profit Factor: 15.825, indicating that the strategy's profitable trades far outweighed its losses.
Max Drawdown: 4.21%, showing low risk exposure relative to the large profit potential.
This strategy is ideal for both beginner and advanced traders who are looking to follow trends and avoid market noise by using Heikin Ashi candles. It is also well-suited for traders who prefer automated risk management through the use of stop loss and take profit levels.
Recommended Use:
Best Markets: This strategy works well on trending markets like cryptocurrency, Forex, or indices.
Timeframes: Works best when applied to lower timeframes (e.g., 1-hour chart) with a higher Heikin Ashi timeframe (e.g., 4-hour candles) to smooth out price action.
Leverage: The strategy performs well with leverage, but users should consider using 2x to 3x leverage to avoid excessive risk and potential liquidation. The strategy's low drawdown allows for moderate leverage use while maintaining risk control.
Customization: Traders can adjust the stop loss and take profit percentages based on their risk appetite and market conditions. A default setting of a 2% stop loss and 4% take profit provides a balanced risk/reward ratio.
Notes:
Risk Management: Traders should enable stop loss and take profit settings to maintain effective risk management and prevent large drawdowns during volatile market conditions.
Optimization: This strategy can be further optimized by adjusting the Heikin Ashi timeframe and risk parameters based on specific market conditions and assets.
Backtesting: The built-in backtesting functionality allows traders to test the strategy across different market conditions and historical data to ensure robustness before applying it to live trading.
How to Apply:
Select your preferred market and chart.
Choose the appropriate Heikin Ashi timeframe based on the chart's timeframe. (e.g., use 4-hour Heikin Ashi candles for 1-hour chart trends).
Adjust stop loss and take profit based on your risk management preference.
Run backtesting to evaluate its performance before applying it in live trading.
This strategy can be further modified and optimized based on personal trading style and market conditions. It’s important to monitor performance regularly and adjust settings as needed to align with market behavior.
Larry Connors 3 Day High/Low StrategyThe Larry Connors 3 Day High/Low Strategy is a short-term mean-reversion trading strategy that is designed to identify potential buying opportunities when a security is oversold. This strategy is based on the principles developed by Larry Connors, a well-known trading system developer and author.
Key Strategy Elements:
1. Trend Confirmation: The strategy first confirms that the security is in a long-term uptrend by ensuring that the closing price is above the 200-day moving average (condition1). This rule helps filter trades to align with the longer-term trend.
2. Short-Term Pullback: The strategy looks for a short-term pullback by ensuring that the closing price is below the 5-day moving average (condition2). This identifies potential entry points when the price temporarily moves against the longer-term trend.
3. Three Consecutive Lower Highs and Lows:
• The high and low two days ago are lower than those of the day before (condition3).
• The high and low yesterday are lower than those of two days ago (condition4).
• Today’s high and low are lower than yesterday’s (condition5).
These conditions are used to identify a sequence of declining highs and lows, signaling a short-term pullback or oversold condition in the context of an overall uptrend.
4. Entry and Exit Signals:
• Buy Signal: A buy order is triggered when all the above conditions are met (buyCondition).
• Sell Signal: A sell order is executed when the closing price is above the 5-day moving average (sellCondition), indicating that the pullback might be ending.
Risks of the Strategy
1. Mean Reversion Failure: This strategy relies on the assumption that prices will revert to the mean after a short-term pullback. In strong downtrends or during market crashes, prices may continue to decline, leading to significant losses.
2. Whipsaws and False Signals: The strategy may generate false signals, especially in choppy or sideways markets where the price does not follow a clear trend. This can lead to frequent small losses that can add up over time.
3. Dependence on Historical Patterns: The strategy is based on historical price patterns, which do not always predict future price movements accurately. Sudden market news or economic changes can disrupt the pattern.
4. Lack of Risk Management: The strategy as written does not include stop losses or position sizing rules, which can expose traders to larger-than-expected losses if conditions change rapidly.
About Larry Connors
Larry Connors is a renowned trader, author, and founder of Connors Research and TradingMarkets.com. He is widely recognized for his development of quantitative trading strategies, especially those focusing on short-term mean reversion techniques. Connors has authored several books on trading, including “Short-Term Trading Strategies That Work” and “Street Smarts,” co-authored with Linda Raschke. His strategies are known for their systematic, rules-based approach and have been widely used by traders and investment professionals.
Connors’ research often emphasizes the importance of trading with the trend, managing risk, and using statistically validated techniques to improve trading outcomes. His work has been influential in the field of quantitative trading, providing accessible strategies for traders at various skill levels.
References
1. Connors, L., & Raschke, L. (1995). Street Smarts: High Probability Short-Term Trading Strategies.
2. Connors, L. (2009). Short-Term Trading Strategies That Work.
3. Fama, E. F., & French, K. R. (1988). Permanent and Temporary Components of Stock Prices. Journal of Political Economy, 96(2), 246-273.
This strategy and its variations are popular among traders looking to capitalize on short-term price movements while aligning with longer-term trends. However, like all trading strategies, it requires rigorous backtesting and risk management to ensure its effectiveness under different market conditions.
Fractal Proximity MA Aligment Scalping StrategyFractal Analysis
Fractals in trading help identify potential reversal points by marking significant price changes. Our strategy calculates a "fractal value" by comparing the current price to recent high and low fractal points. This is done by evaluating the sum of distances from the current closing price to the recent highs and lows. A positive fractal value suggests proximity to recent lows, hinting at upward momentum. Conversely, a negative value indicates closeness to recent highs, signaling potential downward movement.
Moving Averages for Confirmation
We use a series of 20 moving averages ranging from 5 to 100 to confirm trend directions indicated by fractal analysis. An entry signal is considered bullish when shorter-term moving averages are all above a long-term moving average, aligning with a positive fractal value.
Exit Strategy
The strategy employs dynamic stop-loss levels set at various moving averages, allowing for partial exits when the price crosses below specific thresholds. This helps manage the trade by locking in profits gradually. A full exit might be triggered by strong reversal signals suggested by both fractal values and moving average trends.
This open-source strategy is available for the community to test, adapt, and utilize. Your feedback and modifications are welcome as we refine the approach based on collective user experiences.
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.
VRS (Vegas Reversal Strategy)It is based on the reversal of the price after an accentuated volatility of the previous day. It is tested only on BTC, TF Day, and has an activation value equal to a spike of minimum 2.4% amplitude, a value that I have left in the settings free to be modified if it is found valid for other assets.
In the settings you can change how many of the latest longs or shorts I want to view in the past, colors and various aesthetics.
When the system detects a spike at the end of the day from 2.4% onwards it will signal the direction of Reversal, generating the 3 TP, dotted lines.
Entry into the market must be done at the close of the candle day, unfortunately at night time if you want to enter on the tick.
Stop above/below the spike that generated the condition.
If the Day2 candle closes FULL inside the spike, immediate and early closing of the operation.
There cannot be two consecutive Day events: if you are Long or Short and have taken a stop on the next candle, even if the latter generates another entry, this must not be activated.
TP 1 and 2 are both mandatory at 33% of the position, TP3, based on the current movement, can be considered to be left to run to the bitter end or in any case to structuring confirmations of a slowdown in the price.
Upon reaching TP1 it is mandatory to move the STOP to even.
In the event of the presence of extremely strong directional movements, for example Long direction, an opposite activation, Short, must be done but with reduced capital, on the contrary an activation in the same direction as the trend movement can be done with a surcharge. Always pay attention to Money Management and Risk Management.
Always manage Risk and Money Management in an adequate, technical and sustainable manner in relation to your capital. A fair exposure per transaction is between 1% and 2% of the capital.
Trend Signals with TP & SL [UAlgo] StrategyThe "Trend Signals with TP & SL Strategy" is a trading strategy designed to capture trend continuation signals while incorporating sophisticated risk management techniques. This strategy is tailored for traders who wish to capitalize on trending market conditions with precise entry and exit points, automatically calculating Take Profit (TP) and Stop Loss (SL) levels based on either Average True Range (ATR) or percentage values. The strategy aims to enhance trade management by preventing multiple simultaneous positions and dynamically adapting to changing market conditions.
This strategy is highly configurable, allowing traders to adjust sensitivity, the ATR calculation method, and the cloud moving average length. Additionally, the strategy can display buy and sell signals directly on the chart, along with visual representation of entry points, stop losses, and take profits. It also features a cloud-based trend analysis using a MACD-driven color fill that indicates the strength and direction of the trend.
🔶 Key Features
Configurable Trend Continuation Signals:
Source Selection: The strategy uses the midpoint of the high-low range as the default source, but it is adjustable.
Sensitivity: The sensitivity of the trend signals can be adjusted using a multiplier, ranging from 0.5 to 5.
ATR Calculation: The strategy allows users to choose between two ATR calculation methods for better adaptability to different market conditions.
Cloud Moving Average: Traders can adjust the cloud moving average length, which is used in conjunction with MACD to provide a visual trend indication.
Take Profit & Stop Loss Management:
ATR-Based or Percent-Based: The strategy offers flexibility in setting TP and SL levels, allowing traders to choose between ATR-based multipliers or fixed percentage values.
Dynamic Adjustment: TP and SL levels are dynamically adjusted according to the selected method, ensuring trades are managed based on real-time market conditions.
Prevention of Multiple Positions:
Single Position Control: To reduce risk and enhance strategy reliability, the strategy includes an option to prevent multiple positions from being opened simultaneously.
Visual Trade Indicators:
Buy/Sell Signals: Clearly displays buy and sell signals on the chart for easy interpretation.
Entry, SL, and TP Lines: Draws lines for entry price, stop loss, and take profit directly on the chart, helping traders to monitor trades visually.
Trend Cloud: A color-filled cloud based on MACD and the cloud moving average provides a visual cue of the trend’s direction and strength.
Performance Summary Table:
In-Chart Statistics: A table in the top right of the chart displays key performance metrics, including total trades, wins, losses, and win rate percentage, offering a quick overview of the strategy’s effectiveness.
🔶 Interpreting the Indicator
Trend Signals: The strategy identifies trend continuation signals based on price action relative to an ATR-based threshold. A buy signal is generated when the price crosses above a key level, indicating an uptrend. Conversely, a sell signal occurs when the price crosses below a level, signaling a downtrend.
Cloud Visualization: The cloud, derived from MACD and moving averages, changes color to reflect the current trend. A positive cloud in aqua suggests an uptrend, while a red cloud indicates a downtrend. The transparency of the cloud offers further nuance, with more solid colors denoting stronger trends.
Entry and Exit Management: Once a trend signal is generated, the strategy automatically sets TP and SL levels based on your chosen method (ATR or percentage). The stop loss and take profit lines will appear on the chart, showing where the strategy will exit the trade. If the price reaches either the SL or TP, the trade is closed, and the respective line is deleted from the chart.
Performance Metrics: The strategy’s performance is tracked in real-time with an in-chart table. This table provides essential information about the number of trades executed, the win/loss ratio, and the overall win rate. This information helps traders assess the strategy's effectiveness and make necessary adjustments.
This strategy is designed for those who seek to engage with trending markets, offering robust tools for entry, exit, and overall trade management. By understanding and leveraging these features, traders can potentially improve their trading outcomes and risk management.
🔷 Related Script
🔶 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.
Breadth Thrust Strategy with Volatility Stop-LossThe "Breadth Thrust Strategy with Volatility Stop-Loss" is a trading strategy designed to capitalize on market momentum while managing risk through volatility-based stop-losses. Here's a detailed breakdown of the strategy:
Strategy Overview:
Market Breadth Analysis: The strategy uses the "Breadth Thrust Indicator," which evaluates market momentum by calculating the ratio of advancing stocks to the total number of stocks on the New York Stock Exchange (NYSE). This indicator helps identify bullish market conditions. An optional feature allows for the inclusion of volume data in this calculation, enhancing the signal's robustness.
Signal Generation: A long position is triggered when the smoothed breadth ratio (or the combined breadth and volume ratio) crosses above a specified low threshold (e.g., 0.4). This crossover indicates a potential shift towards positive market momentum.
Key Parameters:
Smoothing Length (length): Defines the period over which the breadth or combined ratio is smoothed using a simple moving average (SMA) to reduce noise and highlight the underlying trend.
Low Threshold (threshold_low): The level below which the smoothed ratio must fall before crossing back above to trigger a long signal.
Hold Periods (hold_periods): The minimum number of periods for which the position will be held once entered, ensuring the strategy captures a meaningful move.
Volatility Multiplier (volatility_multiplier): A multiplier applied to the Average True Range (ATR) to determine the distance of the stop-loss from the entry price, which adjusts according to market volatility.
Trade Management:
Entry Signal: The strategy enters a long position when the smoothed combined ratio crosses above the low threshold, signaling a potential bullish reversal.
ATR-Based Stop-Loss: Upon entering a trade, the strategy calculates a stop-loss level based on the ATR, which measures market volatility. The stop-loss is set at a distance from the entry price, determined by multiplying the ATR by the specified volatility multiplier. This adaptive stop-loss mechanism helps protect the position from adverse market moves.
Stop-Loss Adjustment: While the position is open, the stop-loss level is dynamically updated, ensuring it never decreases (trailing stop-loss effect) but can be adjusted upwards to reflect the latest price action relative to volatility.
Position Closure: The position is closed if:
The market price falls to or below the stop-loss level.
The position has been held for the specified number of periods (hold_periods), after which it is automatically closed.
Additional Settings:
Initial Capital: The strategy starts with an initial capital of $10,000.
Commissions and Slippage: Each trade incurs a commission of $5 per order, and slippage is accounted for at $1 per trade.
Background Highlighting: The chart background turns green when a position is open, providing a clear visual indication of the active trade.
This strategy is designed to identify and capitalize on upward momentum in the market while employing a volatility-adjusted stop-loss to manage risk. By combining market breadth analysis with volatility-based stop-losses, the strategy aims to balance profit potential with protection against sudden market reversals.
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.
Fibonacci-Only StrategyFibonacci-Only Strategy
This script is a custom trading strategy designed for traders who leverage Fibonacci retracement levels to identify potential trade entries and exits. The strategy is versatile, allowing users to trade across multiple timeframes, with built-in options for dynamic stop loss, trailing stops, and take profit levels.
Key Features:
Custom Fibonacci Levels:
This strategy calculates three specific Fibonacci retracement levels: 19%, 82.56%, and the reverse 19% level. These levels are used to identify potential areas of support and resistance where price reversals or breaks might occur.
The Fibonacci levels are calculated based on the highest and lowest prices within a 100-bar period, making them dynamic and responsive to recent market conditions.
Dynamic Entry Conditions:
Touch Entry: The script enters long or short positions when the price touches specific Fibonacci levels and confirms the move with a bullish (for long) or bearish (for short) candle.
Break Entry (Optional): If the "Use Break Strategy" option is enabled, the script can also enter positions when the price breaks through Fibonacci levels, providing more aggressive entry opportunities.
Stop Loss Management:
The script offers flexible stop loss settings. Users can choose between a fixed percentage stop loss or an ATR-based stop loss, which adjusts based on market volatility.
The ATR (Average True Range) stop loss is multiplied by a user-defined factor, allowing for tailored risk management based on market conditions.
Trailing Stop Mechanism:
The script includes an optional trailing stop feature, which adjusts the stop loss level as the market moves in favor of the trade. This helps lock in profits while allowing the trade to run if the trend continues.
The trailing stop is calculated as a percentage of the difference between the entry price and the current market price.
Multiple Take Profit Levels:
The strategy calculates seven take profit levels, each at incremental percentages above (for long trades) or below (for short trades) the entry price. This allows for gradual profit-taking as the market moves in the trade's favor.
Each take profit level can be customized in terms of the percentage of the position to be closed, providing precise control over exit strategies.
Strategy Backtesting and Results:
Realistic Backtesting:
The script has been backtested with realistic account sizes, commission rates, and slippage settings to ensure that the results are applicable to actual trading scenarios.
The backtesting covers various timeframes and markets to ensure the strategy's robustness across different trading environments.
Default Settings:
The script is published with default settings that have been optimized for general use. These settings include a 15-minute timeframe, a 1.0% stop loss, a 2.0 ATR multiplier for stop loss, and a 1.5% trailing stop.
Users can adjust these settings to better fit their specific trading style or the market they are trading.
How It Works:
Long Entry Conditions:
The strategy enters a long position when the price touches the 19% Fibonacci level (from high to low) or the reverse 19% level (from low to high) and confirms the move with a bullish candle.
If the "Use Break Strategy" option is enabled, the script will also enter a long position when the price breaks below the 19% Fibonacci level and then moves back up, confirming the break with a bullish candle.
Short Entry Conditions:
The strategy enters a short position when the price touches the 82.56% Fibonacci level and confirms the move with a bearish candle.
If the "Use Break Strategy" option is enabled, the script will also enter a short position when the price breaks above the 82.56% Fibonacci level and then moves back down, confirming the break with a bearish candle.
Stop Loss and Take Profit Logic:
The stop loss for each trade is calculated based on the selected method (fixed percentage or ATR-based). The strategy then manages the trade by either trailing the stop or taking profit at predefined levels.
The take profit levels are set at increments of 0.5% above or below the entry price, depending on whether the position is long or short. The script gradually exits the trade as these levels are hit, securing profits while minimizing risk.
Usage:
For Fibonacci Traders:
This script is ideal for traders who rely on Fibonacci retracement levels to find potential trade entries and exits. The script automates the process, allowing traders to focus on market analysis and decision-making.
For Trend and Swing Traders:
The strategy's flexibility in handling both touch and break entries makes it suitable for trend-following and swing trading strategies. The multiple take profit levels allow traders to capture profits in trending markets while managing risk.
Important Notes:
Originality: This script uniquely combines Fibonacci retracement levels with dynamic stop loss management and multiple take profit levels. It is not just a combination of existing indicators but a thoughtful integration designed to enhance trading performance.
Disclaimer: Trading involves risk, and it is crucial to test this script in a demo account or through backtesting before applying it to live trading. Users should ensure that the settings align with their individual risk tolerance and trading strategy.
Gann + Laplace Smoothed Hybrid Volume Spread AnalysisThe Gann + Laplace Smoothed Hybrid Volume Spread Analysis ( GannLSHVSA ) Strategy/Indicator is an trading tool designed to fuse volume analysis with trend detection, offering traders a view of market dynamics.
This Strategy/Indicator stands apart by integrating the principles of the upgraded Discrete Fourier Transform (DFT), the Laplace Stieltjes Transform and volume spread analysis, enhanced with a layer of Fourier smoothing to distill market noise and highlight trend directions with unprecedented clarity.
The length of EMA and Strategy Entries are modified with the Gann swings .
This smoothing process allows traders to discern the true underlying patterns in volume and price action, stripped of the distractions of short-term fluctuations and noise.
The core functionality of the GannLSHVSA revolves around the innovative combination of volume change analysis, spread determination (calculated from the open and close price difference), and the strategic use of the EMA (default 10) to fine-tune the analysis of spread by incorporating volume changes.
Trend direction is validated through a moving average (MA) of the histogram, which acts analogously to the Volume MA found in traditional volume indicators. This MA serves as a pivotal reference point, enabling traders to confidently engage with the market when the histogram's movement concurs with the trend direction, particularly when it crosses the Trend MA line, signalling optimal entry points.
It returns 0 when MA of the histogram and EMA of the Price Spread are not align.
WHAT IS GannLSHVSA INDICATOR:
The GannLSHVSA plots a positive trend when a positive Volume smoothed Spread and EMA of Volume smoothed price is above 0, and a negative when negative Volume smoothed Spread and EMA of Volume smoothed price is below 0. When this conditions are not met it plots 0.
HOW TO USE THE STRATEGY:
Here you fine-tune the inputs until you find a combination that works well on all Timeframes you will use when creating your Automated Trade Algorithmic Strategy. I suggest 4h, 12h, 1D, 2D, 3D, 4D, 5D, 6D, W and M.
ORIGINALITY & USEFULNESS:
The GannLSHVSA Strategy is unique because it applies upgraded DFT, the Laplace Stieltjes Transform for data smoothing, effectively filtering out the minor fluctuations and leaving traders with a clear picture of the market's true movements. The DFT's ability to break down market signals into constituent frequencies offers a granular view of market dynamics, highlighting the amplitude and phase of each frequency component. This, combined with the strategic application of Ehler's Universal Oscillator principles via a histogram, furnishes traders with a nuanced understanding of market volatility and noise levels, thereby facilitating more informed trading decisions. The Gann swing strategy is developed by meomeo105, this Gann high and low algorithm forms the basis of the EMA modification.
DETAILED DESCRIPTION:
My detailed description of the indicator and use cases which I find very valuable.
What is the meaning of price spread?
In finance, a spread refers to the difference between two prices, rates, or yields. One of the most common types is the bid-ask spread, which refers to the gap between the bid (from buyers) and the ask (from sellers) prices of a security or asset.
We are going to use Open-Close spread.
What is Volume spread analysis?
Volume spread analysis (VSA) is a method of technical analysis that compares the volume per candle, range spread, and closing price to determine price direction.
What does this mean?
We need to have a positive Volume Price Spread and a positive Moving average of Volume price spread for a positive trend. OR via versa a negative Volume Price Spread and a negative Moving average of Volume price spread for a negative trend.
What if we have a positive Volume Price Spread and a negative Moving average of Volume Price Spread?
It results in a neutral, not trending price action.
Thus the Indicator/Strategy returns 0 and Closes all long and short positions.
I suggest using "Close all" input False when fine-tuning Inputs for 1 TimeFrame. When you export data to Excel/Numbers/GSheets I suggest using "Close all" input as True, except for the lowest TimeFrame. I suggest using 100% equity as your default quantity for fine-tune purposes. I have to mention that 100% equity may lead to unrealistic backtesting results. Be avare. When backtesting for trading purposes use Contracts or USDT.
Fine-tune Inputs: Gann + Laplace Smooth Volume Zone OscillatorUse this Strategy to Fine-tune inputs for the GannLSVZ0 Indicator.
Strategy allows you to fine-tune the indicator for 1 TimeFrame at a time; cross Timeframe Input fine-tuning is done manually after exporting the chart data.
I suggest using "Close all" input False when fine-tuning Inputs for 1 TimeFrame. When you export data to Excel/Numbers/GSheets I suggest using "Close all" input as True, except for the lowest TimeFrame.
MEANINGFUL DESCRIPTION:
The Volume Zone oscillator breaks up volume activity into positive and negative categories. It is positive when the current closing price is greater than the prior closing price and negative when it's lower than the prior closing price. The resulting curve plots through relative percentage levels that yield a series of buy and sell signals, depending on level and indicator direction.
The Gann Laplace Smoothed Volume Zone Oscillator GannLSVZO is a refined version of the Volume Zone Oscillator, enhanced by the implementation of the upgraded Discrete Fourier Transform, the Laplace Stieltjes Transform. Its primary function is to streamline price data and diminish market noise, thus offering a clearer and more precise reflection of price trends.
By combining the Laplace with Gann Swing Entries and with Ehler's white noise histogram, users gain a comprehensive perspective on volume-related market conditions.
HOW TO USE THE INDICATOR:
The default period is 2 but can be adjusted after backtesting. (I suggest 5 VZO length and NoiceR max length 8 as-well)
The VZO points to a positive trend when it is rising above the 0% level, and a negative trend when it is falling below the 0% level. 0% level can be adjusted in setting by adjusting VzoDifference. Oscillations rising below 0% level or falling above 0% level result in a natural trend.
HOW TO USE THE STRATEGY:
Here you fine-tune the inputs until you find a combination that works well on all Timeframes you will use when creating your Automated Trade Algorithmic Strategy. I suggest 4h, 12h, 1D, 2D, 3D, 4D, 5D, 6D, W and M.
When Indicator/Strategy returns 0 or natural trend, Strategy Closes All it's positions.
ORIGINALITY & USFULLNESS:
Personal combination of Gann swings and Laplace Stieltjes Transform of a price which results in less noise Volume Zone Oscillator.
The Laplace Stieltjes Transform is a mathematical technique that transforms discrete data from the time domain into its corresponding representation in the frequency domain. This process involves breaking down a signal into its individual frequency components, thereby exposing the amplitude and phase characteristics inherent in each frequency element.
This indicator utilizes the concept of Ehler's Universal Oscillator and displays a histogram, offering critical insights into the prevailing levels of market noise. The Ehler's Universal Oscillator is grounded in a statistical model that captures the erratic and unpredictable nature of market movements. Through the application of this principle, the histogram aids traders in pinpointing times when market volatility is either rising or subsiding.
The Gann swing strategy is developed by meomeo105, this Gann high and low algorithm forms the basis of the EMA modification.
DETAILED DESCRIPTION:
My detailed description of the indicator and use cases which I find very valuable.
What is oscillator?
Oscillators are chart indicators that can assist a trader in determining overbought or oversold conditions in ranging (non-trending) markets.
What is volume zone oscillator?
Price Zone Oscillator measures if the most recent closing price is above or below the preceding closing price.
Volume Zone Oscillator is Volume multiplied by the 1 or -1 depending on the difference of the preceding 2 close prices and smoothed with Exponential moving Average.
What does this mean?
If the VZO is above 0 and VZO is rising. We have a bullish trend. Most likely.
If the VZO is below 0 and VZO is falling. We have a bearish trend. Most likely.
Rising means that VZO on close is higher than the previous day.
Falling means that VZO on close is lower than the previous day.
What if VZO is falling above 0 line?
It means we have a high probability of a bearish trend.
Thus the indicator returns 0 and Strategy closes all it's positions when falling above 0 (or rising bellow 0) and we combine higher and lower timeframes to gauge the trend.
What is approximation and smoothing?
They are mathematical concepts for making a discrete set of numbers a
continuous curved line.
Laplace Stieltjes Transform approximation of a close price are taken from aprox library.
Key Features:
You can tailor the Indicator/Strategy to your preferences with adjustable parameters such as VZO length, noise reduction settings, and smoothing length.
Volume Zone Oscillator (VZO) shows market sentiment with the VZO, enhanced with Exponential Moving Average (EMA) smoothing for clearer trend identification.
Noise Reduction leverages Euler's White noise capabilities for effective noise reduction in the VZO, providing a cleaner and more accurate representation of market dynamics.
Choose between the traditional Fast Laplace Stieltjes Transform (FLT) and the innovative Double Discrete Fourier Transform (DTF32) soothed price series to suit your analytical needs.
Use dynamic calculation of Laplace coefficient or the static one. You may modify those inputs and Strategy entries with Gann swings.
I suggest using "Close all" input False when fine-tuning Inputs for 1 TimeFrame. When you export data to Excel/Numbers/GSheets I suggest using "Close all" input as True, except for the lowest TimeFrame. I suggest using 100% equity as your default quantity for fine-tune purposes. I have to mention that 100% equity may lead to unrealistic backtesting results. Be avare. When backtesting for trading purposes use Contracts or USDT.
Multi-Step Vegas SuperTrend - strategy [presentTrading]Long time no see! I am back : ) Please allow me to gain some warm-up.
█ Introduction and How it is Different
The "Vegas SuperTrend Strategy" is an enhanced trading strategy that leverages both the Vegas Channel and SuperTrend indicators to generate buy and sell signals.
What sets this strategy apart from others is its dynamic adjustment to market volatility and its multi-step take profit mechanism. Unlike traditional single-step profit-taking approaches, this strategy allows traders to systematically scale out of positions at predefined profit levels, thereby optimizing their risk-reward ratio and maximizing potential gains.
BTCUSD 6hr performance
█ Strategy, How it Works: Detailed Explanation
The Vegas SuperTrend Strategy combines the strengths of the Vegas Channel and SuperTrend indicators to identify market trends and generate trade signals. The following subsections delve into the details of how each component works and how they are integrated.
🔶 Vegas Channel Calculation
The Vegas Channel is based on a simple moving average (SMA) and the standard deviation (STD) of the closing prices over a specified period. The channel is defined by upper and lower bounds that are dynamically adjusted based on market volatility.
Simple Moving Average (SMA):
SMA_vegas = (1/N) * Σ(Close_i) for i = 0 to N-1
where N is the length of the Vegas Window.
Standard Deviation (STD):
STD_vegas = sqrt((1/N) * Σ(Close_i - SMA_vegas)^2) for i = 0 to N-1
Vegas Channel Upper and Lower Bounds:
VegasChannelUpper = SMA_vegas + STD_vegas
VegasChannelLower = SMA_vegas - STD_vegas
The details are here:
🔶 Trend Detection and Trade Signals
The strategy determines the current market trend based on the closing price relative to the SuperTrend bounds:
Market Trend:
MarketTrend = 1 if Close > SuperTrendPrevLower
-1 if Close < SuperTrendPrevUpper
Previous Trend otherwise
Trade signals are generated when there is a shift in the market trend:
Bullish Signal: When the market trend shifts from -1 to 1.
Bearish Signal: When the market trend shifts from 1 to -1.
🔶 Multi-Step Take Profit Mechanism
The strategy incorporates a multi-step take profit mechanism that allows for partial exits at predefined profit levels. This helps in locking in profits gradually and reducing exposure to market reversals.
Take Profit Levels:
The take profit levels are calculated as percentages of the entry price:
TakeProfitLevel_i = EntryPrice * (1 + TakeProfitPercent_i/100) for long positions
TakeProfitLevel_i = EntryPrice * (1 - TakeProfitPercent_i/100) for short positions
Multi-steps take profit local picture:
█ Trade Direction
The trade direction can be customized based on the user's preference:
Long: The strategy only takes long positions.
Short: The strategy only takes short positions.
Both: The strategy can take both long and short positions based on the market trend.
█ Usage
To use the Vegas SuperTrend Strategy, follow these steps:
Configure Input Settings:
- Set the ATR period, Vegas Window length, SuperTrend Multiplier, and Volatility Adjustment Factor.
- Choose the desired trade direction (Long, Short, Both).
- Enable or disable the take profit mechanism and set the take profit percentages and amounts for each step.
█ Default Settings
The default settings of the strategy are designed to provide a balanced approach to trading. Below is an explanation of each setting and its effect on the strategy's performance:
ATR Period (10): This setting determines the length of the ATR used in the SuperTrend calculation. A longer period smoothens the ATR, making the SuperTrend less sensitive to short-term volatility. A shorter period makes the SuperTrend more responsive to recent price movements.
Vegas Window Length (100): This setting defines the period for the Vegas Channel's moving average. A longer window provides a broader view of the market trend, while a shorter window makes the channel more responsive to recent price changes.
SuperTrend Multiplier (5): This base multiplier adjusts the sensitivity of the SuperTrend to the ATR. A higher multiplier makes the SuperTrend less sensitive, reducing the frequency of trade signals. A lower multiplier increases sensitivity, generating more signals.
Volatility Adjustment Factor (5): This factor dynamically adjusts the SuperTrend multiplier based on the width of the Vegas Channel. A higher factor increases the sensitivity of the SuperTrend to changes in market volatility, while a lower factor reduces it.
Take Profit Percentages (3.0%, 6.0%, 12.0%, 21.0%): These settings define the profit levels at which portions of the trade are exited. They help in locking in profits progressively as the trade moves in favor.
Take Profit Amounts (25%, 20%, 10%, 15%): These settings determine the percentage of the position to exit at each take profit level. They are distributed to ensure that significant portions of the trade are closed as the price reaches the set levels, reducing exposure to reversals.
Adjusting these settings can significantly impact the strategy's performance. For instance, increasing the ATR period or the SuperTrend multiplier can reduce the number of trades, potentially improving the win rate but also missing out on some profitable opportunities. Conversely, lowering these values can increase trade frequency, capturing more short-term movements but also increasing the risk of false signals.
VIX Futures Basis StrategyVIX Futures Basis Strategy
The VIX Futures Basis Strategy is a trading approach that takes advantage of the unique characteristics of the VIX index and its futures market. The VIX, often referred to as the "fear index," measures market expectations of near-term volatility. This strategy focuses on how the VIX futures contracts behave in relation to the spot VIX index and seeks to capitalize on the market's contango and backwardation phases.
Key Concepts:
VIX Index and VIX Futures:
The VIX index reflects the market's expectation of volatility over the next 30 days.
VIX futures allow traders to speculate on the future value of the VIX index.
Contango and Backwardation:
Contango occurs when the futures price is higher than the spot price, often indicating that the market expects volatility to rise in the future.
Backwardation is when the futures price is lower than the spot price, suggesting that the market expects a decrease in volatility.
Basis:
The basis is the difference between the futures price and the spot price. This strategy examines the basis for two consecutive VIX futures contracts.
Strategy Overview:
The VIX Futures Basis Strategy uses the relationship between the VIX index and its futures contracts to generate trading signals:
Long Position on Contango:
When both the front month and the second month VIX futures contracts are in contango (their prices are above the spot VIX index by a specified threshold), the strategy takes a long position.
This implies an expectation that the market will move from a state of expected higher future volatility to a more stable state, allowing profits to be made as the futures prices converge toward the spot price.
Closing Position on Backwardation:
If the basis for both futures contracts indicates backwardation (their prices are below the spot VIX index by a threshold), the strategy closes any long positions.
This condition suggests that the market anticipates decreasing volatility, and closing positions helps to avoid potential losses.
Gann Swing Strategy [1 Bar - Multi Layer]Use this Strategy to Fine-tune inputs for your Gann swing strategy.
Strategy allows you to fine-tune the indicator for 1 TimeFrame at a time; cross Timeframe Input fine-tuning is done manually after exporting the chart data.
MEANINGFUL DESCRIPTION:
The Gann Swing Chart using the One-Bar type, also known as the Minor Trend Chart, is designed to follow single-bar movements in the market. It helps identify trends by tracking price movements. When the market makes a higher high than the previous bar from a low price, the One-Bar trend line moves up, indicating a new high and establishing the previous low as a One-Bar bottom. Conversely, when the market makes a lower low than the previous bar from a high price, the One-Bar swing line moves down, marking a new low and setting the previous high as a One-Bar top. The crossing of these swing tops and bottoms indicates a change in trend direction.
HOW TO USE THE INDICATOR / Gann-swing Strategy:
The indicator shows 1, 2, and 3-bar swings. The strategy triggers a buy when the price crosses the previously determined high.
HOW TO USE THE STRATEGY:
Strategy to Fine-Tune Inputs for Your Gann Swing Strategy
This strategy allows for the fine-tuning of indicators for one timeframe at a time. Cross-timeframe input fine-tuning is done manually after exporting the chart data.
Meaningful Description:
The Gann Swing Chart using the One-Bar type, also known as the Minor Trend Chart, is designed to follow single-bar movements in the market. It helps identify trends by tracking price movements. When the market makes a higher high than the previous bar from a low price, the One-Bar trend line moves up, indicating a new high and establishing the previous low as a One-Bar bottom. Conversely, when the market makes a lower low than the previous bar from a high price, the One-Bar swing line moves down, marking a new low and setting the previous high as a One-Bar top. The crossing of these swing tops and bottoms indicates a change in trend direction.
How to Use the Indicator / Gann-Swing Strategy:
The indicator shows 1, 2, and 3-bar swings. The strategy triggers a buy when the price crosses the previously determined high.
How to Use the Strategy:
The strategy initiates a buy if the price breaks 1, 2, or 3-bar highs, or any combination thereof. Use the inputs to determine which highs or lows need to be crossed for the strategy to go long or short.
ORIGINALITY & USEFULNESS:
The One-Bar Swing Chart stands out for its simplicity and effectiveness in capturing minor market trends. Developed by meomeo105, this Gann high and low algorithm forms the basis of the strategy. I used my approach to creating strategy out of Gann swing indicator.
DETAILED DESCRIPTION:
What is a Swing Chart?
Swing charts help traders visualize price movements and identify trends by focusing on price highs and lows. They are instrumental in spotting trend reversals and continuations.
What is the One-Bar Swing Chart?
The One-Bar Swing Chart, also known as the Minor Trend Chart, follows single-bar price movements. It plots upward swings from a low price when a higher high is made, and downward swings from a high price when a lower low is made.
Key Features:
Trend Identification : Highlights minor trends by plotting swing highs and lows based on one-bar movements.
Simple Interpretation : Crossing a swing top indicates an uptrend, while crossing a swing bottom signals a downtrend.
Customizable Periods : Users can adjust the period to fine-tune the sensitivity of the swing chart to market movements.
Practical Application:
Bullish Trend : When the One-Bar Swing line moves above a previous swing top, it indicates a bullish trend.
Bearish Trend : When the One-Bar Swing line moves below a previous swing bottom, it signals a bearish trend.
Trend Reversal : Watch for crossings of swing tops and bottoms to detect potential trend reversals.
The One-Bar Swing Chart is a powerful tool for traders looking to capture and understand market trends. By following the simple rules of swing highs and lows, it provides clear and actionable insights into market direction.
Why the Strategy Uses 100% Allocation of a Portfolio:
This strategy allocates 100% of the portfolio to trading this specific pair, which does not mean 100% of all capital but 100% of the allocated trading capital for this pair. The strategy is swing-based and does not use take profit (TP) or stop losses.
WODIsMA Strategy 3 MA Crossover & Bull-Bear Trend ConfirmationWODIsMA Strategy is a versatile trading strategy designed to leverage the strength of moving averages and volatility indicators to provide clear trading signals for both long and short positions. This strategy is suitable for traders looking for a systematic approach to trading with adjustable parameters to fit various market conditions and personal trading styles.
Key Features
Customizable Moving Averages:
The strategy allows users to select different types of moving averages (SMA, EMA, SMMA, WMA, VWMA) for short-term, mid-term, long-term, and bull-bear trend identification.
Each moving average can be customized with different lengths, sources (e.g., close, high, low), timeframes, and colors.
Position Management:
Users can specify the percentage of capital to use per trade and the percentage to close per partial exit.
The strategy supports both long and short positions with the ability to enable or disable each direction.
Volatility Filter:
Incorporates a volatility filter to ensure trades are only taken when market volatility is above a user-defined threshold, enhancing the strategy's effectiveness in dynamic market conditions.
Bull-Bear Trend Line:
Option to enable a bull-bear trend line that helps identify the overall market trend. Trades are taken based on the relationship between the long-term moving average and the bull-bear trend line.
Partial Exits and Full Close Logic:
The strategy includes logic for partial exits based on the crossing of mid-term and long-term moving averages.
Ensures that positions are fully closed when adverse conditions are detected, such as the price crossing below the bull-bear trend line.
Stop Loss Management:
Implements user-defined stop loss levels to manage risk effectively. The stop loss is dynamically adjusted based on the entry price and user input.
Detailed Description
Moving Average Calculation: The strategy calculates up to six different moving averages, each with customizable parameters. These moving averages help identify the short-term, mid-term, long-term trends, and overall market direction.
Trading Signals:
Long Signal: A long position is opened when the short-term moving average is above the long-term moving average, and the mid-term moving average crosses above the long-term moving average.
Short Signal: A short position is opened when the short-term moving average is below the long-term moving average, and the mid-term moving average crosses below the long-term moving average.
Volatility Condition: The strategy includes a volatility filter that activates trades only when volatility exceeds a specified threshold, ensuring trades are made in favorable market conditions.
Bull-Bear Trend Confirmation: When enabled, trades are filtered based on the relationship between the long-term moving average and the bull-bear trend line, adding another layer of confirmation.
Stop Loss and Exits:
The strategy manages risk by placing stop loss orders based on user-defined percentages.
Positions are partially or fully closed based on the crossing of moving averages and the relationship with the bull-bear trend line.
Originality and Usefulness
This strategy is original as it combines multiple moving averages and volatility indicators in a structured manner to provide reliable trading signals. Its versatility allows traders to adjust the parameters to match their trading preferences and market conditions. The inclusion of a volatility filter and bull-bear trend line adds significant value by reducing false signals and ensuring trades are taken in the direction of the overall market trend. The detailed descriptions and customizable settings make this strategy accessible and understandable for traders, even those unfamiliar with the underlying Pine Script code.
By providing clear entry, exit, and risk management rules, the WODIsMA Strategy enhances the trader's ability to navigate different market environments, making it a valuable addition to the TradingView community scripts.
Multi-Regression StrategyIntroducing the "Multi-Regression Strategy" (MRS) , an advanced technical analysis tool designed to provide flexible and robust market analysis across various financial instruments.
This strategy offers users the ability to select from multiple regression techniques and risk management measures, allowing for customized analysis tailored to specific market conditions and trading styles.
Core Components:
Regression Techniques:
Users can choose one of three regression methods:
1 - Linear Regression: Provides a straightforward trend line, suitable for steady markets.
2 - Ridge Regression: Offers a more stable trend estimation in volatile markets by introducing a regularization parameter (lambda).
3 - LOESS (Locally Estimated Scatterplot Smoothing): Adapts to non-linear trends, useful for complex market behaviors.
Each regression method calculates a trend line that serves as the basis for trading decisions.
Risk Management Measures:
The strategy includes nine different volatility and trend strength measures. Users select one to define the trading bands:
1 - ATR (Average True Range)
2 - Standard Deviation
3 - Bollinger Bands Width
4 - Keltner Channel Width
5 - Chaikin Volatility
6 - Historical Volatility
7 - Ulcer Index
8 - ATRP (ATR Percentage)
9 - KAMA Efficiency Ratio
The chosen measure determines the width of the bands around the regression line, adapting to market volatility.
How It Works:
Regression Calculation:
The selected regression method (Linear, Ridge, or LOESS) calculates the main trend line.
For Ridge Regression, users can adjust the lambda parameter for regularization.
LOESS allows customization of the point span, adaptiveness, and exponent for local weighting.
Risk Band Calculation:
The chosen risk measure is calculated and normalized.
A user-defined risk multiplier is applied to adjust the sensitivity.
Upper and lower bounds are created around the regression line based on this risk measure.
Trading Signals:
Long entries are triggered when the price crosses above the regression line.
Short entries occur when the price crosses below the regression line.
Optional stop-loss and take-profit mechanisms use the calculated risk bands.
Customization and Flexibility:
Users can switch between regression methods to adapt to different market trends (linear, regularized, or non-linear).
The choice of risk measure allows adaptation to various market volatility conditions.
Adjustable parameters (e.g., regression length, risk multiplier) enable fine-tuning of the strategy.
Unique Aspects:
Comprehensive Regression Options:
Unlike many indicators that rely on a single regression method, MRS offers three distinct techniques, each suitable for different market conditions.
Diverse Risk Measures: The strategy incorporates a wide range of volatility and trend strength measures, going beyond traditional indicators to provide a more nuanced view of market dynamics.
Unified Framework:
By combining advanced regression techniques with various risk measures, MRS offers a cohesive approach to trend identification and risk management.
Adaptability:
The strategy can be easily adjusted to suit different trading styles, timeframes, and market conditions through its various input options.
How to Use:
Select a regression method based on your analysis of the current market trend (linear, need for regularization, or non-linear).
Choose a risk measure that aligns with your trading style and the market's current volatility characteristics.
Adjust the length parameter to match your preferred timeframe for analysis.
Fine-tune the risk multiplier to set the desired sensitivity of the trading bands.
Optionally enable stop-loss and take-profit mechanisms using the calculated risk bands.
Monitor the regression line for potential trend changes and the risk bands for entry/exit signals.
By offering this level of customization within a unified framework, the Multi-Regression Strategy provides traders with a powerful tool for market analysis and trading decision support. It combines the robustness of regression analysis with the adaptability of various risk measures, allowing for a more comprehensive and flexible approach to technical trading.
TASC 2024.08 Volume Confirmation For A Trend System█ OVERVIEW
This script demonstrates the use of volume data to validate price movements based on the techniques Buff Pelz Dormeier discusses in his "Volume Confirmation For A Trend System" article from the August 2024 edition of TASC's Traders' Tips . It presents a trend-following system implementation that utilizes a combination of three indicators: the Average Directional Index (ADX), the Trend Thrust Indicator (TTI), and the Volume Price Confirmation Indicator (VPCI).
█ CONCEPTS
In his article, Buff Pelz Dormeier recounts his search for an optimal trend-following strategy enhanced with volume data, starting with a simple system combining the ADX , MACD , and OBV indicators. Even in these early tests, the author observed that the volume confirmation from OBV notably improved trading performance. Subsequently, the author replaced OBV with his VPCI, which considers the proportional weights of volume and price, to enhance the validation of trend momentum. Lastly, the author explored the inclusion of his TTI, a modified MACD that features volume-based enhancements, as a strategy component for improved trend-following performance.
According to the author's research, the ADX+TTI+VPCI system outperformed similar strategies he tested in the article, yielding significantly higher returns and enhanced perceived reliability. Because the system's design revolves around catching pronounced trends, it performs best with a portfolio of individual stocks. The author applies the system in the article by allocating 5% of the equity to long positions in S&P 500 components that meet the ADX+TTI+VPCI entry criteria (see the Calculations section below for details). He uses the proceeds from closing positions to enter new positions in other stocks meeting the screening criteria, holding any excess proceeds in cash.
█ CALCULATIONS
The TTI is similar to the MACD. Its calculation entails the following steps:
Calculate fast (short-term) and slow (long-term) volume-weighted moving averages (VWMAs).
Compute the volume multiple (VM) as the square of the ratio of the fast VWMA to the slow VWMA.
Adjust these averages by multiplying the fast VWMA by the VM and dividing the slow VWMA by the VM.
Calculate the difference between the adjusted VWMAs to determine the TTI value, and take the average of that series to determine the signal line value.
The VPCI utilizes differences and ratios between VWMAs and corresponding simple moving averages (SMAs) to provide an alternative volume-price confirmation tool. Its calculation is as follows:
Subtract the slow SMA from the VWMA of the same length to calculate the volume-price confirmation/contradiction (VPC) value.
Divide the fast VWMA by the corresponding fast SMA to determine the volume-price ratio (VPR).
Divide the short-term VWMA by the long-term VWMA to calculate the VM.
Compute the VPCI as the product of the VPC, VPR, and VM values.
The long entry criteria of the ADX+TTI+VPCI system are as follows:
The ADX is above 30.
The TTI crosses above its signal line.
The VPCI is above 0, confirming the trend.
Signals to close positions occur when the VPCI is below 0, indicating a contradiction .
NOTE: Unlike in the article, this script applies the ADX+TTI+VPCI system to one stock at a time , not a portfolio of S&P 500 constituents.
█ DISCLAIMER
This strategy script educates users on the trading system outlined by the TASC article. By default, it uses 10% of equity as the order size and a slippage amount of 5 ticks. Traders should adjust these settings and the commission amount when using this script.
FVG Positioning Average with 200EMA Auto Trading [Pakun]Description
Strategy Name and Purpose
FVG Positioning Average with 200EMA Auto Trading
This strategy uses Fair Value Gaps (FVG) combined with a 200-period Exponential Moving Average (EMA) and Average True Range (ATR) to generate trend-based trading signals. It is designed to help traders identify high-probability entry points by leveraging the gaps between fair value prices and current market prices.
Originality and Usefulness
This script combines multiple indicators to create a cohesive trading strategy that is greater than the sum of its parts. While FVG is a powerful tool on its own, combining it with the EMA and ATR adds layers of confirmation and risk management, enhancing its effectiveness. Here’s how the components work together:
Fair Value Gap (FVG): Identifies gaps in the market where price action has not fully filled, indicating potential reversal or continuation points.
200-period Exponential Moving Average (EMA): Acts as a trend filter to ensure trades are taken in the direction of the overall trend, improving the probability of success.
Average True Range (ATR): Used to filter out insignificant gaps and set dynamic stop-loss levels based on market volatility, enhancing risk management.
Entry Conditions
Long Entry
The close price crosses above the downtrend FVG.
The close price, FVG up average, and down average are all above the 200 EMA, indicating a strong bullish trend.
Short Entry
The close price crosses below the uptrend FVG.
The close price, FVG up average, and down average are all below the 200 EMA, indicating a strong bearish trend.
Exit Conditions
For long positions, the stop loss is set at the recent low, and the take profit is set at a point with a risk-reward ratio of 1:1.5.
For short positions, the stop loss is set at the recent high, and the take profit is set at a point with a risk-reward ratio of 1:1.5.
Risk Management
Account Size: 1,000,000 yen
Commission and Slippage: 2 pips commission and 1 pip slippage per trade
Risk per Trade: 10% of account equity
The stop loss is based on the recent low or recent high, ensuring trades are exited when the market moves against the position.
Settings Options
FVG Lookback: Set the lookback period for calculating FVGs.
Lookback Type: Choose the type of lookback (Bar Count or FVG Count).
ATR Multiplier: Set the multiplier for ATR to filter significant gaps.
EMA Period: Set the period for the EMA to adjust the trend filter sensitivity.
Show FVGs on Chart: Choose whether to display FVGs on the chart for visual confirmation.
Bullish/Bearish Color: Set the color for bullish and bearish FVGs to distinguish them easily.
Show Gradient Areas: Choose whether to display gradient areas to highlight the zones of interest.
Sufficient Sample Size
The strategy has been backtested with 113 trades, providing a sufficient sample size to evaluate its performance.
Notes
This strategy is based on historical data and does not guarantee future results.
Thoroughly backtest and validate results before using in live trading.
Market volatility and other external factors can affect performance and may not yield expected results.
Acknowledgment
This strategy uses the FVG Positioning Average Strategy indicator. Thanks to for their contribution.
Clean Chart Explanation
The script is published with a clean chart to ensure that its output is readily identifiable and easy to understand. No other scripts are included on the chart, and any drawings or images used are specifically to illustrate how the script works.
Power Hour Money StrategyDescription of the Pine Script Code: "Power Hour Money Strategy"
This Pine Script strategy, "Power Hour Money Strategy," is designed to trade based on the alignment of multiple time frames (month, week, day, and hour). The strategy aims to enter long or short positions depending on whether all selected time frames are in sync (all green for long positions, all red for short positions). Additionally, the script includes configurations for trading during specific sessions and automatically closing positions at the end of the trading day.
Core Features:
1. Time Frame Sync Check:
- The strategy evaluates whether the current price is higher than the opening price for the month, week, day, and hour to determine if each time frame is "green" (bullish) or "red" (bearish).
2. Session Control:
- The user can select between different trading sessions:
- "NY Session 9:30-11:30"
- "Extended NY Session 8-4"
- "All Sessions"
- Trades are only executed if the current time falls within the selected session.
3. Trailing Stop Mechanism:
- The strategy includes an optional trailing stop mechanism for both long and short positions.
- The trailing stop is configured with a percentage loss from the current price to protect gains.
4. End-of-Day Position Management:
- An option is provided to automatically close all positions at the end of the trading day (5:45 PM Eastern Time).
Detailed Code Breakdown:
1. Input Settings:
- **Session Selection**: Allows the user to choose the trading session.
- **End-of-Day Close**: Option to automatically close positions at the end of the day.
- **Trailing Stop Loss**: Enables or disables the trailing stop loss feature and sets the percentage for long and short positions.
2. Time Frame Calculations:
- The script uses `request.security` to get the opening prices for higher time frames (monthly, weekly, daily, and hourly).
- It compares the current close price to these opening prices to determine if each time frame is green or red.
3. Session Time Definitions:
- Defines the start and end times for the NY session (9:30-11:30 AM) and the extended session (8:00 AM - 4:00 PM).
4. Trade Execution:
- The strategy checks if all selected time frames are in sync and if the current time falls within the trading session.
- If all conditions are met, it enters a long or short position.
5. Trailing Stop Loss Implementation:
- Adjusts the stop price based on the trailing percentage and the current position's size.
- Automatically exits positions if the trailing stop condition is met.
6. End-of-Day Close Implementation:
- Uses a timestamp to check if the current time is 5:45 PM Eastern Time.
- Closes all positions if the end-of-day condition is met.
7. Plotting and Logging:
- Plots indicators to visualize the green/red status of each time frame.
- Logs information about the status of each time frame for debugging and analysis.
Example Usage:
Entering a Long Position: If the month, week, day, and hour are all green and the current time is within the selected session, a long position is entered.
Entering a Short Position: If the month, week, day, and hour are all red and the current time is within the selected session, a short position is entered.
Trailing Stop: Protects gains by exiting the position if the price moves against the set trailing stop percentage.
End-of-Day Close: Automatically closes all open positions at 5:45 PM Eastern Time if enabled.
This strategy is particularly useful for traders who want to ensure that multiple time frames are in alignment before entering a trade and who wish to manage positions effectively throughout the trading day with specific session controls and trailing stops.