OPEN-SOURCE SCRIPT
[SHORT ONLY] Consecutive Close>High[1] Mean Reversion Strategy

█ STRATEGY DESCRIPTION
The "Consecutive Close > High[1]" Mean Reversion Strategy is a contrarian daily trading system for stocks and ETFs. It identifies potential shorting opportunities by counting consecutive days where the closing price exceeds the previous day's high. When this consecutive day count reaches a predetermined threshold, and if the close is below a 200-period EMA (if enabled), a short entry is triggered, anticipating a corrective pullback.
█ HOW ARE THE CONSECUTIVE BULLISH COUNTS CALCULATED?
The strategy uses a counter variable called `bullCount` to track how many consecutive bars meet a bullish condition. Here’s a breakdown of the process:
█ SIGNAL GENERATION
1. SHORT ENTRY
A Short Signal is triggered when:
2. EXIT CONDITION
█ ADDITIONAL SETTINGS
█ PERFORMANCE OVERVIEW
The "Consecutive Close > High[1]" Mean Reversion Strategy is a contrarian daily trading system for stocks and ETFs. It identifies potential shorting opportunities by counting consecutive days where the closing price exceeds the previous day's high. When this consecutive day count reaches a predetermined threshold, and if the close is below a 200-period EMA (if enabled), a short entry is triggered, anticipating a corrective pullback.
█ HOW ARE THE CONSECUTIVE BULLISH COUNTS CALCULATED?
The strategy uses a counter variable called `bullCount` to track how many consecutive bars meet a bullish condition. Here’s a breakdown of the process:
- Initialize the Counter
Pine Script® var int bullCount = 0 - Bullish Bar Detection
Every time the close exceeds the previous bar's high, increment the counter:Pine Script® if close > high[1] bullCount += 1 - Reset on Bearish Bar
When there is a clear bearish reversal, the counter is reset to zero:Pine Script® if close < low[1] bullCount := 0
█ SIGNAL GENERATION
1. SHORT ENTRY
A Short Signal is triggered when:
- The count of consecutive bullish closes (where close > high[1]) reaches or exceeds the defined threshold (default: 3).
- The signal occurs within the specified trading window (between Start Time and End Time).
2. EXIT CONDITION
- An exit Signal is generated when the current close falls below the previous bar’s low (close < low[1]), prompting the strategy to exit the position.
█ ADDITIONAL SETTINGS
- Threshold: The number of consecutive bullish closes required to trigger a short entry (default is 3).
- Start Time and End Time: The time window during which the strategy is allowed to execute trades.
- EMA Filter (Optional): When enabled, short entries are only triggered if the current close is below the 200-period EMA.
█ PERFORMANCE OVERVIEW
- This strategy is designed for Stocks and ETFs on the Daily timeframe and targets overextended bullish moves.
- It aims to capture mean reversion by entering short after a series of consecutive bullish closes.
- Further optimization is possible with additional filters (e.g., EMA, volume, or volatility).
- Backtesting should be used to fine-tune the threshold and filter settings for specific market conditions.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.