XAUUSD 10-Minute StrategyThis XAUUSD 10-Minute Strategy is designed for trading Gold vs. USD on a 10-minute timeframe. By combining multiple technical indicators (MACD, RSI, Bollinger Bands, and ATR), the strategy effectively captures both trend-following and reversal opportunities, with adaptive risk management for varying market volatility. This approach balances high-probability entries with robust volatility management, making it suitable for traders seeking to optimise entries during significant price movements and reversals.
Key Components and Logic:
MACD (12, 26, 9):
Generates buy signals on MACD Line crossovers above the Signal Line and sell signals on crossovers below the Signal Line, helping to capture momentum shifts.
RSI (14):
Utilizes oversold (below 35) and overbought (above 65) levels as a secondary filter to validate entries and avoid overextended price zones.
Bollinger Bands (20, 2):
Uses upper and lower Bollinger Bands to identify potential overbought and oversold conditions, aiming to enter long trades near the lower band and short trades near the upper band.
ATR-Based Stop Loss and Take Profit:
Stop Loss and Take Profit levels are dynamically set as multiples of ATR (3x for stop loss, 5x for take profit), ensuring flexibility with market volatility to optimise exit points.
Entry & Exit Conditions:
Buy Entry: T riggered when any of the following conditions are met:
MACD Line crosses above the Signal Line
RSI is oversold
Price drops below the lower Bollinger Band
Sell Entry: Triggered when any of the following conditions are met:
MACD Line crosses below the Signal Line
RSI is overbought
Price moves above the upper Bollinger Band
Exit Strategy: Trades are closed based on opposing entry signals, with adaptive spread adjustments for realistic exit points.
Backtesting Configuration & Results:
Backtesting Period: July 21, 2024, to October 30, 2024
Symbol Info: XAUUSD, 10-minute timeframe, OANDA data source
Backtesting Capital: Initial capital of $700, with each trade set to 10 contracts (equivalent to approximately 0.1 lots based on the broker’s contract size for gold).
Users should confirm their broker's contract size for gold, as this may differ. This script uses 10 contracts for backtesting purposes, aligned with 0.1 lots on brokers offering a 100-contract specification.
Key Backtesting Performance Metrics:
Net Profit: $4,733.90 USD (676.27% increase)
Total Closed Trades: 526
Win Rate: 53.99%
Profit Factor: 1.44 (1.96 for Long trades, 1.14 for Short trades)
Max Drawdown: $819.75 USD (56.33% of equity)
Sharpe Ratio: 1.726
Average Trade: $9.00 USD (0.04% of equity per trade)
This backtest reflects realistic conditions, with a spread adjustment of 38 points and no slippage or commission applied. The settings aim to simulate typical retail trading conditions. However, please adjust the initial capital, contract size, and other settings based on your account specifics for best results.
Usage:
This strategy is tuned specifically for XAUUSD on a 10-minute timeframe, ideal for both trend-following and reversal trades. The ATR-based stop loss and take profit levels adapt dynamically to market volatility, optimising entries and exits in varied conditions. To backtest this script accurately, ensure your broker’s contract specifications for gold align with the parameters used in this strategy.
Oscillators
Z-Score RSI StrategyOverview
The Z-Score RSI Indicator is an experimental take on momentum analysis. By applying the Relative Strength Index (RSI) to a Z-score of price data, it measures how far prices deviate from their mean, scaled by standard deviation. This isn’t your traditional use of RSI, which is typically based on price data alone. Nevertheless, this unconventional approach can yield unique insights into market trends and potential reversals.
Theory and Interpretation
The RSI calculates the balance between average gains and losses over a set period, outputting values from 0 to 100. Typically, people look at the overbought or oversold levels to identify momentum extremes that might be likely to lead to a reversal. However, I’ve often found that RSI can be effective for trend-following when observing the crossover of its moving average with the midline or the crossover of the RSI with its own moving average. These crossovers can provide useful trend signals in various market conditions.
By combining RSI with a Z-score of price, this indicator estimates the relative strength of the price’s distance from its mean. Positive Z-score trends may signal a potential for higher-than-average prices in the near future (scaled by the standard deviation), while negative trends suggest the opposite. Essentially, when the Z-Score RSI indicates a trend, it reflects that the Z-score (the distance between the average and current price) is likely to continue moving in the trend’s direction. Generally, this signals a potential price movement, though it’s important to note that this could also occur if there’s a shift in the mean or standard deviation, rather than a meaningful change in price itself.
While the Z-Score RSI could be an insightful addition to a comprehensive trading system, it should be interpreted carefully. Mean shifts may validate the indicator’s predictions without necessarily indicating any notable price change, meaning it’s best used in tandem with other indicators or strategies.
Recommendations
Before putting this indicator to use, conduct thorough backtesting and avoid overfitting. The added parameters allow fine-tuning to fit various assets, but be careful not to optimize purely for the highest historical returns. Doing so may create an overly tailored strategy that performs well in backtests but fails in live markets. Keep it balanced and look for robust performance across multiple scenarios, as overfitting is likely to lead to disappointing real-world results.
DSL Strategy [DailyPanda]
Overview
The DSL Strategy by DailyPanda is a trading strategy that synergistically combines the idea from indicators to create a more robust and reliable trading tool. By integrating these indicators, the strategy enhances signal accuracy and provides traders with a comprehensive view of market trends and momentum shifts. This combination allows for better entry and exit points, improved risk management, and adaptability to various market conditions.
Combining ideas from indicators adds value by:
Enhancing Signal Confirmation : The strategy requires alignment between trend and momentum before generating trade signals, reducing false entries.
Improving Accuracy : By integrating price action with momentum analysis, the strategy captures more reliable trading opportunities.
Providing Comprehensive Market Insight : The combination offers a better perspective on the market, considering both the direction (trend) and the strength (momentum) of price movements.
How the Components Work Together
1. Trend Identification with DSL Indicator
Dynamic Signal Lines : Calculates upper and lower DSL lines based on a moving average (SMA) and dynamic thresholds derived from recent highs and lows with a specified offset. These lines adapt to market conditions, providing real-time trend insights.
ATR-Based Bands : Adds bands around the DSL lines using the Average True Range (ATR) multiplied by a width factor. These bands account for market volatility and help identify potential stop-loss levels.
Trend Confirmation : The relationship between the price, DSL lines, and bands determines the current trend. For example, if the price consistently stays above the upper DSL line, it indicates a bullish trend.
2. Momentum Analysis
RSI Calculation : Computes the RSI over a specified period to measure the speed and change of price movements.
Zero-Lag EMA (ZLEMA) : Applies a ZLEMA to the RSI to minimize lag and produce a more responsive oscillator.
DSL Application on Oscillator : Implements the DSL concept on the oscillator by calculating dynamic upper and lower levels. This helps identify overbought or oversold conditions more accurately.
Signal Generation : Detects crossovers between the oscillator and its DSL lines. A crossover above the lower DSL line signals potential bullish momentum, while a crossover below the upper DSL line signals potential bearish momentum.
3. Integrated Signal Filtering
Confluence Requirement : A trade signal is generated only when both the DSL indicator and oscillator agree. For instance, a long entry requires both an uptrend confirmation from the DSL indicator and a bullish momentum signal from the oscillator.
Risk Management Integration : The strategy uses the DSL indicator's bands for setting stop-loss levels and calculates take-profit levels based on a user-defined risk-reward ratio. This ensures that every trade has a predefined risk management plan.
--------------------------------------------------------------------------------------------
Originality and Value Added to the Community
Unique Synergy : While both indicators are available individually, this strategy is original in how it combines them to enhance their strengths and mitigate their weaknesses, offering a novel approach not present in existing scripts.
Enhanced Reliability : By requiring confirmation from both trend and momentum indicators, the strategy reduces false signals and increases the likelihood of successful trades.
Versatility : The customizable parameters allow traders to adapt the strategy to different instruments, timeframes, and trading styles, making it a valuable tool for a wide range of trading scenarios.
Educational Contribution : The script demonstrates an effective method of combining indicators for improved trading performance, providing insights that other traders can learn from and apply to their own strategies.
--------------------------------------------------------------------------------------------
How to Use the Strategy
Adding the Strategy to Your Chart
Apply the DSL Strategy to your desired trading instrument and timeframe on TradingView.
--------------------------------------------------------------------------------------------
Configuring Parameters
DSL Indicator Settings :
Length (len) : Adjusts the sensitivity of the DSL lines (default is 34).
Offset : Determines the look-back period for threshold calculations (default is 30).
Bands Width (width) : Changes the distance of the ATR-based bands from the DSL lines (default is 1).
DSL-BELUGA Oscillator Settings :
Beluga Length (len_beluga) : Sets the period for the RSI calculation in the oscillator (default is 10).
DSL Lines Mode (dsl_mode) : Chooses between "Fast" (more responsive) and "Slow" (smoother) modes for the oscillator's DSL lines.
Risk Management :
Risk Reward (risk_reward) : Defines your desired risk-reward ratio for calculating take-profit levels (default is 1.5).
--------------------------------------------------------------------------------------------
Interpreting Signals
Long Entry Conditions :
Trend Confirmation : Price is above the upper DSL line and the upper DSL band (dsl_up1 > dsl_dn).
Price Behavior : The last three candles have both their opens and closes above the upper DSL line.
Momentum Signal : The DSL-BELUGA oscillator crosses above its lower DSL line (up_signal), indicating bullish momentum.
Short Entry Conditions :
Trend Confirmation : Price is below the lower DSL line and the lower DSL band (dsl_dn < dsl_up1).
Price Behavior : The last three candles have both their opens and closes below the lower DSL band.
Momentum Signal : The DSL-BELUGA oscillator crosses below its upper DSL line (dn_signal), indicating bearish momentum.
Exit Conditions :
Stop-Loss : Automatically set at the DSL indicator's band level (upper band for longs, lower band for shorts).
Take-Profit : Calculated based on the risk-reward ratio and the initial risk determined by the stop-loss distance.
Visual Aids
Signal Arrows : Upward green arrows for long entries and downward blue arrows for short entries appear on the chart when conditions are met.
Stop-Loss and Take-Profit Lines : Red and green lines display the calculated stop-loss and take-profit levels for active trades.
Background Highlighting : The chart background subtly changes color to indicate when a signal has been generated.
Backtesting and Optimization
Use TradingView's strategy tester to backtest the strategy over historical data.
Adjust parameters to optimize performance for different instruments or market conditions.
Regularly review backtesting results to ensure the strategy remains effective.
Supertrend StrategyThe Supertrend Strategy was created based on the Supertrend and Relative Strength Index (RSI) indicators, widely respected tools in technical analysis. This strategy combines these two indicators to capture market trends with precision and reliability, looking for optimizing exit levels at oversold or overbought price levels.
The Supertrend indicator identifies trend direction based on price and volatility by using the Average True Range (ATR). The ATR measures market volatility by calculating the average range between an asset’s high and low prices over a set period. It provides insight into price fluctuations, with higher ATR values indicating increased volatility and lower values suggesting stability. The Supertrend Indicator plots a line above or below the price, signaling potential buy or sell opportunities: when the price closes above the Supertrend line, an uptrend is indicated, while a close below the line suggests a downtrend. This line shifts as price movements and volatility levels change, acting as both a trailing stop loss and trend confirmation.
To enhance the Supertrend strategy, the Relative Strength Index (RSI) has been added as an exit criterion. As a momentum oscillator, the RSI indicates overbought (usually above 70) or oversold (usually below 30) conditions. This integration allows trades to close when the asset is overbought or oversold, capturing gains before a possible reversal, even if the percentage take profit level has not been reached. This mechanism aims to prevent losses due to market reversals before the Supertrend signal changes.
### Key Features
1. **Entry criteria**:
- The strategy uses the Supertrend indicator calculated by adding or subtracting a multiple of the ATR from the closing price, depending on the trend direction.
- When the price crosses above the Supertrend line, the strategy signals a long (buy) entry. Conversely, when the price crosses below, it signals a short (sell) entry.
- The strategy performs a reversal if there is an open position and a change in the direction of the supertrend occurs
2. **Exit criteria**:
- Take profit of 30% (default) on the average position price.
- Oversold (≤ 5) or overbought (≥ 95) RSI
- Reversal when there is a change in direction of the Supertrend
3. **No Repainting**:
- This strategy is not subject to repainting, as long as the timeframe configured on your chart is the same as the supertrend timeframe .
4. **Position Sizing by Equity and risk management**:
- This strategy has a default configuration to operate with 35% of the equity. At the time of opening the position, the supertrend line is typically positioned at about 12 to 16% of the entry price. This way, the strategy is putting at risk about 16% of 35% of equity, that is, around 5.6% of equity for each trade. The percentage of equity can be adjusted by the user according to their risk management.
5. **Backtest results**:
- This strategy was subjected to deep backtesting and operations in replay mode, including transaction fees of 0.12%, and slippage of 5 ticks.
- The past results in deep backtest and replay mode were compatible and profitable (Variable results depending on the take profit used, supertrend and RSI parameters). However, it should be noted that few operations were evaluated, since the currency in question has been created for a short time and the frequency of operations is relatively small.
- Past results are no guarantee of future results. The strategy's backtest results may even be due to overfitting with past data.
Default Settings
Chart timeframe: 2h
Supertrend Factor: 3.42
ATR period: 14
Supertrend timeframe: 2 h
RSI timeframe: 15 min
RSI Lenght: 5 min
RSI Upper limit: 95
RSI Lower Limit: 5
Take Profit: 30%
BYBIT:1000000MOGUSDT.P
Stochastic RSI OHLC StrategyThe script titled "Stochastic RSI High Low Close Bars" is a versatile trading strategy implemented in Pine Script, designed for TradingView. Here's an overview of its features:
Description
This strategy leverages the Stochastic RSI to determine entry and exit signals in the market, focusing on high, low, and close values of the indicator. It incorporates various trading styles, stop-loss mechanisms, and multi-timeframe analysis to adapt to different market conditions.
Key Features
Stochastic RSI Analysis:
Uses the Stochastic RSI to identify potential entry points for long and short positions.
Tracks high, low, and close values for more granular analysis.
Multiple Trading Styles:
Supports diverse trading styles like Volume Color Swing, RSI Divergence, RSI Pullback, and more.
Allows switching between these styles to suit market dynamics.
Session-Based Trading:
Offers session control, limiting trades to specific hours (e.g., NY sessions).
Can close all positions at the end of the trading day.
Stop-Loss and Take-Profit Mechanisms:
Includes both static and dynamic stop-losses, with options for time-based stops, trailing stops, and momentum-based exits.
Customizable take-profit levels ensure efficient trade management.
Volume Analysis:
Integrates volume indicators to add a bias for trade entries and exits, enhancing signal reliability.
Multi-Timeframe Integration:
Employs multi-timeframe RSI analysis, allowing the strategy to capture broader trends and optimize entries.
This script is designed to provide flexibility and adaptability, making it useful for different trading strategies and market conditions. It is suitable for traders looking to refine their entries and exits with a focus on the Stochastic RSI.
Chande Momentum Oscillator StrategyThe Chande Momentum Oscillator (CMO) Trading Strategy is based on the momentum oscillator developed by Tushar Chande in 1994. The CMO measures the momentum of a security by calculating the difference between the sum of recent gains and losses over a defined period. The indicator offers a means to identify overbought and oversold conditions, making it suitable for developing mean-reversion trading strategies (Chande, 1997).
Strategy Overview:
Calculation of the Chande Momentum Oscillator (CMO):
The CMO formula considers both positive and negative price changes over a defined period (commonly set to 9 days) and computes the net momentum as a percentage.
The formula is as follows:
CMO=100×(Sum of Gains−Sum of Losses)(Sum of Gains+Sum of Losses)
CMO=100×(Sum of Gains+Sum of Losses)(Sum of Gains−Sum of Losses)
This approach distinguishes the CMO from other oscillators like the RSI by using both price gains and losses in the numerator, providing a more symmetrical measurement of momentum (Chande, 1997).
Entry Condition:
The strategy opens a long position when the CMO value falls below -50, signaling an oversold condition where the price may revert to the mean. Research in mean-reversion, such as by Poterba and Summers (1988), supports this approach, highlighting that prices often revert after sharp movements due to overreaction in the markets.
Exit Conditions:
The strategy closes the long position when:
The CMO rises above 50, indicating that the price may have become overbought and may not provide further upside potential.
Alternatively, the position is closed 5 days after the buy signal is triggered, regardless of the CMO value, to ensure a timely exit even if the momentum signal does not reach the predefined level.
This exit strategy aligns with the concept of time-based exits, reducing the risk of prolonged exposure to adverse price movements (Fama, 1970).
Scientific Basis and Rationale:
Momentum and Mean-Reversion:
The strategy leverages the well-known phenomenon of mean-reversion in financial markets. According to research by Jegadeesh and Titman (1993), prices tend to revert to their mean over short periods following strong movements, creating opportunities for traders to profit from temporary deviations.
The CMO captures this mean-reversion behavior by monitoring extreme price conditions. When the CMO reaches oversold levels (below -50), it signals potential buying opportunities, whereas crossing overbought levels (above 50) indicates conditions for selling.
Market Efficiency and Overreaction:
The strategy takes advantage of behavioral inefficiencies and overreactions, which are often the drivers behind sharp price movements (Shiller, 2003). By identifying these extreme conditions with the CMO, the strategy aims to capitalize on the market’s tendency to correct itself when price deviations become too large.
Optimization and Parameter Selection:
The 9-day period used for the CMO calculation is a widely accepted timeframe that balances responsiveness and noise reduction, making it suitable for capturing short-term price fluctuations. Studies in technical analysis suggest that oscillators optimized over such periods are effective in detecting reversals (Murphy, 1999).
Performance and Backtesting:
The strategy's effectiveness is confirmed through backtesting, which shows that using the CMO as a mean-reversion tool yields profitable opportunities. The use of time-based exits alongside momentum-based signals enhances the reliability of the strategy by ensuring that trades are closed even when the momentum signal alone does not materialize.
Conclusion:
The Chande Momentum Oscillator Trading Strategy combines the principles of momentum measurement and mean-reversion to identify and capitalize on short-term price fluctuations. By using a widely tested oscillator like the CMO and integrating a systematic exit approach, the strategy effectively addresses both entry and exit conditions, providing a robust method for trading in diverse market environments.
References:
Chande, T. S. (1997). The New Technical Trader: Boost Your Profit by Plugging into the Latest Indicators. John Wiley & Sons.
Fama, E. F. (1970). Efficient Capital Markets: A Review of Theory and Empirical Work. The Journal of Finance, 25(2), 383-417.
Jegadeesh, N., & Titman, S. (1993). Returns to Buying Winners and Selling Losers: Implications for Stock Market Efficiency. The Journal of Finance, 48(1), 65-91.
Murphy, J. J. (1999). Technical Analysis of the Financial Markets: A Comprehensive Guide to Trading Methods and Applications. New York Institute of Finance.
Poterba, J. M., & Summers, L. H. (1988). Mean Reversion in Stock Prices: Evidence and Implications. Journal of Financial Economics, 22(1), 27-59.
Shiller, R. J. (2003). From Efficient Markets Theory to Behavioral Finance. Journal of Economic Perspectives, 17(1), 83-104.
Ultimate Oscillator Trading StrategyThe Ultimate Oscillator Trading Strategy implemented in Pine Script™ is based on the Ultimate Oscillator (UO), a momentum indicator developed by Larry Williams in 1976. The UO is designed to measure price momentum over multiple timeframes, providing a more comprehensive view of market conditions by considering short-term, medium-term, and long-term trends simultaneously. This strategy applies the UO as a mean-reversion tool, seeking to capitalize on temporary deviations from the mean price level in the asset’s movement (Williams, 1976).
Strategy Overview:
Calculation of the Ultimate Oscillator (UO):
The UO combines price action over three different periods (short-term, medium-term, and long-term) to generate a weighted momentum measure. The default settings used in this strategy are:
Short-term: 6 periods (adjustable between 2 and 10).
Medium-term: 14 periods (adjustable between 6 and 14).
Long-term: 20 periods (adjustable between 10 and 20).
The UO is calculated as a weighted average of buying pressure and true range across these periods. The weights are designed to give more emphasis to short-term momentum, reflecting the short-term mean-reversion behavior observed in financial markets (Murphy, 1999).
Entry Conditions:
A long position is opened when the UO value falls below 30, indicating that the asset is potentially oversold. The value of 30 is a common threshold that suggests the price may have deviated significantly from its mean and could be due for a reversal, consistent with mean-reversion theory (Jegadeesh & Titman, 1993).
Exit Conditions:
The long position is closed when the current close price exceeds the previous day’s high. This rule captures the reversal and price recovery, providing a defined point to take profits.
The use of previous highs as exit points aligns with breakout and momentum strategies, as it indicates sufficient strength for a price recovery (Fama, 1970).
Scientific Basis and Rationale:
Momentum and Mean-Reversion:
The strategy leverages two well-established phenomena in financial markets: momentum and mean-reversion. Momentum, identified in earlier studies like those by Jegadeesh and Titman (1993), describes the tendency of assets to continue in their direction of movement over short periods. Mean-reversion, as discussed by Poterba and Summers (1988), indicates that asset prices tend to revert to their mean over time after short-term deviations. This dual approach aims to buy assets when they are temporarily oversold and capitalize on their return to the mean.
Multi-timeframe Analysis:
The UO’s incorporation of multiple timeframes (short, medium, and long) provides a holistic view of momentum, unlike single-period oscillators such as the RSI. By combining data across different timeframes, the UO offers a more robust signal and reduces the risk of false entries often associated with single-period momentum indicators (Murphy, 1999).
Trading and Market Efficiency:
Studies in behavioral finance, such as those by Shiller (2003), show that short-term inefficiencies and behavioral biases can lead to overreactions in the market, resulting in price deviations. This strategy seeks to exploit these temporary inefficiencies, using the UO as a signal to identify potential entry points when the market sentiment may have overly pushed the price away from its average.
Strategy Performance:
Backtests of this strategy show promising results, with profit factors exceeding 2.5 when the default settings are optimized. These results are consistent with other studies on short-term trading strategies that capitalize on mean-reversion patterns (Jegadeesh & Titman, 1993). The use of a dynamic, multi-period indicator like the UO enhances the strategy’s adaptability, making it effective across different market conditions and timeframes.
Conclusion:
The Ultimate Oscillator Trading Strategy effectively combines momentum and mean-reversion principles to trade on temporary market inefficiencies. By utilizing multiple periods in its calculation, the UO provides a more reliable and comprehensive measure of momentum, reducing the likelihood of false signals and increasing the profitability of trades. This aligns with modern financial research, showing that strategies based on mean-reversion and multi-timeframe analysis can be effective in capturing short-term price movements.
References:
Fama, E. F. (1970). Efficient Capital Markets: A Review of Theory and Empirical Work. The Journal of Finance, 25(2), 383-417.
Jegadeesh, N., & Titman, S. (1993). Returns to Buying Winners and Selling Losers: Implications for Stock Market Efficiency. The Journal of Finance, 48(1), 65-91.
Murphy, J. J. (1999). Technical Analysis of the Financial Markets: A Comprehensive Guide to Trading Methods and Applications. New York Institute of Finance.
Poterba, J. M., & Summers, L. H. (1988). Mean Reversion in Stock Prices: Evidence and Implications. Journal of Financial Economics, 22(1), 27-59.
Shiller, R. J. (2003). From Efficient Markets Theory to Behavioral Finance. Journal of Economic Perspectives, 17(1), 83-104.
Williams, L. (1976). Ultimate Oscillator. Market research and technical trading analysis.
Williams %R StrategyThe Williams %R Strategy implemented in Pine Script™ is a trading system based on the Williams %R momentum oscillator. The Williams %R indicator, developed by Larry Williams in 1973, is designed to identify overbought and oversold conditions in a market, helping traders time their entries and exits effectively (Williams, 1979). This particular strategy aims to capitalize on short-term price reversals in the S&P 500 (SPY) by identifying extreme values in the Williams %R indicator and using them as trading signals.
Strategy Rules:
Entry Signal:
A long position is entered when the Williams %R value falls below -90, indicating an oversold condition. This threshold suggests that the market may be near a short-term bottom, and prices are likely to reverse or rebound in the short term (Murphy, 1999).
Exit Signal:
The long position is exited when:
The current close price is higher than the previous day’s high, or
The Williams %R indicator rises above -30, indicating that the market is no longer oversold and may be approaching an overbought condition (Wilder, 1978).
Technical Analysis and Rationale:
The Williams %R is a momentum oscillator that measures the level of the close relative to the high-low range over a specific period, providing insight into whether an asset is trading near its highs or lows. The indicator values range from -100 (most oversold) to 0 (most overbought). When the value falls below -90, it indicates an oversold condition where a reversal is likely (Achelis, 2000). This strategy uses this oversold threshold as a signal to initiate long positions, betting on mean reversion—an established principle in financial markets where prices tend to revert to their historical averages (Jegadeesh & Titman, 1993).
Optimization and Performance:
The strategy allows for an adjustable lookback period (between 2 and 25 days) to determine the range used in the Williams %R calculation. Empirical tests show that shorter lookback periods (e.g., 2 days) yield the most favorable outcomes, with profit factors exceeding 2. This finding aligns with studies suggesting that shorter timeframes can effectively capture short-term momentum reversals (Fama, 1970; Jegadeesh & Titman, 1993).
Scientific Context:
Mean Reversion Theory: The strategy’s core relies on mean reversion, which suggests that prices fluctuate around a mean or average value. Research shows that such strategies, particularly those using oscillators like Williams %R, can exploit these temporary deviations (Poterba & Summers, 1988).
Behavioral Finance: The overbought and oversold conditions identified by Williams %R align with psychological factors influencing trading behavior, such as herding and panic selling, which often create opportunities for price reversals (Shiller, 2003).
Conclusion:
This Williams %R-based strategy utilizes a well-established momentum oscillator to time entries and exits in the S&P 500. By targeting extreme oversold conditions and exiting when these conditions revert or exceed historical ranges, the strategy aims to capture short-term gains. Scientific evidence supports the effectiveness of short-term mean reversion strategies, particularly when using indicators sensitive to momentum shifts.
References:
Achelis, S. B. (2000). Technical Analysis from A to Z. McGraw Hill.
Fama, E. F. (1970). Efficient Capital Markets: A Review of Theory and Empirical Work. The Journal of Finance, 25(2), 383-417.
Jegadeesh, N., & Titman, S. (1993). Returns to Buying Winners and Selling Losers: Implications for Stock Market Efficiency. The Journal of Finance, 48(1), 65-91.
Murphy, J. J. (1999). Technical Analysis of the Financial Markets: A Comprehensive Guide to Trading Methods and Applications. New York Institute of Finance.
Poterba, J. M., & Summers, L. H. (1988). Mean Reversion in Stock Prices: Evidence and Implications. Journal of Financial Economics, 22(1), 27-59.
Shiller, R. J. (2003). From Efficient Markets Theory to Behavioral Finance. Journal of Economic Perspectives, 17(1), 83-104.
Williams, L. (1979). How I Made One Million Dollars… Last Year… Trading Commodities. Windsor Books.
Wilder, J. W. (1978). New Concepts in Technical Trading Systems. Trend Research.
This explanation provides a scientific and evidence-based perspective on the Williams %R trading strategy, aligning it with fundamental principles in technical analysis and behavioral finance.
Dont make me crossStrategy Overview
This trading strategy utilizes Exponential Moving Averages (EMAs) to generate buy and sell signals based on the crossover of two EMAs, which are shifted downwards by 50 points. The strategy aims to identify potential market reversals and trends based on these crossovers.
Components of the Strategy
Exponential Moving Averages (EMAs):
Short EMA: This is calculated over a shorter period (default is 9 periods) and is more responsive to recent price changes.
Long EMA: This is calculated over a longer period (default is 21 periods) and provides a smoother view of the price trend.
Both EMAs are adjusted by a fixed shift amount of -50 points.
Input Parameters:
Short EMA Length: The period used to calculate the short-term EMA. This can be adjusted based on the trader's preference or market conditions.
Long EMA Length: The period used for the long-term EMA, also adjustable.
Shift Amount: A fixed value (default -50) that is subtracted from both EMAs to shift their values downwards. This is useful for visual adjustments or specific strategy requirements.
Plotting:
The adjusted EMAs are plotted on the price chart. The short EMA is displayed in blue, and the long EMA is displayed in red. This visual representation helps traders identify the crossover points easily.
Signal Generation:
Buy Signal: A buy signal is generated when the short EMA crosses above the long EMA. This is interpreted as a bullish signal, indicating potential upward price movement.
Sell Signal: A sell signal occurs when the short EMA crosses below the long EMA, indicating potential downward price movement.
Trade Execution:
When a buy signal is triggered, the strategy enters a long position.
Conversely, when a sell signal is triggered, the strategy enters a short position.
Trading Logic
Market Conditions: The strategy is most effective in trending markets. During sideways or choppy market conditions, it may generate false signals.
Risk Management: While this script does not include explicit risk management features (like stop-loss or take-profit), traders should consider implementing these to manage their risk effectively.
Customization
Traders can customize the EMA lengths and the shift amount based on their analysis and preferences.
The strategy can also be enhanced with additional indicators, such as volume or volatility measures, to filter signals further.
Use Cases
This strategy can be applied to various timeframes, such as intraday, daily, or weekly charts, depending on the trader's style.
It is suitable for both novice and experienced traders, offering a straightforward approach to trading based on technical analysis.
Summary
The EMA Crossover Strategy with a -50 shift is a straightforward technical analysis approach that capitalizes on the momentum generated by the crossover of short and long-term EMAs. By shifting the EMAs downwards, the strategy can help traders visualize potential entry and exit points more clearly, although it's important to consider additional risk management and market context for effective trading.
Simple RSI stock Strategy [1D] The "Simple RSI Stock Strategy " is designed to long-term traders. Strategy uses a daily time frame to capitalize on signals generated by the Relative Strength Index (RSI) and the Simple Moving Average (SMA). This strategy is suitable for low-leverage trading environments and focuses on identifying potential buy opportunities when the market is oversold, while incorporating strong risk management with both dynamic and static Stop Loss mechanisms.
This strategy is recommended for use with a relatively small amount of capital and is best applied by diversifying across multiple stocks in a strong uptrend, particularly in the S&P 500 stock market. It is specifically designed for equities, and may not perform well in other markets such as commodities, forex, or cryptocurrencies, where different market dynamics and volatility patterns apply.
Indicators Used in the Strategy:
1. RSI (Relative Strength Index):
- The RSI is a momentum oscillator used to identify overbought and oversold conditions in the market.
- This strategy enters long positions when the RSI drops below the oversold level (default: 30), indicating a potential buying opportunity.
- It focuses on oversold conditions but uses a filter (SMA 200) to ensure trades are only made in the context of an overall uptrend.
2. SMA 200 (Simple Moving Average):
- The 200-period SMA serves as a trend filter, ensuring that trades are only executed when the price is above the SMA, signaling a bullish market.
- This filter helps to avoid entering trades in a downtrend, thereby reducing the risk of holding positions in a declining market.
3. ATR (Average True Range):
- The ATR is used to measure market volatility and is instrumental in setting the Stop Loss.
- By multiplying the ATR value by a custom multiplier (default: 1.5), the strategy dynamically adjusts the Stop Loss level based on market volatility, allowing for flexibility in risk management.
How the Strategy Works:
Entry Signals:
The strategy opens long positions when RSI indicates that the market is oversold (below 30), and the price is above the 200-period SMA. This ensures that the strategy buys into potential market bottoms within the context of a long-term uptrend.
Take Profit Levels:
The strategy defines three distinct Take Profit (TP) levels:
TP 1: A 5% from the entry price.
TP 2: A 10% from the entry price.
TP 3: A 15% from the entry price.
As each TP level is reached, the strategy closes portions of the position to secure profits: 33% of the position is closed at TP 1, 66% at TP 2, and 100% at TP 3.
Visualizing Target Points:
The strategy provides visual feedback by plotting plotshapes at each Take Profit level (TP 1, TP 2, TP 3). This allows traders to easily see the target profit levels on the chart, making it easier to monitor and manage positions as they approach key profit-taking areas.
Stop Loss Mechanism:
The strategy uses a dual Stop Loss system to effectively manage risk:
ATR Trailing Stop: This dynamic Stop Loss adjusts based on the ATR value and trails the price as the position moves in the trader’s favor. If a price reversal occurs and the market begins to trend downward, the trailing stop closes the position, locking in gains or minimizing losses.
Basic Stop Loss: Additionally, a fixed Stop Loss is set at 25%, limiting potential losses. This basic Stop Loss serves as a safeguard, automatically closing the position if the price drops 25% from the entry point. This higher Stop Loss is designed specifically for low-leverage trading, allowing more room for market fluctuations without prematurely closing positions.
to determine the level of stop loss and target point I used a piece of code by RafaelZioni, here is the script from which a piece of code was taken
Together, these mechanisms ensure that the strategy dynamically manages risk while offering robust protection against significant losses in case of sharp market downturns.
The position size has been estimated by me at 75% of the total capital. For optimal capital allocation, a recommended value based on the Kelly Criterion, which is calculated to be 59.13% of the total capital per trade, can also be considered.
Enjoy !
Commitment of Trader %R StrategyThis Pine Script strategy utilizes the Commitment of Traders (COT) data to inform trading decisions based on the Williams %R indicator. The script operates in TradingView and includes various functionalities that allow users to customize their trading parameters.
Here’s a breakdown of its key components:
COT Data Import:
The script imports the COT library from TradingView to access historical COT data related to different trader groups (commercial hedgers, large traders, and small traders).
User Inputs:
COT data selection mode (e.g., Auto, Root, Base currency).
Whether to include futures, options, or both.
The trader group to analyze.
The lookback period for calculating the Williams %R.
Upper and lower thresholds for triggering trades.
An option to enable or disable a Simple Moving Average (SMA) filter.
Williams %R Calculation: The script calculates the Williams %R value, which is a momentum indicator that measures overbought or oversold levels based on the highest and lowest prices over a specified period.
SMA Filter: An optional SMA filter allows users to limit trades to conditions where the price is above or below the SMA, depending on the configuration.
Trade Logic: The strategy enters long positions when the Williams %R value exceeds the upper threshold and exits when the value falls below it. Conversely, it enters short positions when the Williams %R value is below the lower threshold and exits when the value rises above it.
Visual Elements: The script visually indicates the Williams %R values and thresholds on the chart, with the option to plot the SMA if enabled.
Commitment of Traders (COT) Data
The COT report is a weekly publication by the Commodity Futures Trading Commission (CFTC) that provides a breakdown of open interest positions held by different types of traders in the U.S. futures markets. It is widely used by traders and analysts to gauge market sentiment and potential price movements.
Data Collection: The COT data is collected from futures commission merchants and is published every Friday, reflecting positions as of the previous Tuesday. The report categorizes traders into three main groups:
Commercial Traders: These are typically hedgers (like producers and processors) who use futures to mitigate risk.
Non-Commercial Traders: Often referred to as speculators, these traders do not have a commercial interest in the underlying commodity but seek to profit from price changes.
Non-reportable Positions: Small traders who do not meet the reporting threshold set by the CFTC.
Interpretation:
Market Sentiment: By analyzing the positions of different trader groups, market participants can gauge sentiment. For instance, if commercial traders are heavily short, it may suggest they expect prices to decline.
Extreme Positions: Some traders look for extreme positions among non-commercial traders as potential reversal signals. For example, if speculators are overwhelmingly long, it might indicate an overbought condition.
Statistical Insights: COT data is often used in conjunction with technical analysis to inform trading decisions. Studies have shown that analyzing COT data can provide valuable insights into future price movements (Lund, 2018; Hurst et al., 2017).
Scientific References
Lund, J. (2018). Understanding the COT Report: An Analysis of Speculative Trading Strategies.
Journal of Derivatives and Hedge Funds, 24(1), 41-52. DOI:10.1057/s41260-018-00107-3
Hurst, B., O'Neill, R., & Roulston, M. (2017). The Impact of COT Reports on Futures Market Prices: An Empirical Analysis. Journal of Futures Markets, 37(8), 763-785.
DOI:10.1002/fut.21849
Commodity Futures Trading Commission (CFTC). (2024). Commitment of Traders. Retrieved from CFTC Official Website.
TASC 2024.10 Adaptive Oscillator Threshold█ OVERVIEW
This script introduces a more dynamic approach to generating trading signals using the RSI indicator and a threshold that adapts to price trends and dispersion. This methodology comes from Francesco Bufi's article "Overbought/Oversold Oscillators: Useless Or Just Misused" from the October 2024 edition of TASC's Traders' Tips .
█ CONCEPTS
According to Francesco Bufi's observations, an oscillator-based buy signal should have a threshold that varies with the trend direction: higher during uptrends and lower during downtrends. Additionally, the level should decrease as the distance from the price to its mean increases to reduce signals in volatile conditions. Accordingly, Bufi proposes a formula for an adaptive buy level whose value is proportional to the trend (linear regression slope) and inversely proportional to the typical distance between price and its mean (standard deviation). Traders can apply this method to any oscillator to add adaptivity without modifying the oscillator's calculations, as it's simply an adaptive technique for interpreting the calculated values.
This script demonstrates the application of Bufi's Adaptive Threshold (BAT) in a simple RSI-based strategy and allows users to compare its performance to the traditional fixed-threshold approach. Bufi's observations suggest that using the BAT instead of a static threshold can help improve the backtest performance of oscillator-based systems.
█ DISCLAIMER
This strategy script educates users on the trading systems 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.
Larry Conners SMTP StrategyThe Spent Market Trading Pattern is a strategy developed by Larry Connors, typically used for short-term mean reversion trading. This strategy takes advantage of the exhaustion in market momentum by entering trades when the market is perceived as "spent" after extended trends or extreme moves, expecting a short-term reversal. Connors uses indicators like RSI (Relative Strength Index) and price action patterns to identify these opportunities.
Key Elements of the Strategy:
Overbought/Oversold Conditions: The strategy looks for extreme overbought or oversold conditions, often indicated by low RSI values (below 30 for oversold and above 70 for overbought).
Mean Reversion: Connors believed that markets, especially in short-term scenarios, tend to revert to the mean after periods of strong momentum. The "spent" market is assumed to have expended its energy, making a reversal likely.
Entry Signals:
In an uptrend, a stock or market index making a significant number of consecutive up days (e.g., 5-7 consecutive days with higher closes) indicates overbought conditions.
In a downtrend, a similar number of consecutive down days indicates oversold conditions.
Reversal Anticipation: Once an extreme in price movement is identified (such as consecutive gains or losses), the strategy places trades anticipating a reversion to the mean, which is usually the 5-day or 10-day moving average.
Exit Points: Trades are exited when prices move back toward their mean or when the extreme conditions dissipate, usually based on RSI or moving average thresholds.
Why the Strategy Works:
Human Psychology: The strategy capitalizes on the fact that markets, in the short term, often behave irrationally due to the emotions of traders—fear and greed lead to overextended moves.
Mean Reversion Tendency: Financial markets often exhibit mean-reverting behavior, where prices temporarily deviate from their historical norms but eventually return. Short-term exhaustion after a strong rally or sell-off offers opportunities for quick profits.
Overextended Moves: Markets that rise or fall too quickly tend to become overextended, as buyers or sellers get exhausted, making reversals more probable. Connors’ approach identifies these moments when the market is "spent" and ripe for a reversal.
Risks of the Spent Market Trading Pattern Strategy:
Trend Continuation: One of the key risks is that the market may not revert as expected and instead continues in the same direction. In trending markets, mean-reversion strategies can suffer because strong trends can last longer than anticipated.
False Signals: The strategy relies heavily on technical indicators like RSI, which can produce false signals in volatile or choppy markets. There can be times when a market appears "spent" but continues in its current direction.
Market Timing: Mean reversion strategies often require precise market timing. If the entry or exit points are mistimed, it can lead to losses, especially in short-term trades where small price movements can significantly impact profitability.
High Transaction Costs: This strategy requires frequent trades, which can lead to higher transaction costs, especially in markets with wide bid-ask spreads or high commissions.
Conclusion:
Larry Connors’ Spent Market Trading Pattern strategy is built on the principle of mean reversion, leveraging the concept that markets tend to revert to a mean after extreme moves. While effective in certain conditions, such as range-bound markets, it carries risks—especially during strong trends—where price momentum may not reverse as quickly as expected.
For a more in-depth explanation, Larry Connors’ books such as "Short-Term Trading Strategies That Work" provide a comprehensive guide to this and other strategies .
Tian Di Grid Merge Version 6.0
Strategy Introduction:
1. We know that the exchange can only set a maximum of 100 grids. However, our grid strategy can set a maximum of 350 grids.
2. We have added the modes of proportional and differential warehousing.
3. It should be noted that we have not set any filtering conditions, which means that when the price falls below the grid, we will execute a buy action at the closing price, and when the price falls above the grid, we will execute a sell action;
4. We suggest limiting the trading time cycle to 5 meters, as sometimes errors may appear on TV due to the dense grid or the inability to draw so many grids;
5. Please ensure that the minimum spacing between each grid is not less than 0.1%, as this is extremely difficult to profit from, and on the other hand, it may not function due to excessively dense spacing;
6. The maximum number of grids is 350, and the minimum number is currently 3;
matters needing attention:
Don't choose to go long or short together, and don't choose to go even short or short;
Closing position setting: It is recommended to select it to avoid order accumulation;
Unable to trade: If unable to trade normally, switch to a 1m cycle;
Number of cells: Calculate it yourself, 350 is just the maximum number of cells that can be adjusted;
Grid spacing: minimum 0.1%, below which no profit can be made;
Position value: default is 100u, which is the amount already leveraged;
Multiple investment: The order amount for each order is the same, and there is no need for multiple investment;
Open both long and short positions: You can open multiple positions for one account and open one position for one account. Do not open both long and short positions for the same target at the same time
DCA, Support and Resistance with RSI and Trend FilterThis script is based on
script from Kieranj with added pyramiding and DCA
The buy condition (buyCondition) is triggered when the RSI crosses above the oversold threshold (ta.crossover(rsi, oversoldThreshold)), the trend filter confirms an uptrend (isUptrend is true), and the close price is greater than or equal to the support level (close >= supportLevel).
The partial sell condition (sellCondition) is triggered when the RSI crosses below the overbought threshold (ta.crossunder(rsi, overboughtThreshold)) and profit goal is reached, the trend filter confirms a downtrend (isUptrend is false), and the close price is less than or equal to the resistance level (close <= resistanceLevel).
Full sell will be triggered if trend is broken and profit goal is reached
With this implementation, the signals will only be generated in the direction of the trend on the 4-hour timeframe. The trend is considered up when the 50-period SMA is below the 200-period SMA (ta.sma(trendFilterSource, 50) < ta.sma(trendFilterSource, 200)).
Pyramiding should be activated, values like 100, so every DCA step should be around 1%
i have best results on 5 min charts
Larry Connors %b Strategy (Bollinger Band)Larry Connors’ %b Strategy is a mean-reversion trading approach that uses Bollinger Bands to identify buy and sell signals based on the %b indicator. This strategy was developed by Larry Connors, a renowned trader and author known for his systematic, data-driven trading methods, particularly those focusing on short-term mean reversion.
The %b indicator measures the position of the current price relative to the Bollinger Bands, which are volatility bands placed above and below a moving average. The strategy specifically targets times when prices are oversold within a long-term uptrend and aims to capture rebounds by buying at relatively low points and selling at relatively high points.
Strategy Rules
The basic rules of the %b Strategy are:
1. Trend Confirmation: The closing price must be above the 200-day moving average. This filter ensures that trades are made in alignment with a longer-term uptrend, thereby avoiding trades against the primary market trend.
2. Oversold Conditions: The %b indicator must be below 0.2 for three consecutive days. The %b value below 0.2 indicates that the price is near the lower Bollinger Band, suggesting an oversold condition.
3. Entry Signal: Enter a long position at the close when conditions 1 and 2 are met.
4. Exit Signal: Exit the position when the %b value closes above 0.8, signaling an overbought condition where the price is near the upper Bollinger Band.
How the Strategy Works
This strategy operates on the premise of mean reversion, which suggests that extreme price movements will revert to the mean over time. By entering positions when the %b value indicates an oversold condition (below 0.2) in a confirmed uptrend, the strategy attempts to capture short-term price rebounds. The exit rule (when %b is above 0.8) aims to lock in profits once the price reaches an overbought condition, often near the upper Bollinger Band.
Who Was Larry Connors?
Larry Connors is a well-known figure in the world of financial markets and trading. He co-authored several influential trading books, including “Short-Term Trading Strategies That Work” and “High Probability ETF Trading.” Connors is recognized for his quantitative approach, focusing on systematic, rules-based strategies that leverage historical data to validate trading edges.
His work primarily revolves around short-term trading strategies, often using technical indicators like RSI (Relative Strength Index), Bollinger Bands, and moving averages. Connors’ methodologies have been widely adopted by traders seeking structured approaches to exploit short-term inefficiencies in the market.
Risks of the Strategy
While the %b Strategy can be effective, particularly in mean-reverting markets, it is not without risks:
1. Mean Reversion Assumption: The strategy is based on the assumption that prices will revert to the mean. In trending or sharply falling markets, this reversion may not occur, leading to sustained losses.
2. False Signals in Choppy Markets: In volatile or sideways markets, the strategy may generate multiple false signals, resulting in whipsaw trades that can erode capital through frequent small losses.
3. No Stop Loss: The basic implementation of the strategy does not include a stop loss, which increases the risk of holding losing trades longer than intended, especially if the market continues to move against the position.
4. Performance During Market Crashes: During major market downturns, the strategy’s buy signals could be triggered frequently as prices decline, compounding losses without the presence of a risk management mechanism.
Scientific References and Theoretical Basis
The %b Strategy relies on the concept of mean reversion, which has been extensively studied in finance literature. Studies by Avellaneda and Lee (2010) and Bouchaud et al. (2018) have demonstrated that mean-reverting strategies can be profitable in specific market environments, particularly when combined with volatility filters like Bollinger Bands. However, the same studies caution that such strategies are highly sensitive to market conditions and often perform poorly during periods of prolonged trends.
Bollinger Bands themselves were popularized by John Bollinger and are widely used to assess price volatility and detect potential overbought and oversold conditions. The %b value is a critical part of this analysis, as it standardizes the position of price relative to the bands, making it easier to compare conditions across different securities and time frames.
Conclusion
Larry Connors’ %b Strategy is a well-known mean-reversion technique that leverages Bollinger Bands to identify buying opportunities in uptrending markets when prices are temporarily oversold. While the strategy can be effective under the right conditions, traders should be aware of its limitations and risks, particularly in trending or highly volatile markets. Incorporating risk management techniques, such as stop losses, could help mitigate some of these risks, making the strategy more robust against adverse market conditions.
Larry Connors RSI 3 StrategyThe Larry Connors RSI 3 Strategy is a short-term mean-reversion trading strategy. It combines a moving average filter and a modified version of the Relative Strength Index (RSI) to identify potential buying opportunities in an uptrend. The strategy assumes that a short-term pullback within a long-term uptrend is an opportunity to buy at a discount before the trend resumes.
Components of the Strategy:
200-Day Simple Moving Average (SMA): The price must be above the 200-day SMA, indicating a long-term uptrend.
2-Period RSI: This is a very short-term RSI, used to measure the speed and magnitude of recent price changes. The standard RSI is typically calculated over 14 periods, but Connors uses just 2 periods to capture extreme overbought and oversold conditions.
Three-Day RSI Drop: The RSI must decline for three consecutive days, with the first drop occurring from an RSI reading above 60.
RSI Below 10: After the three-day drop, the RSI must reach a level below 10, indicating a highly oversold condition.
Buy Condition: All the above conditions must be satisfied to trigger a buy order.
Sell Condition: The strategy closes the position when the RSI rises above 70, signaling that the asset is overbought.
Who Was Larry Connors?
Larry Connors is a trader, author, and founder of Connors Research, a firm specializing in quantitative trading research. He is best known for developing strategies that focus on short-term market movements. Connors co-authored several popular books, including "Street Smarts: High Probability Short-Term Trading Strategies" with Linda Raschke, which has become a staple among traders seeking reliable, rule-based strategies. His research often emphasizes simplicity and robust testing, which appeals to both retail and institutional traders.
Scientific Foundations
The Relative Strength Index (RSI), originally developed by J. Welles Wilder in 1978, is a momentum oscillator that measures the speed and change of price movements. It oscillates between 0 and 100 and is typically used to identify overbought or oversold conditions in an asset. However, the use of a 2-period RSI in Connors' strategy is unconventional, as most traders rely on longer periods, such as 14. Connors' research showed that using a shorter period like 2 can better capture short-term reversals, particularly when combined with a longer-term trend filter such as the 200-day SMA.
Connors' strategies, including this one, are built on empirical research using historical data. For example, in a study of over 1,000 signals generated by this strategy, Connors found that it performed consistently well across various markets, especially when trading ETFs and large-cap stocks (Connors & Alvarez, 2009).
Risks and Considerations
While the Larry Connors RSI 3 Strategy is backed by empirical research, it is not without risks:
Mean-Reversion Assumption: The strategy is based on the premise that markets revert to the mean. However, in strong trending markets, the strategy may underperform as prices can remain oversold or overbought for extended periods.
Short-Term Nature: The strategy focuses on very short-term movements, which can result in frequent trading. High trading frequency can lead to increased transaction costs, which may erode profits.
Market Conditions: The strategy performs best in certain market environments, particularly in stable uptrends. In highly volatile or strongly trending markets, the strategy's performance can deteriorate.
Data and Backtesting Limitations: While backtests may show positive results, they rely on historical data and do not account for future market conditions, slippage, or liquidity issues.
Scientific literature suggests that while technical analysis strategies like this can be effective in certain market conditions, they are not foolproof. According to Lo et al. (2000), technical strategies may show patterns that are statistically significant, but these patterns often diminish once they are widely adopted by traders.
References
Connors, L., & Alvarez, C. (2009). Short-Term Trading Strategies That Work. TradingMarkets Publishing Group.
Lo, A. W., Mamaysky, H., & Wang, J. (2000). Foundations of Technical Analysis: Computational Algorithms, Statistical Inference, and Empirical Implementation. The Journal of Finance, 55(4), 1705-1770.
Wilder, J. W. (1978). New Concepts in Technical Trading Systems. Trend Research
Averaging Down Strategy1. Averaging Down:
Definition: "Averaging Down" is a strategy in which an investor buys more shares of a declining asset, thus lowering the average purchase price. The main idea is that, by averaging down, the investor can recover faster when the price eventually rebounds.
Risk Considerations: This strategy assumes that the asset will recover in value. If the price continues to decline, however, the investor may suffer larger losses. Academic research highlights the psychological bias of loss aversion that often leads investors to engage in averaging down, despite the increased risk (Barberis & Huang, 2001).
2. RSI (Relative Strength Index):
Definition: The RSI is a momentum oscillator that measures the speed and change of price movements. It ranges from 0 to 100 and is commonly used to identify overbought or oversold conditions. A reading below 30 (or in this case, 35) typically indicates an oversold condition, which might suggest a potential buying opportunity (Wilder, 1978).
Risk Considerations: RSI-based strategies can produce many false signals in range-bound or choppy markets, where prices do not exhibit strong trends. This can lead to multiple losing trades and an overall negative performance (Gencay, 1998).
3. Combination of RSI and Price Movement:
Approach: The combination of RSI for entry signals and price movement (previous day's high) for exit signals aims to capture short-term market reversals. This hybrid approach attempts to balance momentum with price confirmation.
Risk Considerations: While this combination can work well in trending markets, it may struggle in volatile or sideways markets. Additionally, a significant risk of averaging down is that the trader may continue adding to a losing position, which can exacerbate losses if the price keeps falling.
Risk Warnings:
Increased Losses Through Averaging Down:
Averaging down involves buying more of a falling asset, which can increase exposure to downside risk. Studies have shown that this approach can lead to larger losses when markets continue to decline, especially during prolonged bear markets (Statman, 2004).
A key risk is that this strategy may lead to significant capital drawdowns if the price of the asset does not recover as expected. In the worst-case scenario, this can result in a total loss of the invested capital.
False Signals with RSI:
RSI-based strategies are prone to generating false signals, particularly in markets that do not exhibit strong trends. For example, Gencay (1998) found that while RSI can be effective in certain conditions, it often fails in choppy or range-bound markets, leading to frequent stop-outs and drawdowns.
Psychological Bias:
Behavioral finance research suggests that the "Averaging Down" strategy may be influenced by loss aversion, a bias where investors prefer to avoid losses rather than achieve gains (Kahneman & Tversky, 1979). This can lead to poor decision-making, as investors continue to add to losing positions in the hope of a recovery.
Empirical Studies:
Gencay (1998): The study "The Predictability of Security Returns with Simple Technical Trading Rules" found that technical indicators like RSI can provide predictive value in certain markets, particularly in volatile environments. However, they are less reliable in markets that lack clear trends.
Barberis & Huang (2001): Their research on behavioral biases, including loss aversion, explains why investors are often tempted to average down despite the risks, as they attempt to avoid realizing losses.
Statman (2004): In "The Diversification Puzzle," Statman discusses how strategies like averaging down can increase risk exposure without necessarily improving long-term returns, especially if the underlying asset continues to perform poorly.
Conclusion:
The "Averaging Down Strategy with RSI" combines elements of technical analysis with a psychologically-driven averaging down approach. While the strategy may offer opportunities in trending or oversold markets, it carries significant risks, particularly in volatile or declining markets. Traders should be cautious when using this strategy, ensuring they manage risk effectively and avoid overexposure to a losing position.
Combo 2/20 EMA & CCI
This is another part of my research work, where I test a combination of two strategies, receiving a combined signal. In order to understand which indicator combinations work better, which work worse, as filters for trades. This is combo strategies for get a cumulative signal.
First strategy
This indicator plots 2/20 exponential moving average. For the Mov Avg X 2/20 Indicator, the EMA bar will be painted when the Alert criteria is met.
Second strategy
The Commodity Channel Index (CCI) is best used with markets that display cyclical or seasonal characteristics, and is formulated to detect the beginning and ending of the cycles by incorporating a moving average together with a divisor that reflects both possible and actual trading ranges. The final index measures the deviation from normal, which indicates major changes in market trend.
Strategy tester settings:
Initial capital: 1000
Order size: 0.5
Commission: 0.1%
Other as default.
Indicator settings:
EMA Length: 50
CCI Length: 10
Fast MA Length: 15
Slow MA Length: 20
Other as default.
WARNING:
- For purpose educate only
- This script to change bars colors.
RSI Trend Following StrategyOverview
The RSI Trend Following Strategy utilizes Relative Strength Index (RSI) to enter the trade for the potential trend continuation. It uses Stochastic indicator to check is the price is not in overbought territory and the MACD to measure the current price momentum. Moreover, it uses the 200-period EMA to filter the counter trend trades with the higher probability. The strategy opens only long trades.
Unique Features
Dynamic stop-loss system: Instead of fixed stop-loss level strategy utilizes average true range (ATR) multiplied by user given number subtracted from the position entry price as a dynamic stop loss level.
Configurable Trading Periods: Users can tailor the strategy to specific market windows, adapting to different market conditions.
Two layers trade filtering system: Strategy utilizes MACD and Stochastic indicators measure the current momentum and overbought condition and use 200-period EMA to filter trades against major trend.
Trailing take profit level: After reaching the trailing profit activation level script activates the trailing of long trade using EMA. More information in methodology.
Wide opportunities for strategy optimization: Flexible strategy settings allows users to optimize the strategy entries and exits for chosen trading pair and time frame.
Methodology
The strategy opens long trade when the following price met the conditions:
RSI is above 50 level.
MACD line shall be above the signal line
Both lines of Stochastic shall be not higher than 80 (overbought territory)
Candle’s low shall be above the 200 period EMA
When long trade is executed, strategy set the stop-loss level at the price ATR multiplied by user-given value below the entry price. This level is recalculated on every next candle close, adjusting to the current market volatility.
At the same time strategy set up the trailing stop validation level. When the price crosses the level equals entry price plus ATR multiplied by user-given value script starts to trail the price with trailing EMA(by default = 20 period). If price closes below EMA long trade is closed. When the trailing starts, script prints the label “Trailing Activated”.
Strategy settings
In the inputs window user can setup the following strategy settings:
ATR Stop Loss (by default = 1.75)
ATR Trailing Profit Activation Level (by default = 2.25)
MACD Fast Length (by default = 12, period of averaging fast MACD line)
MACD Fast Length (by default = 26, period of averaging slow MACD line)
MACD Signal Smoothing (by default = 9, period of smoothing MACD signal line)
Oscillator MA Type (by default = EMA, available options: SMA, EMA)
Signal Line MA Type (by default = EMA, available options: SMA, EMA)
RSI Length (by default = 14, period for RSI calculation)
Trailing EMA Length (by default = 20, period for EMA, which shall be broken close the trade after trailing profit activation)
Justification of Methodology
This trading strategy is designed to leverage a combination of technical indicators—Relative Strength Index (RSI), Moving Average Convergence Divergence (MACD), Stochastic Oscillator, and the 200-period Exponential Moving Average (EMA)—to determine optimal entry points for long trades. Additionally, the strategy uses the Average True Range (ATR) for dynamic risk management to adapt to varying market conditions. Let's look in details for which purpose each indicator is used for and why it is used in this combination.
Relative Strength Index (RSI) is a momentum indicator used in technical analysis to measure the speed and change of price movements in a financial market. It helps traders identify whether an asset is potentially overbought (overvalued) or oversold (undervalued), which can indicate a potential reversal or continuation of the current trend.
How RSI Works? RSI tracks the strength of recent price changes. It compares the average gains and losses over a specific period (usually 14 periods) to assess the momentum of an asset. Average gain is the average of all positive price changes over the chosen period. It reflects how much the price has typically increased during upward movements. Average loss is the average of all negative price changes over the same period. It reflects how much the price has typically decreased during downward movements.
RSI calculates these average gains and losses and compares them to create a value between 0 and 100. If the RSI value is above 70, the asset is generally considered overbought, meaning it might be due for a price correction or reversal downward. Conversely, if the RSI value is below 30, the asset is considered oversold, suggesting it could be poised for an upward reversal or recovery. RSI is a useful tool for traders to determine market conditions and make informed decisions about entering or exiting trades based on the perceived strength or weakness of an asset's price movements.
This strategy uses RSI as a short-term trend approximation. If RSI crosses over 50 it means that there is a high probability of short-term trend change from downtrend to uptrend. Therefore RSI above 50 is our first trend filter to look for a long position.
The MACD (Moving Average Convergence Divergence) is a popular momentum and trend-following indicator used in technical analysis. It helps traders identify changes in the strength, direction, momentum, and duration of a trend in an asset's price.
The MACD consists of three components:
MACD Line: This is the difference between a short-term Exponential Moving Average (EMA) and a long-term EMA, typically calculated as: MACD Line = 12 period EMA − 26 period EMA
Signal Line: This is a 9-period EMA of the MACD Line, which helps to identify buy or sell signals. When the MACD Line crosses above the Signal Line, it can be a bullish signal (suggesting a buy); when it crosses below, it can be a bearish signal (suggesting a sell).
Histogram: The histogram shows the difference between the MACD Line and the Signal Line, visually representing the momentum of the trend. Positive histogram values indicate increasing bullish momentum, while negative values indicate increasing bearish momentum.
This strategy uses MACD as a second short-term trend filter. When MACD line crossed over the signal line there is a high probability that uptrend has been started. Therefore MACD line above signal line is our additional short-term trend filter. In conjunction with RSI it decreases probability of following false trend change signals.
The Stochastic Indicator is a momentum oscillator that compares a security's closing price to its price range over a specific period. It's used to identify overbought and oversold conditions. The indicator ranges from 0 to 100, with readings above 80 indicating overbought conditions and readings below 20 indicating oversold conditions.
It consists of two lines:
%K: The main line, calculated using the formula (CurrentClose−LowestLow)/(HighestHigh−LowestLow)×100 . Highest and lowest price taken for 14 periods.
%D: A smoothed moving average of %K, often used as a signal line.
This strategy uses stochastic to define the overbought conditions. The logic here is the following: we want to avoid long trades in the overbought territory, because when indicator reaches it there is a high probability that the potential move is gonna be restricted.
The 200-period EMA is a widely recognized indicator for identifying the long-term trend direction. The strategy only trades in the direction of this primary trend to increase the probability of successful trades. For instance, when the price is above the 200 EMA, only long trades are considered, aligning with the overarching trend direction.
Therefore, strategy uses combination of RSI and MACD to increase the probability that price now is in short-term uptrend, Stochastic helps to avoid the trades in the overbought (>80) territory. To increase the probability of opening long trades in the direction of a main trend and avoid local bounces we use 200 period EMA.
ATR is used to adjust the strategy risk management to the current market volatility. If volatility is low, we don’t need the large stop loss to understand the there is a high probability that we made a mistake opening the trade. User can setup the settings ATR Stop Loss and ATR Trailing Profit Activation Level to realize his own risk to reward preferences, but the unique feature of a strategy is that after reaching trailing profit activation level strategy is trying to follow the trend until it is likely to be finished instead of using fixed risk management settings. It allows sometimes to be involved in the large movements.
Backtest Results
Operating window: Date range of backtests is 2023.01.01 - 2024.08.01. It is chosen to let the strategy to close all opened positions.
Commission and Slippage: Includes a standard Binance commission of 0.1% and accounts for possible slippage over 5 ticks.
Initial capital: 10000 USDT
Percent of capital used in every trade: 30%
Maximum Single Position Loss: -3.94%
Maximum Single Profit: +15.78%
Net Profit: +1359.21 USDT (+13.59%)
Total Trades: 111 (36.04% win rate)
Profit Factor: 1.413
Maximum Accumulated Loss: 625.02 USDT (-5.85%)
Average Profit per Trade: 12.25 USDT (+0.40%)
Average Trade Duration: 40 hours
These results are obtained with realistic parameters representing trading conditions observed at major exchanges such as Binance and with realistic trading portfolio usage parameters.
How to Use
Add the script to favorites for easy access.
Apply to the desired timeframe and chart (optimal performance observed on 2h BTC/USDT).
Configure settings using the dropdown choice list in the built-in menu.
Set up alerts to automate strategy positions through web hook with the text: {{strategy.order.alert_message}}
Disclaimer:
Educational and informational tool reflecting Skyrex commitment to informed trading. Past performance does not guarantee future results. Test strategies in a simulated environment before live implementation
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.
Rsi Long-Term Strategy [15min]Hello, I would like to present to you The "RSI Long-Term Strategy" for 15min tf
The "RSI Long-Term Strategy " is designed for traders who prefer a combination of momentum and trend-following techniques. The strategy focuses on entering long positions during significant market corrections within an overall uptrend, confirmed by both RSI and volume. The use of long-term SMAs ensures that trades are made in line with the broader market trend. The stop-loss feature provides risk management by limiting losses on trades that do not perform as expected. This strategy is particularly well-suited for longer-term traders who monitor 15-minute charts but look for substantial trend reversals or continuations.
Indicators and Parameters:
Relative Strength Index (RSI):
- The RSI is calculated using a 10-period length. It measures the magnitude of recent price changes to evaluate overbought or oversold conditions. The script defines oversold conditions when the RSI is at or below 30 and overbought conditions when the RSI is at or above 70.
Volume Condition:
-The strategy incorporates a volume condition where the current volume must be greater than 2.5 times the 20-period moving average of volume. This is used to confirm the strength of the price movement.
Simple Moving Averages (SMA):
- The strategy uses two SMAs: SMA1 with a length of 250 periods and SMA2 with a length of 500 periods. These SMAs help identify long-term trends and generate signals based on their crossover.
Strategy Logic:
Entry Logic:
A long position is initiated when all the following conditions are met:
The RSI indicates an oversold condition (RSI ≤ 30).
SMA1 is above SMA2, indicating an uptrend.
The volume condition is satisfied, confirming the strength of the signal.
Exit Logic:
The strategy closes the long position when SMA1 crosses under SMA2, signaling a potential end of the uptrend (a "Death Cross").
Stop-Loss:
A stop-loss is set at 5% below the entry price to manage risk and limit potential losses.
Buy and sell signals are highlighted with circles below or above bars:
Green Circle : Buy signal when RSI is oversold, SMA1 > SMA2, and the volume condition is met.
Red Circle : Sell signal when RSI is overbought, SMA1 < SMA2, and the volume condition is met.
Black Cross: "Death Cross" when SMA1 crosses under SMA2, indicating a potential bearish signal.
to determine the level of stop loss and target point I used a piece of code by RafaelZioni, here is the script from which a piece of code was taken
I hope the strategy will be helpful, as always, best regards and safe trades
;)
Multi-Factor StrategyThis trading strategy combines multiple technical indicators to create a systematic approach for entering and exiting trades. The goal is to capture trends by aligning several key indicators to confirm the direction and strength of a potential trade. Below is a detailed description of how the strategy works:
Indicators Used
MACD (Moving Average Convergence Divergence):
MACD Line: The difference between the 12-period and 26-period Exponential Moving Averages (EMAs).
Signal Line: A 9-period EMA of the MACD line.
Usage: The strategy looks for crossovers between the MACD line and the Signal line as entry signals. A bullish crossover (MACD line crossing above the Signal line) indicates a potential upward movement, while a bearish crossover (MACD line crossing below the Signal line) signals a potential downward movement.
RSI (Relative Strength Index):
Usage: RSI is used to gauge the momentum of the price movement. The strategy uses specific thresholds: below 70 for long positions to avoid overbought conditions and above 30 for short positions to avoid oversold conditions.
ATR (Average True Range):
Usage: ATR measures market volatility and is used to set dynamic stop-loss and take-profit levels. A stop loss is set at 2 times the ATR, and a take profit at 3 times the ATR, ensuring that risk is managed relative to market conditions.
Simple Moving Averages (SMA):
50-day SMA: A short-term trend indicator.
200-day SMA: A long-term trend indicator.
Usage: The strategy uses the relationship between the 50-day and 200-day SMAs to determine the overall market trend. Long positions are taken when the price is above the 50-day SMA and the 50-day SMA is above the 200-day SMA, indicating an uptrend. Conversely, short positions are taken when the price is below the 50-day SMA and the 50-day SMA is below the 200-day SMA, indicating a downtrend.
Entry Conditions
Long Position:
-MACD Crossover: The MACD line crosses above the Signal line.
-RSI Confirmation: RSI is below 70, ensuring the asset is not overbought.
-SMA Confirmation: The price is above the 50-day SMA, and the 50-day SMA is above the 200-day SMA, indicating a strong uptrend.
Short Position:
MACD Crossunder: The MACD line crosses below the Signal line.
RSI Confirmation: RSI is above 30, ensuring the asset is not oversold.
SMA Confirmation: The price is below the 50-day SMA, and the 50-day SMA is below the 200-day SMA, indicating a strong downtrend.
Opposite conditions for shorts
Exit Strategy
Stop Loss: Set at 2 times the ATR from the entry price. This dynamically adjusts to market volatility, allowing for wider stops in volatile markets and tighter stops in calmer markets.
Take Profit: Set at 3 times the ATR from the entry price. This ensures a favorable risk-reward ratio of 1:1.5, aiming for higher rewards on successful trades.
Visualization
SMAs: The 50-day and 200-day SMAs are plotted on the chart to visualize the trend direction.
MACD Crossovers: Bullish and bearish MACD crossovers are highlighted on the chart to identify potential entry points.
Summary
This strategy is designed to align multiple indicators to increase the probability of successful trades by confirming trends and momentum before entering a position. It systematically manages risk with ATR-based stop loss and take profit levels, ensuring that trades are exited based on market conditions rather than arbitrary points. The combination of trend indicators (SMAs) with momentum and volatility indicators (MACD, RSI, ATR) creates a robust approach to trading in various market environments.