Bollinger Bands Mean Reversion by Kevin Davey Bollinger Bands Mean Reversion Strategy Description
The Bollinger Bands Mean Reversion Strategy is a popular trading approach based on the concept of volatility and market overreaction. The strategy leverages Bollinger Bands, which consist of an upper and lower band plotted around a central moving average, typically using standard deviations to measure volatility. When the price moves beyond these bands, it signals potential overbought or oversold conditions, and the strategy seeks to exploit a reversion back to the mean (the central band).
Strategy Components:
1. Bollinger Bands:
The bands are calculated using a 20-period Simple Moving Average (SMA) and a multiple (usually 2.0) of the standard deviation of the asset’s price over the same period. The upper band represents the SMA plus two standard deviations, while the lower band is the SMA minus two standard deviations. The distance between the bands increases with higher volatility and decreases with lower volatility.
2. Mean Reversion:
Mean reversion theory suggests that, over time, prices tend to move back toward their historical average. In this strategy, a buy signal is triggered when the price falls below the lower Bollinger Band, indicating a potential oversold condition. Conversely, the position is closed when the price rises back above the upper Bollinger Band, signaling an overbought condition.
Entry and Exit Logic:
Buy Condition: The strategy enters a long position when the price closes below the lower Bollinger Band, anticipating a mean reversion to the central band (SMA).
Sell Condition: The long position is exited when the price closes above the upper Bollinger Band, implying that the market is likely overbought and a reversal could occur.
This approach uses mean reversion principles, aiming to capitalize on short-term price extremes and volatility compression, often seen in sideways or non-trending markets. Scientific studies have shown that mean reversion strategies, particularly those based on volatility indicators like Bollinger Bands, can be effective in capturing small but frequent price reversals  .
Scientific Basis for Bollinger Bands:
Bollinger Bands, developed by John Bollinger, are widely regarded in both academic literature and practical trading as an essential tool for volatility analysis and mean reversion strategies. Research has shown that Bollinger Bands effectively identify relative price highs and lows, and can be used to forecast price volatility and detect potential breakouts . Studies in financial markets, such as those by Fernández-Rodríguez et al. (2003), highlight the efficacy of Bollinger Bands in detecting overbought or oversold conditions in various assets .
Who is Kevin Davey?
Kevin Davey is an award-winning algorithmic trader and highly regarded expert in developing and optimizing systematic trading strategies. With over 25 years of experience, Davey gained significant recognition after winning the prestigious World Cup Trading Championships multiple times, where he achieved triple-digit returns with minimal drawdown. His success has made him a key figure in algorithmic trading education, with a focus on disciplined and rule-based trading systems.
Sentiment
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.
Parent Session Sweeps + Alert Killzone Ranges with Parent Session Sweep
Key Features:
1. Multiple Session Support: The script tracks three major trading sessions - Asia, London, and New York. Users can customize the timing of these sessions.
2. Killzone Visualization: The strategy visually represents each session's range, either as filled boxes or lines, allowing traders to easily identify key price levels.
3. Parent Session Logic: The core of the strategy revolves around identifying a "parent" session - a session that encompasses the range of the following session. This parent session becomes the basis for potential trade setups.
4. Sweep and Reclaim Setups: The strategy looks for price movements that sweep (break above or below) the parent session's high or low, followed by a reclaim of that level. This price action often indicates a potential reversal.
5. Risk-Reward Filtering: Each potential setup is evaluated based on a user-defined minimum risk-reward ratio, ensuring that only high-quality trade opportunities are considered.
6. Candle Close Filter: An optional filter that checks the characteristics of the candle that reclaims the parent session level, adding an extra layer of confirmation to the setup.
7. Performance Tracking: The strategy keeps track of bullish and bearish setup success rates, providing valuable feedback on its performance over time.
8. Visual Aids: The script draws lines to mark the parent session's high and low, making it easy for traders to identify key levels.
How It Works:
1. The script continuously monitors price action across the defined sessions.
2. When a session fully contains the range of the next session, it's identified as a potential parent session.
3. The strategy then waits for price to sweep either the high or low of this parent session.
4. If a sweep occurs, it looks for a reclaim of the swept level within the parameters set by the user.
5. If a valid setup is identified, the script generates an alert and places a trade (if backtesting or running live).
6. The strategy continues to monitor the trade for either reaching the target (opposite level of the parent session) or hitting the stop loss.
Considerations for Signals:
- Sweep: A break of the parent session's high or low.
- Reclaim: A close back inside the parent session range after a sweep.
- Candle Characteristics: Optional filter for the reclaim candle (e.g., bullish candle for long setups).
- Risk-Reward: Each setup must meet or exceed the user-defined minimum risk-reward ratio.
- Session Timing: The strategy is sensitive to the defined session times, which should be set according to the trader's preferred time zone.
This strategy aims to capitalize on institutional order flow and liquidity patterns in the forex market, providing traders with a systematic approach to identifying potential reversal points with favorable risk-reward profiles.
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.
Bitcoin CME-Spot Z-Spread - Strategy [presentTrading]This time is a swing trading strategy! It measures the sentiment of the Bitcoin market through the spread of CME Bitcoin Futures and Bitfinex BTCUSD Spot prices. By applying Bollinger Bands to the spread, the strategy seeks to capture mean-reversion opportunities when prices deviate significantly from their historical norms
█ Introduction and How it is Different
The Bitcoin CME-Spot Bollinger Bands Strategy is designed to capture mean-reversion opportunities by exploiting the spread between CME Bitcoin Futures and Bitfinex BTCUSD Spot prices. The strategy uses Bollinger Bands to detect when the spread between these two correlated assets has deviated significantly from its historical norm, signaling potential overbought or oversold conditions.
What sets this strategy apart is its focus on spread trading between futures and spot markets rather than price-based indicators. By applying Bollinger Bands to the spread rather than individual prices, the strategy identifies price inefficiencies across markets, allowing traders to take advantage of the natural reversion to the mean that often occurs in these correlated assets.
BTCUSD 8hr Performance
█ Strategy, How It Works: Detailed Explanation
The strategy relies on Bollinger Bands to assess the volatility and relative deviation of the spread between CME Bitcoin Futures and Bitfinex BTCUSD Spot prices. Bollinger Bands consist of a moving average and two standard deviation bands, which help measure how much the spread deviates from its historical mean.
🔶 Spread Calculation:
The spread is calculated by subtracting the Bitfinex spot price from the CME Bitcoin futures price:
Spread = CME Price - Bitfinex Price
This spread represents the difference between the futures and spot markets, which may widen or narrow based on supply and demand dynamics in each market. By analyzing the spread, the strategy can detect when prices are too far apart (potentially overbought or oversold), indicating a trading opportunity.
🔶 Bollinger Bands Calculation:
The Bollinger Bands for the spread are calculated using a simple moving average (SMA) and the standard deviation of the spread over a defined period.
1. Moving Average (SMA):
The simple moving average of the spread (mu_S) over a specified period P is calculated as:
mu_S = (1/P) * sum(S_i from i=1 to P)
Where S_i represents the spread at time i, and P is the lookback period (default is 200 bars). The moving average provides a baseline for the normal spread behavior.
2. Standard Deviation:
The standard deviation (sigma_S) of the spread is calculated to measure the volatility of the spread:
sigma_S = sqrt((1/P) * sum((S_i - mu_S)^2 from i=1 to P))
3. Upper and Lower Bollinger Bands:
The upper and lower Bollinger Bands are derived by adding and subtracting a multiple of the standard deviation from the moving average. The number of standard deviations is determined by a user-defined parameter k (default is 2.618).
- Upper Band:
Upper Band = mu_S + (k * sigma_S)
- Lower Band:
Lower Band = mu_S - (k * sigma_S)
These bands provide a dynamic range within which the spread typically fluctuates. When the spread moves outside of these bands, it is considered overbought or oversold, potentially offering trading opportunities.
Local view
🔶 Entry Conditions:
- Long Entry: A long position is triggered when the spread crosses below the lower Bollinger Band, indicating that the spread has become oversold and is likely to revert upward.
Spread < Lower Band
- Short Entry: A short position is triggered when the spread crosses above the upper Bollinger Band, indicating that the spread has become overbought and is likely to revert downward.
Spread > Upper Band
🔶 Risk Management and Profit-Taking:
The strategy incorporates multi-step take profits to lock in gains as the trade moves in favor. The position is gradually reduced at predefined profit levels, reducing risk while allowing part of the trade to continue running if the price keeps moving favorably.
Additionally, the strategy uses a hold period exit mechanism. If the trade does not hit any of the take-profit levels within a certain number of bars, the position is closed automatically to avoid excessive exposure to market risks.
█ Trade Direction
The trade direction is based on deviations of the spread from its historical norm:
- Long Trade: The strategy enters a long position when the spread crosses below the lower Bollinger Band, signaling an oversold condition where the spread is expected to narrow.
- Short Trade: The strategy enters a short position when the spread crosses above the upper Bollinger Band, signaling an overbought condition where the spread is expected to widen.
These entries rely on the assumption of mean reversion, where extreme deviations from the average spread are likely to revert over time.
█ Usage
The Bitcoin CME-Spot Bollinger Bands Strategy is ideal for traders looking to capitalize on price inefficiencies between Bitcoin futures and spot markets. It’s especially useful in volatile markets where large deviations between futures and spot prices occur.
- Market Conditions: This strategy is most effective in correlated markets, like CME futures and spot Bitcoin. Traders can adjust the Bollinger Bands period and standard deviation multiplier to suit different volatility regimes.
- Backtesting: Before deployment, backtesting the strategy across different market conditions and timeframes is recommended to ensure robustness. Adjust the take-profit steps and hold periods to reflect the trader’s risk tolerance and market behavior.
█ Default Settings
The default settings provide a balanced approach to spread trading using Bollinger Bands but can be adjusted depending on market conditions or personal trading preferences.
🔶 Bollinger Bands Period (200 bars):
This defines the number of bars used to calculate the moving average and standard deviation for the Bollinger Bands. A longer period smooths out short-term fluctuations and focuses on larger, more significant trends. Adjusting the period affects the responsiveness of the strategy:
- Shorter periods (e.g., 100 bars): Makes the strategy more reactive to short-term market fluctuations, potentially generating more signals but increasing the risk of false positives.
- Longer periods (e.g., 300 bars): Focuses on longer-term trends, reducing the frequency of trades and focusing only on significant deviations.
🔶 Standard Deviation Multiplier (2.618):
The multiplier controls how wide the Bollinger Bands are around the moving average. By default, the bands are set at 2.618 standard deviations away from the average, ensuring that only significant deviations trigger trades.
- Higher multipliers (e.g., 3.0): Require a more extreme deviation to trigger trades, reducing trade frequency but potentially increasing the accuracy of signals.
- Lower multipliers (e.g., 2.0): Make the bands narrower, increasing the number of trade signals but potentially decreasing their reliability.
🔶 Take-Profit Levels:
The strategy has four take-profit levels to gradually lock in profits:
- Level 1 (3%): 25% of the position is closed at a 3% profit.
- Level 2 (8%): 20% of the position is closed at an 8% profit.
- Level 3 (14%): 15% of the position is closed at a 14% profit.
- Level 4 (21%): 10% of the position is closed at a 21% profit.
Adjusting these take-profit levels affects how quickly profits are realized:
- Lower take-profit levels: Capture gains more quickly, reducing risk but potentially cutting off larger profits.
- Higher take-profit levels: Let trades run longer, aiming for bigger gains but increasing the risk of price reversals before profits are locked in.
🔶 Hold Days (20 bars):
The strategy automatically closes the position after 20 bars if none of the take-profit levels are hit. This feature prevents trades from being held indefinitely, especially if market conditions are stagnant. Adjusting this:
- Shorter hold periods: Reduce the duration of exposure, minimizing risks from market changes but potentially closing trades too early.
- Longer hold periods: Allow trades to stay open longer, increasing the chance for mean reversion but also increasing exposure to unfavorable market conditions.
By understanding how these default settings affect the strategy’s performance, traders can optimize the Bitcoin CME-Spot Bollinger Bands Strategy to their preferences, adapting it to different market environments and risk tolerances.
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 .
Connors VIX Reversal III invented by Dave LandryThis strategy is based on trading signals derived from the behavior of the Volatility Index (VIX) relative to its 10-day moving average. The rules are split into buying and selling conditions:
Buy Conditions:
The VIX low must be above its 10-day moving average.
The VIX must close at least 10% above its 10-day moving average.
If both conditions are met, a buy signal is generated at the market's close.
Sell Conditions:
The VIX high must be below its 10-day moving average.
The VIX must close at least 10% below its 10-day moving average.
If both conditions are met, a sell signal is generated at the market's close.
Exit Conditions:
For long positions, the strategy exits when the VIX trades intraday below its previous day’s 10-day moving average.
For short positions, the strategy exits when the VIX trades intraday above its previous day’s 10-day moving average.
This strategy is primarily a mean-reversion strategy, where the market is expected to revert to a more normal state after the VIX exhibits extreme behavior (i.e., large deviations from its moving average).
About Dave Landry
Dave Landry is a well-known figure in the world of trading, particularly in technical analysis. He is an author, trader, and educator, best known for his work on swing trading strategies. Landry focuses on trend-following and momentum-based techniques, teaching traders how to capitalize on shorter-term price swings in the market. He has written books like "Dave Landry on Swing Trading" and "The Layman's Guide to Trading Stocks," which emphasize practical, actionable trading strategies.
About Connors Research
Connors Research is a financial research firm known for its quantitative research in financial markets. Founded by Larry Connors, the firm specializes in developing high-probability trading systems based on historical market behavior. Connors’ work is widely respected for its data-driven approach, including systems like the RSI(2) strategy, which focuses on short-term mean reversion. The firm also provides trading education and tools for institutional and retail traders alike, emphasizing strategies that can be backtested and quantified.
Risks of the Strategy
While this strategy may appear to offer promising opportunities to exploit extreme VIX movements, it carries several risks:
Market Volatility: The VIX itself is a measure of market volatility, meaning the strategy can be exposed to sudden and unpredictable market swings. This can result in whipsaws, where positions are opened and closed in rapid succession due to sharp reversals in the VIX.
Overfitting: Strategies based on specific conditions like the VIX closing 10% above or below its moving average can be subject to overfitting, meaning they work well in historical tests but may underperform in live markets. This is a common issue in quantitative trading systems that are not adaptable to changing market conditions .
Mean-Reversion Assumption: The core assumption behind this strategy is that markets will revert to their mean after extreme movements. However, during periods of sustained trends (e.g., market crashes or rallies), this assumption may break down, leading to prolonged drawdowns.
Liquidity and Slippage: Depending on the asset being traded (e.g., S&P 500 futures, ETFs), liquidity issues or slippage could occur when executing trades at market close, particularly in volatile conditions. This could increase costs or worsen trade execution.
Scientific Explanation of the Strategy
The VIX is often referred to as the "fear gauge" because it measures the market's expectations of volatility based on options prices. Research has shown that the VIX tends to spike during periods of market stress and revert to lower levels when conditions stabilize . Mean reversion strategies like this one assume that extreme VIX levels are unsustainable in the long run, which aligns with findings from academic literature on volatility and market behavior.
Studies have found that the VIX is inversely correlated with stock market returns, meaning that higher VIX levels often correspond to lower stock prices and vice versa . By using the VIX’s relationship with its 10-day moving average, this strategy aims to capture reversals in market sentiment. The 10% threshold is designed to identify moments when the VIX is significantly deviating from its norm, signaling a potential reversal.
However, academic research also highlights the limitations of relying on the VIX alone for trading signals. The VIX does not predict market direction, only volatility, meaning that it cannot indicate the magnitude of price movements . Furthermore, extreme VIX levels can persist longer than expected, particularly during financial crises.
In conclusion, while the strategy is grounded in well-established financial principles (e.g., mean reversion and the relationship between volatility and market performance), it carries inherent risks and should be used with caution. Backtesting and careful risk management are essential before applying this strategy in live markets.
TRIN (Arms Index) Trading StrategyThe TRIN (Arms Index), also known as the Short-Term Trading Index, is a technical indicator designed to gauge the internal strength or weakness of the market. It compares the number of advancing and declining stocks to the advancing and declining volume (AD Volume). A TRIN value above 1.0 generally indicates bearish market conditions, while a value below 1.0 suggests bullish market sentiment.
Strategy Rules:
Entry Condition (Long Position): When the TRIN value is above 1.0, the strategy enters a long position, indicating that the market may be oversold, and a potential reversal could occur.
Exit Condition: The strategy exits the long position when the closing price is higher than the previous day’s high, signaling a potential rebound in the market.
This strategy aims to capitalize on short-term market inefficiencies by entering trades during periods of potential market weakness and exiting when signs of recovery appear.
How the TRIN Index Works:
The TRIN is calculated as follows:
TRIN=Advancing Issues / Declining IssuesAdvancing Volume / Declining Volume
TRIN=Advancing Volume / Declining VolumeAdvancing Issues / Declining Issues
A TRIN value above 1.0 indicates that the market is potentially oversold (more declining stocks with higher volume), while a value below 1.0 suggests the market may be overbought (more advancing stocks with higher volume) .
Empirical Evidence:
Market Sentiment Indicator: The TRIN has been widely used as a sentiment indicator. Research by Zweig (1997) suggests that extreme TRIN values can serve as a contrarian signal, indicating potential turning points in the market. For instance, a TRIN above 2.0 is often considered a sign of panic selling, which can precede a market bottom .
Overbought/Oversold Conditions: Studies have shown that indicators like TRIN, which measure market breadth and volume, can be effective in identifying overbought and oversold conditions. According to Fama and French (1988), market sentiment indicators that consider both price and volume data can offer insights into future price movements .
Risks and Limitations:
False Signals:
One of the primary risks of using the TRIN-based strategy is the possibility of false signals. A TRIN value above 1.0 does not always guarantee a market rebound, especially in sustained bearish trends. In such cases, the strategy might enter long positions prematurely, leading to losses.
Research by Brock, Lakonishok, and LeBaron (1992) found that while market indicators like TRIN can be useful, they are not foolproof and can generate multiple false positives, particularly in volatile markets .
Market Regimes:
The effectiveness of the TRIN index can vary depending on the market regime. In strongly trending markets, either bullish or bearish, the TRIN may not provide reliable reversal signals, and relying on it could result in trades that go against the prevailing trend. For instance, during strong bear markets, the TRIN may frequently remain above 1.0, leading to multiple losing trades as the market continues to decline.
Short-Term Focus:
The TRIN strategy is inherently short-term focused, aiming to capture quick market reversals. This makes it sensitive to market noise and less effective for longer-term investors. Moreover, short-term trading strategies often require more frequent adjustments and can incur higher transaction costs, which may erode profitability over time.
Liquidity and Execution Risk:
Since the TRIN strategy requires entering and exiting trades based on short-term market movements, it is vulnerable to liquidity and execution risks. In fast-moving markets, the execution of trades may be delayed, leading to slippage and potentially unfavorable entry or exit points.
Conclusion:
The TRIN (Arms Index) Trading Strategy can be an effective tool for traders looking to capitalize on short-term market inefficiencies and potential reversals. However, it is important to recognize the risks associated with this strategy, including false signals, sensitivity to market regimes, and execution risks. Traders should employ proper risk management techniques and consider combining the TRIN with other indicators to improve the robustness of the strategy.
While the TRIN provides valuable insights into market sentiment, it is not a standalone solution and should be used in conjunction with a broader trading plan that takes into account both technical and fundamental analysis.
References:
Arms, Richard W. "Volume Adjusted Moving Averages." Technical Analysis of Stocks & Commodities, 1993.
Zweig, Martin. Winning on Wall Street. Warner Books, 1997.
Fama, Eugene F., and Kenneth R. French. "Permanent and Temporary Components of Stock Prices." Journal of Political Economy, 1988.
Brock, William, Josef Lakonishok, and Blake LeBaron. "Simple Technical Trading Rules and the Stochastic Properties of Stock Returns." Journal of Finance, 1992.
Economic Policy Uncertainty StrategyThis Pine Script strategy is designed to make trading decisions based on the Economic Policy Uncertainty Index for the United States (USEPUINDXD) using a Simple Moving Average (SMA) and a dynamic threshold. The strategy identifies opportunities by entering long positions when the SMA of the Economic Policy Uncertainty Index crosses above a user-defined threshold. An exit is triggered after a set number of bars have passed since the trade was opened. Additionally, the background is highlighted in green when a position is open to visually indicate active trades.
This strategy is intended to be used in portfolio management and trading systems where economic policy uncertainty plays a critical role in decision-making. The index provides insight into macroeconomic conditions, which can affect asset prices and investment returns.
The Economic Policy Uncertainty (EPU) Index is a significant metric used to gauge uncertainty related to economic policies in the United States. This index reflects the frequency of newspaper articles discussing economic uncertainty, government policies, and their potential impact on the economy. It has become a popular indicator for both academics and practitioners to analyze the effects of policy uncertainty on various economic and financial outcomes.
Importance of the EPU Index for Portfolio Decisions:
Economic Policy Uncertainty and Investment Decisions:
Research by Baker, Bloom, and Davis (2016) introduced the Economic Policy Uncertainty Index and explored how increased uncertainty leads to delays in investment and hiring decisions. Their study shows that heightened uncertainty, as captured by the EPU index, is associated with a contraction in economic activity and lower stock market returns. Investors tend to shift their portfolios towards safer assets during periods of high policy uncertainty .
Impact on Asset Prices:
Gulen and Ion (2016) demonstrated that policy uncertainty adversely affects corporate investment, leading to lower stock market returns. The study emphasized that firms reduce investment during periods of high policy uncertainty, which can significantly impact the pricing of risky assets. Consequently, portfolio managers need to account for policy uncertainty when making asset allocation decisions .
Global Implications:
Policy uncertainty is not only a domestic issue. Brogaard and Detzel (2015) found that U.S. economic policy uncertainty has significant spillover effects on global financial markets, affecting equity returns, bond yields, and foreign exchange rates. This suggests that global investors should incorporate U.S. policy uncertainty into their risk management strategies .
These studies underscore the importance of the Economic Policy Uncertainty Index as a tool for understanding macroeconomic risks and making informed portfolio management decisions. Strategies that incorporate the EPU index, such as the one described above, can help investors navigate periods of uncertainty by adjusting their exposure to different asset classes based on economic conditions.
Proxy Financial Stress Index StrategyThis strategy is based on a Proxy Financial Stress Index constructed using several key financial indicators. The strategy goes long when the financial stress index crosses below a user-defined threshold, signaling a potential reduction in market stress. Once a position is opened, it is held for a predetermined number of bars (periods), after which it is automatically closed.
The financial stress index is composed of several normalized indicators, each representing different market aspects:
VIX - Market volatility.
US 10-Year Treasury Yield - Bond market.
Dollar Index (DXY) - Currency market.
S&P 500 Index - Stock market.
EUR/USD - Currency exchange rate.
High-Yield Corporate Bond ETF (HYG) - Corporate bond market.
Each component is normalized using a Z-score (based on the user-defined moving average and standard deviation lengths) and weighted according to user inputs. The aggregated index reflects overall market stress.
The strategy enters a long position when the stress index crosses below a specified threshold from above, indicating reduced financial stress. The position is held for a defined holding period before being closed automatically.
Scientific References:
The concept of a financial stress index is derived from research that combines multiple financial variables to measure systemic risks in the financial markets. Key research includes:
The Financial Stress Index developed by various Federal Reserve banks, including the Cleveland Financial Stress Index (CFSI)
Bank of America Merrill Lynch Option Volatility Estimate (MOVE) Index as a measure of interest rate volatility, which correlates with financial stress
These indices are widely used in economic research to gauge financial instability and help in policy decisions. They track real-time fluctuations in various markets and are often used to anticipate economic downturns or periods of high financial risk.
Breadth Thrust Strategy with Volatility Stop-LossThe "Breadth Thrust Strategy with Volatility Stop-Loss" is a trading strategy designed to capitalize on market momentum while managing risk through volatility-based stop-losses. Here's a detailed breakdown of the strategy:
Strategy Overview:
Market Breadth Analysis: The strategy uses the "Breadth Thrust Indicator," which evaluates market momentum by calculating the ratio of advancing stocks to the total number of stocks on the New York Stock Exchange (NYSE). This indicator helps identify bullish market conditions. An optional feature allows for the inclusion of volume data in this calculation, enhancing the signal's robustness.
Signal Generation: A long position is triggered when the smoothed breadth ratio (or the combined breadth and volume ratio) crosses above a specified low threshold (e.g., 0.4). This crossover indicates a potential shift towards positive market momentum.
Key Parameters:
Smoothing Length (length): Defines the period over which the breadth or combined ratio is smoothed using a simple moving average (SMA) to reduce noise and highlight the underlying trend.
Low Threshold (threshold_low): The level below which the smoothed ratio must fall before crossing back above to trigger a long signal.
Hold Periods (hold_periods): The minimum number of periods for which the position will be held once entered, ensuring the strategy captures a meaningful move.
Volatility Multiplier (volatility_multiplier): A multiplier applied to the Average True Range (ATR) to determine the distance of the stop-loss from the entry price, which adjusts according to market volatility.
Trade Management:
Entry Signal: The strategy enters a long position when the smoothed combined ratio crosses above the low threshold, signaling a potential bullish reversal.
ATR-Based Stop-Loss: Upon entering a trade, the strategy calculates a stop-loss level based on the ATR, which measures market volatility. The stop-loss is set at a distance from the entry price, determined by multiplying the ATR by the specified volatility multiplier. This adaptive stop-loss mechanism helps protect the position from adverse market moves.
Stop-Loss Adjustment: While the position is open, the stop-loss level is dynamically updated, ensuring it never decreases (trailing stop-loss effect) but can be adjusted upwards to reflect the latest price action relative to volatility.
Position Closure: The position is closed if:
The market price falls to or below the stop-loss level.
The position has been held for the specified number of periods (hold_periods), after which it is automatically closed.
Additional Settings:
Initial Capital: The strategy starts with an initial capital of $10,000.
Commissions and Slippage: Each trade incurs a commission of $5 per order, and slippage is accounted for at $1 per trade.
Background Highlighting: The chart background turns green when a position is open, providing a clear visual indication of the active trade.
This strategy is designed to identify and capitalize on upward momentum in the market while employing a volatility-adjusted stop-loss to manage risk. By combining market breadth analysis with volatility-based stop-losses, the strategy aims to balance profit potential with protection against sudden market reversals.
RSI Strategy with Adjustable RSI and Stop-LossThis trading strategy uses the Relative Strength Index (RSI) and a Stop-Loss mechanism to make trading decisions. Here’s a breakdown of how it works:
RSI Calculation:
The RSI is calculated based on the user-defined length (rsi_length). This is a momentum oscillator that measures the speed and change of price movements.
Buy Condition:
The strategy generates a buy signal when the RSI value is below a user-defined threshold (rsi_threshold). This condition indicates that the asset might be oversold and potentially due for a rebound.
Stop-Loss Mechanism:
Upon triggering a buy signal, the strategy calculates the Stop-Loss level. The Stop-Loss level is set to a percentage below the entry price, as specified by the user (stop_loss_percent). This level is used to limit potential losses if the price moves against the trade.
Sell Condition:
A sell signal is generated when the current closing price is higher than the highest high of the previous day. This condition suggests that the price has reached a new high, and the strategy decides to exit the trade.
Plotting:
The RSI values are plotted on the chart for visual reference. A horizontal line is drawn at the RSI threshold level to help visualize the oversold condition.
Summary
Buying Strategy: When RSI is below the specified threshold, indicating potential oversold conditions.
Stop-Loss: Set based on a percentage of the entry price to limit potential losses.
Selling Strategy: When the price surpasses the highest high of the previous day, signaling a potential exit point.
This strategy aims to capture potential rebounds from oversold conditions and manage risk using a Stop-Loss mechanism. As with any trading strategy, it’s essential to test and optimize it under various market conditions to ensure its effectiveness.
Bitcoin Futures vs. Spot Tri-Frame - Strategy [presentTrading]Prove idea with a backtest is always true for trading.
I developed and open-sourced it as an educational material for crypto traders to understand that the futures and spot spread may be effective but not be as effective as they might think. It serves as an indicator of sentiment rather than a reliable predictor of market trends over certain periods. It is better suited for specific trading environments, which require further research.
█ Introduction and How it is Different
The "Bitcoin Futures vs. Spot Tri-Frame Strategy" utilizes three different timeframes to calculate the Z-Score of the spread between BTC futures and spot prices on Binance and OKX exchanges. The strategy executes long or short trades based on composite Z-Score conditions across the three timeframes.
The spread refers to the difference in price between BTC futures and BTC spot prices, calculated by taking a weighted average of futures prices from multiple exchanges (Binance and OKX) and subtracting a weighted average of spot prices from the same exchanges.
BTCUSD 1D L/S Performance
█ Strategy, How It Works: Detailed Explanation
🔶 Calculation of the Spread
The spread is the difference in price between BTC futures and BTC spot prices. The strategy calculates the spread by taking a weighted average of futures prices from multiple exchanges (Binance and OKX) and subtracting a weighted average of spot prices from the same exchanges. This spread serves as the primary metric for identifying trading opportunities.
Spread = Weighted Average Futures Price - Weighted Average Spot Price
🔶 Z-Score Calculation
The Z-Score measures how many standard deviations the current spread is from its historical mean. This is calculated for each timeframe as follows:
Spread Mean_tf = SMA(Spread_tf, longTermSMA)
Spread StdDev_tf = STDEV(Spread_tf, longTermSMA)
Z-Score_tf = (Spread_tf - Spread Mean_tf) / Spread StdDev_tf
Local performance
🔶 Composite Entry Conditions
The strategy triggers long and short entries based on composite Z-Score conditions across all three timeframes:
- Long Condition: All three Z-Scores must be greater than the long entry threshold.
Long Condition = (Z-Score_tf1 > zScoreLongEntryThreshold) and (Z-Score_tf2 > zScoreLongEntryThreshold) and (Z-Score_tf3 > zScoreLongEntryThreshold)
- Short Condition: All three Z-Scores must be less than the short entry threshold.
Short Condition = (Z-Score_tf1 < zScoreShortEntryThreshold) and (Z-Score_tf2 < zScoreShortEntryThreshold) and (Z-Score_tf3 < zScoreShortEntryThreshold)
█ Trade Direction
The strategy allows the user to specify the trading direction:
- Long: Only long trades are executed.
- Short: Only short trades are executed.
- Both: Both long and short trades are executed based on the Z-Score conditions.
█ Usage
The strategy can be applied to BTC or Crypto trading on major exchanges like Binance and OKX. By leveraging discrepancies between futures and spot prices, traders can exploit market inefficiencies. This strategy is suitable for traders who prefer a statistical approach and want to diversify their timeframes to validate signals.
█ Default Settings
- Input TF 1 (60 minutes): Sets the first timeframe for Z-Score calculation.
- Input TF 2 (120 minutes): Sets the second timeframe for Z-Score calculation.
- Input TF 3 (180 minutes): Sets the third timeframe for Z-Score calculation.
- Long Entry Z-Score Threshold (3): Defines the threshold above which a long trade is triggered.
- Short Entry Z-Score Threshold (-3): Defines the threshold below which a short trade is triggered.
- Long-Term SMA Period (100): The period used to calculate the simple moving average for the spread.
- Use Hold Days (true): Enables holding trades for a specified number of days.
- Hold Days (5): Number of days to hold the trade before exiting.
- TPSL Condition (None): Defines the conditions for taking profit and stop loss.
- Take Profit (%) (30.0): The percentage at which the trade will take profit.
- Stop Loss (%) (20.0): The percentage at which the trade will stop loss.
By fine-tuning these settings, traders can optimize the strategy to suit their risk tolerance and trading style, enhancing overall performance.
HilalimSB Strategy HilalimSB A Wedding Gift 🌙
What is HilalimSB🌙?
First of all, as mentioned in the title, HilalimSB is a wedding gift.
HilalimSB - Revealing the Secrets of the Trend
HilalimSB is a powerful indicator designed to help investors analyze market trends and optimize trading strategies. Designed to uncover the secrets at the heart of the trend, HilalimSB stands out with its unique features and impressive algorithm.
Hilalim Algorithm and Fixed ATR Value:
HilalimSB is equipped with a special algorithm called "Hilalim" to detect market trends. This algorithm can delve into the depths of price movements to determine the direction of the trend and provide users with the ability to predict future price movements. Additionally, HilalimSB uses its own fixed Average True Range (ATR) value. ATR is an indicator that measures price movement volatility and is often used to determine the strength of a trend. The fixed ATR value of HilalimSB has been tested over long periods and its reliability has been proven. This allows users to interpret the signals provided by the indicator more reliably.
ATR Calculation Steps
1.True Range Calculation:
+ The True Range (TR) is the greatest of the following three values:
1. Current high minus current low
2. Current high minus previous close (absolute value)
3. Current low minus previous close (absolute value)
2.Average True Range (ATR) Calculation:
-The initial ATR value is calculated as the average of the TR values over a specified period
(typically 14 periods).
-For subsequent periods, the ATR is calculated using the following formula:
ATRt=(ATRt−1×(n−1)+TRt)/n
Where:
+ ATRt is the ATR for the current period,
+ ATRt−1 is the ATR for the previous period,
+ TRt is the True Range for the current period,
+ n is the number of periods.
Pine Script to Calculate ATR with User-Defined Length and Multiplier
Here is the Pine Script code for calculating the ATR with user-defined X length and Y multiplier:
//@version=5
indicator("Custom ATR", overlay=false)
// User-defined inputs
X = input.int(14, minval=1, title="ATR Period (X)")
Y = input.float(1.0, title="ATR Multiplier (Y)")
// True Range calculation
TR1 = high - low
TR2 = math.abs(high - close )
TR3 = math.abs(low - close )
TR = math.max(TR1, math.max(TR2, TR3))
// ATR calculation
ATR = ta.rma(TR, X)
// Apply multiplier
customATR = ATR * Y
// Plot the ATR value
plot(customATR, title="Custom ATR", color=color.blue, linewidth=2)
This code can be added as a new Pine Script indicator in TradingView, allowing users to calculate and display the ATR on the chart according to their specified parameters.
HilalimSB's Distinction from Other ATR Indicators
HilalimSB emerges with its unique Average True Range (ATR) value, presenting itself to users. Equipped with a proprietary ATR algorithm, this indicator is released in a non-editable form for users. After meticulous testing across various instruments with predetermined period and multiplier values, it is made available for use.
ATR is acknowledged as a critical calculation tool in the financial sector. The ATR calculation process of HilalimSB is conducted as a result of various research efforts and concrete data-based computations. Therefore, the HilalimSB indicator is published with its proprietary ATR values, unavailable for modification.
The ATR period and multiplier values provided by HilalimSB constitute the fundamental logic of a trading strategy. This unique feature aids investors in making informed decisions.
Visual Aesthetics and Clear Charts:
HilalimSB provides a user-friendly interface with clear and impressive graphics. Trend changes are highlighted with vibrant colors and are visually easy to understand. You can choose colors based on eye comfort, allowing you to personalize your trading screen for a more enjoyable experience. While offering a flexible approach tailored to users' needs, HilalimSB also promises an aesthetic and professional experience.
Strong Signals and Buy/Sell Indicators:
After completing test operations, HilalimSB produces data at various time intervals. However, we would like to emphasize to users that based on our studies, it provides the best signals in 1-hour chart data. HilalimSB produces strong signals to identify trend reversals. Buy or sell points are clearly indicated, allowing users to develop and implement trading strategies based on these signals.
For example, let's imagine you wanted to open a position on BTC on 2023.11.02. You are aware that you need to calculate which of the buying or selling transactions would be more profitable. You need support from various indicators to open a position. Based on the analysis and calculations it has made from the data it contains, HilalimSB would have detected that the graph is more suitable for a selling position, and by producing a sell signal at the most ideal selling point at 08:00 on 2023.11.02 (UTC+3 Istanbul), it would have informed you of the direction the graph would follow, allowing you to benefit positively from a 2.56% decline.
Technology and Innovation:
HilalimSB aims to enhance the trading experience using the latest technology. With its innovative approach, it enables users to discover market opportunities and support their decisions. Thus, investors can make more informed and successful trades. Real-Time Data Analysis: HilalimSB analyzes market data in real-time and identifies updated trends instantly. This allows users to make more informed trading decisions by staying informed of the latest market developments. Continuous Update and Improvement: HilalimSB is constantly updated and improved. New features are added and existing ones are enhanced based on user feedback and market changes. Thus, HilalimSB always aims to provide the latest technology and the best user experience.
Social Order and Intrinsic Motivation:
Negative trends such as widespread illegal gambling and uncontrolled risk-taking can have adverse financial effects on society. The primary goal of HilalimSB is to counteract these negative trends by guiding and encouraging users with data-driven analysis and calculable investment systems. This allows investors to trade more consciously and safely.
What is HilalimSB Strategy🌙?
HilalimSB Strategy is a strategy that is supported by the HilalimSB algorithm created by the creator of HilalimSB and continues transactions with take profit and stop loss levels determined by users who strategically and automatically open transactions as a result of the data it receives and automatically closes transactions under necessary conditions. It is a first in the tradingview world with its unique take profit and stop loss markings. HilalimSB Strategy is open to users' initiatives and is a trading strategy developed on BTC.
What does the HilalimSB Strategy target?
The main purpose of HilalimSB Strategy is to reduce the transaction load of traders and to be integrated into various brokerage firms and operated by automatic trading bots, and it is aimed to serve this purpose. In addition to the strategies currently available in the markets, HilalimSB Strategy offers a useful infrastructure to traders with its useful interface. HilalimSB Strategy, which was decided to be published as a result of various calculations, was offered to the users with its unique visual effects after the completion of the testing procedures under market conditions.
HilalimSB Strategy and Heikin Ashi
HilalimSB Strategy produces data in Heikin Ashi chart types, but since Heikin Ashi chart types have their own calculation method, HilalimSB Strategy has been published in a way that cannot produce data in this chart type due to HilalimSB Strategy's ideology of appealing to all types of users, and any confusion that may arise is prevented in this way.
After the necessary conditions determined by the creator of HilalimSB are met, HilalimSB Heikin Ashi will be shared exclusively with invited users only, upon request, to users who request an invitation.
Differences between HilalimSB Strategy and HilalimSB
HilalimSB Strategy has been shared as a strategy and its features have been explained above. HilalimSB is a trading indicator and this is the main difference between them.We can explain it briefly this way.
Here are the differences between indicators and strategies:
1.Purpose and Use:
Indicators: Analyze market data to provide information about price movements and trends. They typically generate buy and sell signals and give traders clues about when to make trades in the market.
Strategies: These are plans for trading based on specific rules. They use signals from indicators and other market data to execute buy and sell transactions.
2.Features:
Indicators: Operate independently and are based on specific mathematical formulas. Examples include moving averages, RSI, and MACD.
Strategies: Combine one or more indicators and other market analysis tools to create a comprehensive trading plan. This plan determines entry and exit points, risk management, and trade size.
3.Scope:
Indicators: Are single analysis tools focusing on specific time frames or price movements.
Strategies: Are comprehensive trading plans that typically involve multiple trades over a certain period.
4.Decision Making:
Indicators: Provide information to traders and help in the decision-making process.
Strategies: Are direct decision-making mechanisms that execute trades automatically according to predetermined rules.
5.Automation:
Indicators: Are mostly interpreted manually and used based on the trader’s discretion.
Strategies: Can be used in automated trading systems and execute trades automatically according to the set rules.
The shared image is a 1-hour chart of BTCUSDC.P determined by the user as 1 percent take profit and 1 percent stop loss. And transactions were opened on Binance with the commission rate determined as 0.017 for the USDC trading pair.
HilalimSB Strategy, which presents users with completely concrete data, has proven itself in testing processes and is a project of SB that aims to reach all user profiles.🌙
Adaptive RSI StrategyThe Adaptive RSI Strategy is designed to give you an edge by adapting to changing market conditions more effectively than the traditional RSI. By adjusting dynamically to recent price movements, this strategy aims to provide more timely and accurate trade signals.
How Does It Work?
You can set the number of periods for the RSI calculation. The default is 14, but feel free to experiment with different lengths to suit your trading style.
Choose the price data to base the RSI on, typically the closing price.
Decide if you want the strategy to visually highlight upward and downward movements of the Adaptive RSI (ARSI) on the chart. This can help you quickly spot trends.
Adaptive Calculation:
Alpha: The strategy uses an adaptive factor called alpha, which changes based on recent RSI values. This makes the RSI more sensitive to recent market conditions.
Adaptive RSI (ARSI): This is the core of our strategy. It calculates the ARSI using the adaptive alpha, making it more responsive to price changes compared to the traditional RSI.
Trade Signals:
Long Entry (Buy Signal): The strategy triggers a buy signal when the ARSI value crosses above its previous value. This indicates a potential upward trend, suggesting it's a good time to enter a long position.
Short Entry (Sell Signal): Conversely, a sell signal is triggered when the ARSI value crosses below its previous value, indicating a potential downward trend and suggesting it's a good time to enter a short position.
Visual Representation:
If you enable the highlight movements feature, the ARSI line on the chart will change color: green for upward movements and red for downward movements. This makes it easier to see potential trade opportunities at a glance.
Why Use the Adaptive RSI Strategy?
Responsiveness: The adaptive nature of this strategy means it's more sensitive to market changes, helping you react quicker to new trends.
Customization: You can tailor the length of the RSI period and decide whether to highlight movements, allowing you to adapt the strategy to your specific needs and preferences.
Visual Clarity: Highlighting the ARSI movements on the chart makes it easier to spot trends and potential entry points, giving you a clearer picture of the market.
Dual RSI Differential - Strategy [presentTrading]█ Introduction and How it is Different
The Dual RSI Differential Strategy introduces a nuanced approach to market analysis and trading decisions by utilizing two Relative Strength Index (RSI) indicators calculated over different time periods. Unlike traditional strategies that employ a single RSI and may signal premature or delayed entries, this method leverages the differential between a shorter and a longer RSI. This approach pinpoints more precise entry and exit points, providing a refined tool for traders to exploit market conditions effectively, particularly in overbought and oversold scenarios.
Most important: it is a good eductional code for swing trading.
For beginners, this Pine Script provides a complete function that includes crucial elements such as holding days and the option to configure take profit/stop loss settings:
- Hold Days: This feature ensures that trades are not exited too hastily, helping traders to ride out short-term market volatility. It's particularly valuable for swing trading where maintaining positions slightly longer can lead to capturing significant trends.
- TPSL Condition (None by default): This setting allows traders to focus solely on the strategy's robust entry and exit signals without being constrained by preset profit or loss limits. This flexibility is crucial for learning to adjust strategy settings based on personal risk tolerance and market observations.
BTCUSD 6h LS Performance
█ Strategy, How It Works: Detailed Explanation
🔶 RSI Calculation:
The RSI is a momentum oscillator that measures the speed and change of price movements. It is calculated using the formula:
RSI = 100 - (100 / (1 + RS))
Where RS (Relative Strength) = Average Gain of up periods / Average Loss of down periods.
🔶 Dual RSI Setup:
This strategy involves two RSI indicators:
RSI_Short (RSI_21): Calculated over a short period (21 days).
RSI_Long (RSI_42): Calculated over a longer period (42 days).
Differential Calculation:
The strategy focuses on the differential between these two RSIs:
RSI Differential = RSI_Long - RSI_Short
This differential helps to identify when the shorter-term sentiment diverges from longer-term trends, signaling potential trading opportunities.
BTCUSD Local picuture
🔶 Signal Triggers:
Entry Signal: A buy (long) signal is triggered when the RSI Differential exceeds -5, suggesting strengthening short-term momentum. Conversely, a sell (short) signal occurs when the RSI Differential falls below +5, indicating weakening short-term momentum.
Exit Signal: Trades are generally exited when the RSI Differential reverses past these thresholds, indicating a potential momentum shift.
█ Trade Direction
This strategy accommodates various trading preferences by allowing selections among long, short, or both directions, thus enabling traders to capitalize on diverse market movements and volatility.
█ Usage
The Dual RSI Differential Strategy is particularly suited for:
Traders who prefer a systematic approach to capture market trends.
Those who seek to minimize risks associated with rapid and unexpected market movements.
Traders who value strategies that can be finely tuned to different market conditions.
█ Default Settings
- Trading Direction: Both — allows capturing of upward and downward market movements.
- Short RSI Period: 21 days — balances sensitivity to market movements.
- Long RSI Period: 42 days — smoothens out longer-term fluctuations to provide a clearer market trend.
- RSI Difference Level: 5 — minimizes false signals by setting a moderate threshold for action.
Use Hold Days: True — introduces a temporal element to trading strategy, holding positions to potentially enhance outcomes.
- Hold Days: 5 — ensures that trades are not exited too hastily, helping to ride out short-term volatility.
- TPSL Condition: None — enables traders to focus solely on the strategy's entry and exit signals without preset profit or loss limits.
- Take Profit Percentage: 15% — aims for significant market moves to lock in profits.
- Stop Loss Percentage: 10% — safeguards against large losses, essential for long-term capital preservation.
[Support and Resistance with Trend Lines] with Backtest (TSO) with Backtest (TSO)
===========================================================================
===========================================================================
This indicator serves as a comprehensive full-cycle trading system, providing alerts at each stage of the trade, from opening to closure. The algorithm uses most recent and historical S&R (Support and Resistance) levels with most recent and historical Trend Lines, generating signals for trades when Breaks/Bounces occur (Trade Open Signal triggers can be configured via very customizable indicator Input "Signal Trigger Matrix" settings). With signal for trade open, TP (Take Profit and SL (Stop Loss) levels are calculated as well and marked on the chart including alerts for each action of the trade. The indicator offers a variety of automated approaches for TP (Take-Profit) and SL (Stop-Loss) settings. These include static current/historical S&R (Support and Resistance) levels or S&R/Trend Lines dynamic breaks for TP (Take-Profit) and various SL (Stop-Loss) approaches, including ATR Trailing SL, opposite S&R (Support and Resistance) levels SL, opposite Trend Lines SL and more. This diverse set of tools ensure flexibility in tailoring TP (Take-Profit) and SL (Stop-Loss) parameters to different market conditions, contributing to a more adaptive and robust trading system. Additionally, a series of signal analysis tools, including market sentiment, candle bar analysis, divergence, and volume, enhance the precision of trading signals.
* Works with popular timeframes: 1M, 3M, 5M, 15M, 30M, 45M, 1H.
* Works well with Futures and Indices, can be used to trade Stocks, Crypto and FOREX.
* Includes LIVE alert/labels Breakouts and Bounces signal trigger feature, which can be used for scalping (NOTE: This approach cannot be backtested).
* Every action of the trade is calculated on a confirmed closed candle bar state (barstate.isconfirmed), so the indicator will never repaint.
==============================================================
Indicator examples:
---------------------------------------------------------------------------
Strategy Config: SRTL_MES_15M3Y_EODoff_ALL
Here is a nice example of MES (Micro E-Mini S&P 500 Index Futures) configuration, which uses S&R (Support and Resistance) breakouts as signal trigger with Elliot Wave confirmation and previous S&R historical levels for TP (Take-Profit).
---------------------------------------------------------------------------
An example of an intraday Tesla trade. Also the green arrows will be displayed IMMEDIATELY when Breakout/Reverse Bounce occurs (same an Alert will be triggered immediately).
===========================================================================
Trading open/close/TP/SL labels, plots and colors explanations:
---------------------------------------------------------------------------
>>> S&R (Support and Resistance) levels/lines: orange - support, blue - resistance (can be hidden).
>>> Trend Lines: yellow - support, green - resistance (can be hidden).
>>> Blue labels show resistance breakouts and bounces, light-blue - bullish, dark-blue - bearish
>>> Yellow labels show resistance breakouts and bounces, light-yellow - bullish, dark-yellow - bearish
>>> Green/Red arrows on top/bottom of candle bar will show LIVE breakouts (if turned on)
>>>>> LONG open: green "house" looking arrow below candle bar.
>>>>> SHORT open: red "house" looking arrow above candle bar.
>>>>> LONG/SHORT take-profit target: green/red circles (multi-profit > TP2/3/4/5 smaller circles).
>>>>> LONG/SHORT stop-loss target: green/red + crosses.
>>>>> LONG/SHORT take-profit hits: green/red diamonds.
>>>>> LONG/SHORT stop-loss hits: green/red X-crosses.
>>>>> LONG/SHORT EOD (End of Day | Intraday style) close (profitable trade): green/red squares.
>>>>> LONG/SHORT EOD (End of Day | Intraday style) close (loss trade): green/red PLUS(+)-crosses.
===========================================================================
STATS TABLE ///////////////////////////////////////////////////////////////
---------------------------------------------------------------------------
>>> Trading STATS table on the chart showing current trade direction, Last TP (Take-Profit) Taken, Current Trade PL (profit/loss in price difference from trade open to the very current state).
---------------------------------------------------------------------------
CUSTOM TRADING DATE RANGE /////////////////////////////////////////////////
---------------------------------------------------------------------------
>>>>> This feature can be used to manually set indicator trading range from and to a specific date and time. NOTE: This is not intended for a very long date range backtesting, utilize TradingView Strategy Tester for that.
* Use TradingView “Strategy Tester” to see Backtesting results
NOTE: If Strategy Tester does not show any results with Date Ranged fully unchecked, there may be an issue where a script opens a trade, but there is not enough TradingView power to set the Take-Profit and Stop-Loss and somehow an open trade gets stuck and never closes, so there are “no trades present”. In such case - manually check “Start”/“End” dates or use “Deep Backtesting” feature!
---------------------------------------------------------------------------
INTRADAY ACTIVE TRADING SESSION CONFIGURATION /////////////////////////////
---------------------------------------------------------------------------
>>> Regional Active Trading Session Hours Schedule: If selected - trades will only open during regional active trading session, if 'OFF', there will be no trading schedule and trades will open 24/7.
>>> EOD(End of Day) Close - On/Off: Close the trade if it's still open at the end of active trading session (on the very last candle bar). NOTE: If no region is selected at 'Regional Active Trading Session Schedule' - there will be no EOD(End of Day) Close and trades will run overnight until either SL(Stop-Loss) or TP(Take-Profit) is hit!
>>>>> EOD(End of Day) Close - 1 candle bar before last: This is specifically for stocks as while usually indices can be closed 15minutes after the market closes, for stocks - the last candle bar closes at the same time with the market active trading session, which if closed - trades can't be closed until next day/session! Enable this setting for the trade to close/alert 1 candle bar before the last one, so there is still time to close the trade at the Broker (NOTE: depending on the timeframe, 1 candle bar can be: 15sec, 30sec, 1min, 3min, 5min, 15min, 30min, 45min, 1h).
---------------------------------------------------------------------------
SIGNAL TRIGGER MATRIX ////////////////////////////////////////////////
---------------------------------------------------------------------------
>>> Trading Engine: This setting turns on TradingView Strategy trading engine for backtesting.
>>> Market Session Only: With this setting turned on, all signal trigger Breaks/Bounces will be hidden during Pre/Post market time.
>>> Plot S&R Levels/Lines: Plot S&R (Support and Resistance) on chart. Note: historical levels/lines will only be plotted if hit (Break/Bounce).
>>> Plot Trend Lines Levels/Lines: Plot Trend Lines levels/lines on chart. Note: historical levels/lines will only be plotted if hit (Break/Bounce).
>>> Use S&R Current Levels | Use S&R Historical Levels | Use Trend Lines Current Levels | Use Trend Lines Historical Levels |: Choose which levels should be used for Breaks/Bounces to be captured on. If all triggers are turned on/checked - whatever happens 1st wins the trigger.
>>> Breaks | Bounces: 'Breaks': Turn on Breaks through levels/lines signal trigger. | 'Bounces': Turn on Bounces off levels/lines signal trigger.
>>> Signal: Regular | Signal: S&R Combo | Signal: TL Combo | Signal: S&R + TL Combo | Signal: Repeat Action |: Trade open signal trigger execution approach MATRIX (If 1 or more turned on at the same time - whatever comes first will be the trade signal trigger). 'Regular': A single Break/Bounce must occur on a closed bar for signal trigger. 'S&R Combo': A combination of 2 Current + Historical S&R (Support and Resistance) Break/Bounce must happen in the same direction on same bar for signal trigger. 'TL Combo': A combination of 2 Current + Historical Trend Lines Break/Bounce must happen in the same direction on same bar for signal trigger. 'S&R + TL Combo': a combination of ANY S&R and Trend Line Break/Bounce must happen in the same direction on same bar for signal trigger. 'Repeat Action': Initial and then confirmation (2nd/3rd/etc. consecutive occurence) Break/Bounce must occur on same level/line for signal trigger.
>>> Historical - Look Back (# of days): How far back (in # of days) will historical S&R/Trend Lines will be used for Trade Open signals/TP/SL/etc.
>>> Historical - Look Back Invalidation (# of days): IF THERE IS TOO MUCH HISTORICAL LEVELS/LINES ON CHART - LOWER THIS SETTING + MAKE SURE IT'S SMALLER THAN 'Historical - Look Back (# of days)'. With big Look back period (5+ days) - it can become very messy with too many historical levels/lines. To clear oldest historical levels/lines - set Look Back Invalidation # of days to less than Historical Look Back # of days. (After X # of Look Back Invalidation days - older levels/lines will become invalidated and no longer used for opening trades/TP (Take-Profit)/SL (Stop-Loss), while newer levels/lines will still be discovered.
>>> S&R/Trend Lines - Support/Resistance combined into 1 entity: Every level or a line becomes simply a level or a line, regardless if it originally was a support or resistance. By default, depending on the level/line originally being support or resistance - the signal direction will be such as: Resistance is broken > LONG / bounced > SHORT; Support is broken > SHORT / bounced > LONG; with this setting on, either level or line can be both broken or bounced off in ANY direction, trade open direction will depend on current market sentiment only.
---------------------------------------------------------------------------
S&R CONFIGURATION ////////////////////////////////////////////////
---------------------------------------------------------------------------
>>> S&R Search - Left Bars (current): This setting is for calculating optimal S&R (Support and Resistance) levels (in combination with below - Right Bars).
>>> S&R Search - Right Bars (current): This setting is for calculating optimal S&R (Support and Resistance) levels (in combination with above - Left Bars).
>>> S&R Search - Custom Resolution (current): This is a custom timeframe setting specifically for S&R Search, it disregards current chart timeframe. This is great to use for scalping, for example: with main chart set to 1min and the custom timeframe set to 3min or 5min - there will be stronger support/resistance levels with more detailed price action.
>>> S&R Search - Left Bars (historical): This setting is for calculating optimal S&R (Support and Resistance) levels (in combination with below - Right Bars).
>>> S&R Search - Right Bars (historical): This setting is for calculating optimal S&R (Support and Resistance) levels (in combination with above - Left Bars).
>>> S&R Search - Custom Resolution (historical): This is a custom timeframe setting specifically for S&R Search, it disregards current chart timeframe. This is great to use for scalping, for example: with main chart set to 1min and the custom timeframe set to 3min or 5min - there will be stronger support/resistance levels with more detailed price action.
>>> S&R - Historical S&R Levels - Extend to the right: Extend all S&R lines to the right.
>>> S&R (Current/Historical) - Live Breakout/Bounce - ALERT/SHOW: NOTE: Alert wlil trigger immediately at price Breaking thru or Bouncing off level/line and an arrow above /below the bar will show the direction of breakout/bounce. If on that same live bar - price comes back causing the Breakout/Bounce become no longer valid - the arrow will disappear as the condition of the Break/Bounce will no longer be valid.
---------------------------------------------------------------------------
TREND LINES CONFIGURATION ////////////////////////////////////////////////
---------------------------------------------------------------------------
>>> Show: Trend Line development (where it 'did not exist' yet): It takes 2 pivots to develop a trend line, pivot is established at least 3 candle bars later from where the pivot is. With this setting turned on - it will plot dashed lines where trend lines originated connecting the 1st and 2nd pivot point up to where the trend line became established (where in reality you would now be able to draw a certain trend line). Established already generated trend line are plotted with a solid line.
>>> Trend Lines - Line Slope Confirmation: LONG breakout will only be shown if trend line is goind downslope \. SHORT breakout will only be shown if trend line is goind upslope /.
>>> Trend Lines - Search - Left Bars (current): This setting is for calculating optimal Trend Lines.
>>> Trend Lines - Search - Right Bars (current): This setting is for calculating optimal Trend Lines.
>>> Trend Lines - Custom Resolution (current): This is a custom timeframe setting specifically for S&R Search, it disregards current chart timeframe. This is great to use for scalping, for example: with main chart set to 1min and the custom timeframe set to 3min or 5min - there will be stronger support/resistance levels with more detailed price action.
>>> Trend Lines - Search - Left Bars (historical): This setting is for calculating optimal Trend Lines.
>>> Trend Lines - Search - Right Bars (historical): This setting is for calculating optimal Trend Lines.
>>> Trend Lines - Custom Resolution (historical): This is a custom timeframe setting specifically for S&R Search, it disregards current chart timeframe. This is great to use for scalping, for example: with main chart set to 1min and the custom timeframe set to 3min or 5min - there will be stronger support/resistance levels with more detailed price action.
>>> Trend Lines - Historical Trend Lines - Extend to the right: Extend all Trend Lines to the right.
>>> Trend Lines (Current/Historical) - Live Breakout/Bounce - ALERT/SHOW: NOTE: Alert will trigger immediately at price Breaking thru or Bouncing off level/line and an arrow above /below the bar will show the direction of breakout/bounce. If on that same live bar - price comes back causing the Breakout/Bounce become no longer valid - the arrow will disappear as the condition of the Break/Bounce will no longer be valid.
---------------------------------------------------------------------------
TAKE-PROFIT/STOP-LOSS CONFIGURATION ///////////////////////////////////////
---------------------------------------------------------------------------
>>> TP (Take-Profit) System: 'S&R Static Current/Historical': TP (Take-Profit) is calculated using current/historical S&R (Support & Resistance) levels at trade open and remains static. 'S&R/Trend Lines Dynamic Breaks': TP (Take-Profit) is fully dynamic and will be trigger at price above trade open price and with Breakout occurence (S&R or Trend Line current/historical breakout).
>>> TP (Take-Profit) # of targets: It is wise to divide the trade into several profit targets. With this setting - up to 5 TP (Take-Profit) targets can be approached. The trade will be equally divided up by the selected # of TP (Take-Profit) targets.
>>> SL (Stop-Loss) System: 'ATR-Trailing-SL': SL (Stop-Loss) is trail-following the ATR (Average True Range) line, NOTE: If at signal trigger, ATR will be against the trade direction - trade open signal will be skipped; 'S&R-Static-SL': SL (Stop-Loss) is set at trade open per optimal most recent S&R level and remains there until trade closes; 'TrendLines-Static-SL': SL (Stop-Loss) is set at trade open per optimal most recent trend line and remains there until trade closes; 'TrendLines-Dynamic-SL': SL (Stop-Loss) will be set per current opposite trend line and follow it until trade is open.; 'Oppos-Sig-Trd-in-Loss': SL (Stop-Loss) will trigger at opposite signal with trade currently at loss.
>>> SL (Stop-Loss) - On/Off: Without SL (Stop-Loss), unless EOD (End of Day) Close is turned on - there will be no SL (Stop-Loss) at all!
---------------------------------------------------------------------------
MARKET SENTIMENT CONFIRMATION ///////////////////////////////////////
---------------------------------------------------------------------------
>>> Market Sentiment: Signal is confirmed per Market Sentiment direction. If Market Sentiment is turned off - whatever signal comes 1st will be the trade open trigger.
---------------------------------------------------------------------------
SIGNAL ANALYSIS AND CLEANUP ///////////////////////////////////////////////
---------------------------------------------------------------------------
>>> Signal Cleanup - Bar Color: Include Bar Color (bullish/bearish) confirmation, LONG signal will only be opened if signal bar is green/bullish, SHORT if red/bearish.
>>> Signal Cleanup - Bar Directional Structure: Skip opposite bar structure types signals (For example: bearish green hammer).
>>> Signal Cleanup - Bar Doji Skip: Skip doji (indecisive) candles signals.
>>> Signal Cleanup - EWO (Elliott Wave Oscillator): Include EWO (Elliott Wave Oscillator), LONG will only be opened if EWO is bullish / SHORT if EWO is bearish.
>>> Signal Cleanup - VWAP (Volume-Weighted Average Price): Include VWAP (Volume-Weighted Average Price), LONG will only be opened if price is above VWAP / SHORT if price is below VWAP.
>>> Signal Cleanup - MA (Moving Average) Confirmation: Include MA (Moving Average), LONG will only be opened if MA is bullish / SHORT if MA is bearish.
>>> Signal Cleanup - ATR (Average True Range): Include ATR (Average True Range) confirmation, LONG will only be opened if ATR is bullish / SHORT if ATR is bearish.
>>> Signal Cleanup - Divergence(RSI + MACD): Include Divergence (RSI + MACD ) confirmation, LONG will only be opened if Divergence is bullish / SHORT if Divergence is bearish.
>>> Signal Cleanup - Volume % Strength: Include Volume strength/percentage confirmation, LONG/SHORT will only be opened with strong Volume matching the signal direction | By default, strong Volume percentage is set to 150% and weak to 50%.
>>> Signal Cleanup - Volume Above Average: Include Volume Above Moving Average (Volume closing bar closes above volume moving average) confirmation, LONG/SHORT will only be opened with Volume above average - Volume closed bar color must match the closed price color (bullish/bearish direction) + Volume bar must be closed above volume MA line).
---------------------------------------------------------------------------
===========================================================================
||||||||||||||||||||||||||||||||||| *** ||||||||||||||||||||||||||||||||||| *** |||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||| *** ||||||||||||||||||||||||||||||||||| *** |||||||||||||||||||||||||||||||||||
TP System - VERY IMPORTANT INFO!
-------------------------------------------------------------------------------------------------------------------
"TP PERCENTAGE" - amount by which current trade/position needs to be reduced/partially closed/sold.
-------------------------------------------------------------------------------------------------------------------
TP System: Dynamic
"TP PERCENTAGE" - will always be the same amount (trade/position size divided by the # of take-profit(TP) targets) and percentage to be closed will always be of the ORIGINAL trade/position.
-------------------------------------------------------------------------------------------------------------------
TP System: Static
"TP PERCENTAGE" - will always be the same amount IF take-profit(TP) targets are hit 1-by-1 (TP1 > TP2 > TP3 > TP4 > TP5), otherwise it will vary and unless it is a 1st take-profit(TP1), the REMAINING trade/position size will always be smaller than original and therefore the percentage to be closed will always be of the REMAINING trade/position and NOT the original one!
-------------------------------------------------------------------------------------------------------------------
"TP PERCENTAGE" CheatSheet (these are the only percentages you may see)
-----------------------------------------------------------------------
TP PERCENTAGE---Close/Sell Amount-------------Example (trade size: 50 stocks)
20%-------------trade size * 0.2--------------50 * 0.2 = 10 stocks
25%-------------trade size * 0.25-------------50 * 0.25 = 12.5(~13) stocks
34%-------------trade size * 0.34-------------50 * 0.34 = 17 stocks
40%-------------trade size * 0.4--------------50 * 0.4 = 20 stocks
50%-------------trade size * 0.5--------------50 * 0.5 = 25 stocks
60%-------------trade size * 0.6--------------50 * 0.6 = 30 stocks
66%-------------trade size * 0.66-------------50 * 0.66 = 33 stocks
75%-------------trade size * 0.75-------------50 * 0.75 = 37.5(~38) stocks
80%-------------trade size * 0.8--------------50 * 0.8 = 40 stocks
100%------------trade size--------------------50 = 50 stocks
-----------------------------------------------------------------------
If for any reason a portion of the current/remaining trade closed at such occurrence was slightly wrong, it is not an issue. Such occurrences are rare and with slight difference in partial TP closed is not significant to overall performance of our algorithms.
||||||||||||||||||||||||||||||||||| *** ||||||||||||||||||||||||||||||||||| *** |||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||| *** ||||||||||||||||||||||||||||||||||| *** |||||||||||||||||||||||||||||||||||
===========================================================================
Alert Settings (you don’t have to touch this section unless you will be using TradingView alerts through a Webhook to use with trading bot)
---------------------------------------------------------------------------
Here is how a LONG OPEN alert looks like.
NOTE: Each label , , etc. is customizable, you can change the text of it within indicator Input settings.
ALERT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
COIN: BTCUSD
TIMEFRAME: 15M
LONG: OPEN
ENTRY: 20000
TP1: 20500
TP2: 21000
TP3: 21500
TP4: 22500
TP5: 23500
SL: 19000
Leverage: 0
---------------------------------------------------------------------------
Here is how a TP1 alert will look with 5 TPs breakdown of the trade.
NOTE1: Next to TP1 taken it will show at which price it was triggered.
NOTE2: Next to "TP Percentage" it shows how much of the CURRENT/ACTIVE/REMAINING trade needs to be closed.
NOTE2: If TP2/3/4/5 comes before TP1 - the alert will tell you exactly how many percent of the trade needs to be closed!
ALERT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
COIN: BTCUSD
TIMEFRAME: 15M
LONG: TP1
TP1: 20500
TP Percentage: 20%
---------------------------------------------------------------------------
Here is how an alert will look for LONG - STOP-LOSS.
ALERT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
COIN: BTCUSD
TIMEFRAME: 15M
ENTRY: 20000
LONG: SL
SL: 19000
---------------------------------------------------------------------------
Here is how an alert will look for LONG - EOD (End of Day) In Profit close.
ALERT >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
COIN: BTCUSD
TIMEFRAME: 15M
LONG: EOD-Close (profit)
ENTRY: 20000
EOD-Close: 21900
===========================================================================
Adding Alerts in TradngView
---------------------------------------------------------------------------
-Add indicator to chart and make sure the correct strategy is configured (check Backtesting results)
-Right-click anywhere on the TradingView chart
-Click on Add alert
-Condition: Select this indicator by it’s name
-Immediately below, change it to "alert() function calls only", as other wise there will be 2 alerts for every alert!
-Expiration: Open-ended (that may require higher tier TradingView account, otherwise the alert will need to be occasionally re-triggered)
-Alert name: Whatever you desire
-Hit “Create”
-Note: If you change ANY Settings within the indicator – you must DELETE the current alert and create a new one per steps above, otherwise it will continue triggering alerts per old Settings!
===========================================================================
Good Luck! (NOTE: Trading is very risky, past performance is not necessarily indicative of future results, so please trade responsibly!)
---------------------------------------------------------------------------
NOTE: There seems to be a strange glitch when strategy is running live, it will show "double-take" take-profits labels on the chart. This is not affecting the script logic and backtesting results, if you simply change the timeframe real quick to something else then back - it will no longer show the duplicate orders... this must be some sort of a glitch as every alert was thoroughly tested to make sure everything is working!
Kyrie Crossover ( @zaytradellc )Unlocking Market Dynamics: Kyrie Crossover Script by @zaytradellc
personalized trading success with the "Kyrie Crossover" script, meticulously crafted by @zaytrade. This innovative Pine Script, tailored to the birthdays of Kyrie and the script creator, combines the power of technical analysis with a touch of personalization to revolutionize your trading experience.
**Exponential Moving Average (EMA) Crossover Strategy:**
At the heart of the "Kyrie Crossover" script lies a sophisticated EMA crossover strategy. By utilizing a 10-period EMA and a 323-period EMA (symbolizing long term price action ), the strategy effectively captures market trends with precision and insight.
- **Short-Term EMA (10-period):** This EMA reacts swiftly to recent price changes, offering heightened sensitivity to short-term fluctuations. It excels in identifying immediate shifts in market sentiment, making it invaluable for pinpointing short-lived trends and potential reversal points.
- **Long-Term EMA (323-period):** In contrast, the long-term EMA provides a broader perspective by smoothing out short-term noise and focusing on longer-term trend direction. Its extended length filters out market noise effectively, providing a clear representation of the underlying trend's momentum and sustainability.
**Directional Movement Index (DMI) Metrics:**
The "Kyrie Crossover" script goes beyond traditional indicators by incorporating DMI metrics across multiple timeframes. By assessing trend strength and direction, traders gain valuable insights into market dynamics, allowing for informed decision-making.
**Simple Instructions to Profit:**
1. **Identify EMA Crossovers:** Look for instances where the short-term EMA (10-period) crosses above the long-term EMA (323-period) for a bullish signal, indicating a potential buying opportunity. Conversely, a crossover where the short-term EMA crosses below the long-term EMA signals a bearish trend and a potential selling opportunity.
2. **Confirm with DMI Metrics:** Validate EMA crossovers by checking DMI metrics across different timeframes (5 minutes, 15 minutes, 30 minutes, and 1 hour). Pay attention to color-coded indicators, with green indicating a bullish trend, red indicating a bearish trend, and white indicating no clear trend.
3. **Manage Risk:** Implement proper risk management techniques, such as setting stop-loss orders and position sizing based on your risk tolerance and trading objectives.
4. **Stay Informed:** Regularly monitor market conditions and adjust your trading strategy accordingly based on new signals and emerging trends.
Bitcoin Leverage Sentiment - Strategy [presentTrading]█ Introduction and How it is Different
The "Bitcoin Leverage Sentiment - Strategy " represents a novel approach in the realm of cryptocurrency trading by focusing on sentiment analysis through leveraged positions in Bitcoin. Unlike traditional strategies that primarily rely on price action or technical indicators, this strategy leverages the power of Z-Score analysis to gauge market sentiment by examining the ratio of leveraged long to short positions. By assessing how far the current sentiment deviates from the historical norm, it provides a unique lens to spot potential reversals or continuation in market trends, making it an innovative tool for traders who wish to incorporate market psychology into their trading arsenal.
BTC 4h L/S Performance
local
█ Strategy, How It Works: Detailed Explanation
🔶 Data Collection and Ratio Calculation
Firstly, the strategy acquires data on leveraged long (**`priceLongs`**) and short positions (**`priceShorts`**) for Bitcoin. The primary metric of interest is the ratio of long positions relative to the total of both long and short positions:
BTC Ratio=priceLongs / (priceLongs+priceShorts)
This ratio reflects the prevailing market sentiment, where values closer to 1 indicate a bullish sentiment (dominance of long positions), and values closer to 0 suggest bearish sentiment (prevalence of short positions).
🔶 Z-Score Calculation
The Z-Score is then calculated to standardize the BTC Ratio, allowing for comparison across different time periods. The Z-Score formula is:
Z = (X - μ) / σ
Where:
- X is the current BTC Ratio.
- μ is the mean of the BTC Ratio over a specified period (**`zScoreCalculationPeriod`**).
- σ is the standard deviation of the BTC Ratio over the same period.
The Z-Score helps quantify how far the current sentiment deviates from the historical norm, with high positive values indicating extreme bullish sentiment and high negative values signaling extreme bearish sentiment.
🔶 Signal Generation: Trading signals are derived from the Z-Score as follows:
Long Entry Signal: Occurs when the BTC Ratio Z-Score crosses above the thresholdLongEntry, suggesting bullish sentiment.
- Condition for Long Entry = BTC Ratio Z-Score > thresholdLongEntry
Long Exit/Short Entry Signal: Triggered when the BTC Ratio Z-Score drops below thresholdLongExit for exiting longs or below thresholdShortEntry for entering shorts, indicating a shift to bearish sentiment.
- Condition for Long Exit/Short Entry = BTC Ratio Z-Score < thresholdLongExit or BTC Ratio Z-Score < thresholdShortEntry
Short Exit Signal: Happens when the BTC Ratio Z-Score exceeds the thresholdShortExit, hinting at reducing bearish sentiment and a potential switch to bullish conditions.
- Condition for Short Exit = BTC Ratio Z-Score > thresholdShortExit
🔶Implementation and Visualization: The strategy applies these conditions for trade management, aligning with the selected trade direction. It visualizes the BTC Ratio Z-Score with horizontal lines at entry and exit thresholds, illustrating the current sentiment against historical norms.
█ Trade Direction
The strategy offers flexibility in trade direction, allowing users to choose between long, short, or both, depending on their market outlook and risk tolerance. This adaptability ensures that traders can align the strategy with their individual trading style and market conditions.
█ Usage
To employ this strategy effectively:
1. Customization: Begin by setting the trade direction and adjusting the Z-Score calculation period and entry/exit thresholds to match your trading preferences.
2. Observation: Monitor the Z-Score and its moving average for potential trading signals. Look for crossover events relative to the predefined thresholds to identify entry and exit points.
3. Confirmation: Consider using additional analysis or indicators for signal confirmation, ensuring a comprehensive approach to decision-making.
█ Default Settings
- Trade Direction: Determines if the strategy engages in long, short, or both types of trades, impacting its adaptability to market conditions.
- Timeframe Input: Influences signal frequency and sensitivity, affecting the strategy's responsiveness to market dynamics.
- Z-Score Calculation Period: Affects the strategy’s sensitivity to market changes, with longer periods smoothing data and shorter periods increasing responsiveness.
- Entry and Exit Thresholds: Set the Z-Score levels for initiating or exiting trades, balancing between capturing opportunities and minimizing false signals.
- Impact of Default Settings: Provides a balanced approach to leverage sentiment trading, with adjustments needed to optimize performance across various market conditions.
Crypto MVRV ZScore - Strategy [PresentTrading]█ Introduction and How it is Different
The "Crypto Valuation Extremes: MVRV ZScore - Strategy " represents a cutting-edge approach to cryptocurrency trading, leveraging the Market Value to Realized Value (MVRV) Z-Score. This metric is pivotal for identifying overvalued or undervalued conditions in the crypto market, particularly Bitcoin. It assesses the current market valuation against the realized capitalization, providing insights that are not apparent through conventional analysis.
BTCUSD 6h Long/Short Performance
Local
█ Strategy, How It Works: Detailed Explanation
The strategy leverages the Market Value to Realized Value (MVRV) Z-Score, specifically designed for cryptocurrencies, with a focus on Bitcoin. This metric is crucial for determining whether Bitcoin is currently undervalued or overvalued compared to its historical 'realized' price. Below is an in-depth explanation of the strategy's components and calculations.
🔶Conceptual Foundation
- Market Capitalization (MC): This represents the total dollar market value of Bitcoin's circulating supply. It is calculated as the current price of Bitcoin multiplied by the number of coins in circulation.
- Realized Capitalization (RC): Unlike MC, which values all coins at the current market price, RC is computed by valuing each coin at the price it was last moved or traded. Essentially, it is a summation of the value of all bitcoins, priced at the time they were last transacted.
- MVRV Ratio: This ratio is derived by dividing the Market Capitalization by the Realized Capitalization (The ratio of MC to RC (MVRV Ratio = MC / RC)). A ratio greater than 1 indicates that the current price is higher than the average price at which all bitcoins were purchased, suggesting potential overvaluation. Conversely, a ratio below 1 suggests undervaluation.
🔶 MVRV Z-Score Calculation
The Z-Score is a statistical measure that indicates the number of standard deviations an element is from the mean. For this strategy, the MVRV Z-Score is calculated as follows:
MVRV Z-Score = (MC - RC) / Standard Deviation of (MC - RC)
This formula quantifies Bitcoin's deviation from its 'normal' valuation range, offering insights into market sentiment and potential price reversals.
🔶 Spread Z-Score for Trading Signals
The strategy refines this approach by calculating a 'spread Z-Score', which adjusts the MVRV Z-Score over a specific period (default: 252 days). This is done to smooth out short-term market volatility and focus on longer-term valuation trends. The spread Z-Score is calculated as follows:
Spread Z-Score = (Market Z-Score - MVVR Ratio - SMA of Spread) / Standard Deviation of Spread
Where:
- SMA of Spread is the simple moving average of the spread over the specified period.
- Spread refers to the difference between the Market Z-Score and the MVRV Ratio.
🔶 Trading Signals
- Long Entry Condition: A long (buy) signal is generated when the spread Z-Score crosses above the long entry threshold, indicating that Bitcoin is potentially undervalued.
- Short Entry Condition: A short (sell) signal is triggered when the spread Z-Score falls below the short entry threshold, suggesting overvaluation.
These conditions are based on the premise that extreme deviations from the mean (as indicated by the Z-Score) are likely to revert to the mean over time, presenting opportunities for strategic entry and exit points.
█ Practical Application
Traders use these signals to make informed decisions about opening or closing positions in the Bitcoin market. By quantifying market valuation extremes, the strategy aims to capitalize on the cyclical nature of price movements, identifying high-probability entry and exit points based on historical valuation norms.
█ Trade Direction
A unique feature of this strategy is its configurable trade direction. Users can specify their preference for engaging in long positions, short positions, or both. This flexibility allows traders to tailor the strategy according to their risk tolerance, market outlook, or trading style, making it adaptable to various market conditions and trader objectives.
█ Usage
To implement this strategy, traders should first adjust the input parameters to align with their trading preferences and risk management practices. These parameters include the trade direction, Z-Score calculation period, and the thresholds for long and short entries. Once configured, the strategy automatically generates trading signals based on the calculated spread Z-Score, providing clear indications for potential entry and exit points.
It is advisable for traders to backtest the strategy under different market conditions to validate its effectiveness and adjust the settings as necessary. Continuous monitoring and adjustment are crucial, as market dynamics evolve over time.
█ Default Settings
- Trade Direction: Both (Allows for both long and short positions)
- Z-Score Calculation Period: 252 days (Approximately one trading year, capturing a comprehensive market cycle)
- Long Entry Threshold: 0.382 (Indicative of moderate undervaluation)
- Short Entry Threshold: -0.382 (Signifies moderate overvaluation)
These default settings are designed to balance sensitivity to market valuation extremes with a pragmatic approach to trade execution. They aim to filter out noise and focus on significant market movements, providing a solid foundation for both new and experienced traders looking to exploit the unique insights offered by the MVRV Z-Score in the cryptocurrency market.
Self Optimizing PSAR [Starbots]Self Optimizing Parabolic SAR Strategy (non-repainting)
Strategy constantly backtest 169 different combinations of Parabolic SAR indicator for maximum profitability and trades based on the best performing combination at that time.
---------------------------------------------------------------------------------------------------------
# Parabolic SAR (PSAR)
Parabolic SAR is a time and price technical analysis tool created by J. Welles Wilder and it's primarily used to identify points of potential stops and reverses. In fact, the SAR in Parabolic SAR stands for "Stop and Reverse". The indicator's calculations create a parabola which is located below price during a Bullish Trend and above Price during a Bearish Trend.
You can read more about this indicator here:
www.tradingview.com
-----------------------------------------------------------------------------------------------------------
The logic of self - optimizing:
This script is always backtesting 169 different combinations of Parabolic SAR settings in the background and saves the net. profit gained for every single one of them, then strategy selects and use the best performing combination of settings currently available for you to trade.
It's recalculating on every bar close - if one of the parameters starts performing better than others - have a higher net profit gain (it's literally like running 169 backtests with different settings) strategy switches to that parameter and continues trading like that until one of the other indicator parameters starts performing better again and switches to that settings.
We are optimizing our strategy based on 13 different 'Increment' factors of PSAR. We keep the 'Start' factor (default 0.02) and 'Max Value' factor (default 0.2) at default for all of them.
According to creator of this indicator J. Welles Wilder, we usually want to change only 'Increment' factors of PSAR in the calculation and leave the rest at default and that's what we do, we are changing only 'Increment' input.
Inputs : (you don't need to change them at all, it's a good balance for fast and slow detection of trends on PSAR)
Start = 0.02
Max value = 0.2
Increment1 = 0.005, Increment2 = 0.01, Increment3 = 0.015
Increment4 = 0.02, Increment5 = 0.025, Increment6 = 0.03
Increment7 = 0.035, Increment8 = 0.04, Increment9 = 0.045
Increment10 = 0.05, Increment11 = 0.055, Increment12 = 0.06
Increment13 = 0.065
PSAR buy / sell conditions looks like this:
PSAR1 = start 0.02, max value 0.2, increment1 0.005
PSAR2 = start 0.02, max value 0.2, increment2 0.01
PSAR3 = start 0.02, max value 0.2, increment3 0.015
PSAR4 = start 0.02, max value 0.2, increment3 0.02
...
PSAR13 = start 0.02, max value 0.2, increment13 0.065
Backtester in the background works like this:
backtest buying PSAR1 settings with selling PSAR1 settings => save net. profit
backtest buy PSAR1 with sell PSAR2 ;
backtest buy PSAR1 with sell PSAR3 ;
backtest buy PSAR1 with sell PSAR4 ;
..........
backtest buy PSAR1 with sell PSAR13 ;
..........
backtest buy PSAR13 with sell PSAR1 ;
backtest buy PSAR13 with sell PSAR2 ;
......
backtest buy PSAR13 with sell PSAR13 ;
=>
It will backtest 16x16=169 different PSAR settings and save their profits.
Your strategy then trades based on the best performing (highest net.profit) PSAR Setting currently available. It will check the calculations and backtest them on every new bar close - it's like running 169 strategies at time, and manually selecting the best performing one.
________________________________________________________________________
If you wish to use it as INDICATOR - turn on 'Recalculate after every tick' in Properties tab to have this script updating constantly and use it as a normal Indicator tool for manual trading.
Strategy example is backtested on Daily chart of SHIBUSDT Binance
All settings at default. (1000 capital, 100 order size, 0.1% fee, 1 tick slippage)
Settings:
-Start = default Parabolic SAR setting is 0.02
-Max Value = default Parabolic SAR setting is 0.2
--Recommended PSAR Increment settings:
0.02 is default, higher timeframes usually performs good on the faster Increment factors 0.03-0.05+, smaller timeframes on slow Increment factors 0.005-0.02. I recommend you the most common and logical 13 different Increment factors for optimizing in the strategy as default already (from 0.005 to 0.065 - strategy will then optimize and trade based on the most profitable combination).
- Noise-Intensity Filter 🐎0.00-0.20%🐢
This will punish the tiny trades made by certain combinations and give more advantage to big average trades. It's basically like fee calculation, it will deduct 0.xx% fee from every trade when optimizing on their backtests.
You will usually want to have it around 0.05-0.10% like your fees on exchange.
-> 🐎Less than <0.10% allows strategy to be VERY SENSITIVE to market. (a lot of trades - quick buy-sell changes)
-> 🐢More than >0.10% will slow down the strategy, it will be LESS SENSITIVE to market volatility. (less trades - slowly switches the trend direction from buy to sell)
Close Trades on Neutral
After a lot of Trades, Algo starts developing self-intelligence. It can also have a neutral score. (Grey Plots). Sell when the strategy is neutral.
Other settings:
-Take Profit, Multiple Take Profit, Trailing Take Profit, Stop Loss, Trailing Stop Loss with functional alerts.
-Backtesting Range - backtest within your desired time window. Example: 'from 01 / 01 /2020 to 01 / 01 /2023'.
- Strategy is trading on the bar close without repaint. You can trade Long-Sell/Short Sell or Long-Short both directions. Alerts available, insert webhook messages in the inputs.
- Turn on Profit Calendar for better overview of how your strategy performs monthly/annualy
- Notes window : add your custom comments in here or save your webhook message text inside here for later use. I find this helpful to save texts inside.
Recommended TF : 4h, 8h, 1d (Trend Indicators are good at detecting directions of the market, but we can have a lot of noise and false movements on charts, you want to avoid that and ride the long term movements)
This script is fairly simple to use. It's self-optimizing and adjusting to the markets on the go.
FlexiSuperTrend - Strategy [presentTrading]█ Introduction and How it is Different
The "FlexiSuperTrend - Strategy" by PresentTrading is a cutting-edge trading strategy that redefines market analysis through the integration of the SuperTrend indicator and advanced variance tracking.
BTC 6H L/S
This strategy stands apart from conventional methods by its dynamic adaptability, capturing market trends and momentum shifts with increased sensitivity. It's designed for traders seeking a more responsive tool to navigate complex market movements.
Local
█ Strategy, How It Works: Detailed Explanation
The "FlexiSuperTrend - Strategy" employs a multifaceted approach, combining the adaptability of the SuperTrend indicator with variance tracking. The strategy's core lies in its unique formulation and application of these components:
🔶 SuperTrend Polyfactor Oscillator:
- Basic Concept: The oscillator is a series of SuperTrend calculations with varying ATR lengths and multipliers. This approach provides a broader and more nuanced perspective of market trends.
- Calculation:
- For each iteration, `i`, the SuperTrend is calculated using:
- `ATR Length = indicatorLength * (startingFactor + i * incrementFactor)`.
- `Multiplier = dynamically adjusted based on market conditions`.
- The SuperTrend output for each iteration is compared with the indicator source (like hlc3), and the deviation is recorded.
SuperTrend Calculation:
- `Upper Band (UB) = hl2 + (ATR Length * Multiplier)`
- `Lower Band (LB) = hl2 - (ATR Length * Multiplier)`
- Where `hl2` is the average of high and low prices.
Deviation Calculation:
- `Deviation = indicatorSource - SuperTrend Value`
- This value is calculated for each SuperTrend setting in the oscillator series.
🔶 Indicator Source (`hlc3`):
- **Usage:** The strategy uses the average of high, low, and close prices, providing a balanced representation of market activity.
🔶 Adaptive ATR Lengths and Factors:
- Dynamic Adjustment: The strategy adjusts the ATR length and multiplier based on the `startingFactor` and `incrementFactor`. This adaptability is key in responding to changing market volatilities.
- Equation: ATR Length at each iteration `i` is given by `len = indicatorLength * (startingFactor + i * incrementFactor)`.
incrementFactor - 1
incrementFactor - 2
🔶 Normalization Methods:
Purpose: To standardize the deviations for comparability.
- Methods:
- 'Max-Min': Scales the deviation based on the range of values.
- 'Absolute Sum': Uses the sum of absolute deviations for normalization.
Normalization 'Absolute Sum'
- For 'Max-Min': `Normalized Deviation = (Deviation - Min(Deviations)) / (Max(Deviations) - Min(Deviations))`
- For 'Absolute Sum': `Normalized Deviation = Deviation / Sum(Absolute(Deviations))`
🔶 Trading Logic:
The strategy integrates the SuperTrend indicator, renowned for its effectiveness in identifying trend direction and reversals. The SuperTrend's incorporation enhances the strategy's ability to filter out false signals and confirm genuine market trends. * The SuperTrend Toolkit is made by @QuantiLuxe
- Long Entry Conditions: A buy signal is generated when the current trend, as indicated by the SuperTrend Polyfactor Oscillator, turns positive.
- Short Entry Conditions: A sell signal is triggered when the current trend turns negative.
- Entry and Exit Strategy: The strategy opens or closes positions based on these signals, aligning with the selected trade direction (long, short, or both).
█ Trade Direction
The strategy is versatile, allowing traders to choose their preferred trading direction: long, short, or both. This flexibility enables traders to tailor their strategies to their market outlook and risk appetite.
█ Usage
The FlexiSuperTrend strategy is suitable for various market conditions and can be adapted to different asset classes and time frames. Traders should set the strategy parameters according to their risk tolerance and trading goals. It's particularly useful for capturing long-term movements, ideal for swing traders, yet adaptable for short-term trading strategies.
█ Default Settings
1. Trading Direction: Choose from "Long", "Short", or "Both" to define the trade type.
2. Indicator Source (HLC3): Utilizes the HLC3 as the primary price reference.
3. Indicator Length (Default: 10): Influences the moving average calculation and trend sensitivity.
4. Starting Factor (0.618): Initiates the ATR length, influenced by Fibonacci ratios.
5. Increment Factor (0.382): Adjusts the ATR length incrementally for dynamic trend tracking.
6. Normalization Method: Options include "None", "Max-Min", and "Absolute Sum" for scaling deviations.
7. SuperTrend Settings: Varied ATR lengths and multipliers tailor the indicator's responsiveness.
8. Additional Settings: Features mesh style plotting and customizable colors for visual distinction.
The default settings provide a balanced approach, but users are encouraged to adjust them based on their individual trading style and market analysis.
Pairs strategyHello, Tradingview community,
I am been playing with this idea that nowadays trading instruments are interconnected and when one goes too far "out of order" it should return to the mean.
So, here's a relatively simple idea.
This is a LONG-ONLY strategy.
Buy when your traded instrument's last bar closes down, and the comparing instrument closes up.
Sell when close is higher than the previous bar's high.
Best results I found with medium timeframes: 45min, 120min, 180min.
Also, feel free to test non-typical timeframes such as 59min, 119min, 179min, etc.
My reasoning for medium timeframes would be, that they are big enough to avoid "market noise"
of smaller timeframes + commissions & slippage is less negligible, and small enough to avoid exposure of higher timeframes, although, I haven't tested D timeframe and above.
The best results, I found were with instruments that aren't directly correlated. I mostly tested equities and equity futures, so for equity indexes, equity index futures, or large-cap stocks, NASDAQ:SMH , NASDAQ:NVDA , EURUSD, and Crude Oil would be a good candidate for comparing symbols.
When testing either futures or stocks, please adjust the commission for each asset, for stocks I use % equity, so it compounds over time, whereas, for futures, I use 1 contract all the time.
Here's NASDAQ:MSFT on 119min chart
Here's AMEX:SPY on 59min chart using NASDAQ:NVDA as comparison
Here's CME_MINI:ES1! on 179min chart using NYMEX:CL1! as comparison
To change comparison symbol just insert your symbol between the brackets on both fields down here.
SymbolClose = request.security("YOUR SYMBOL HERE", timeframe.period, close)
SymbolOpen = request.security("YOUR SYMBOL HERE", timeframe.period, open)
Since I am still relatively new to testing, hence, I am publishing this idea, so you can point out some crucial things I may have missed.
Thanks,
Enjoy the strategy!