[SHORT ONLY] Consecutive Close>High[1] Mean Reversion Strategy█ STRATEGY DESCRIPTION
The "Consecutive Close > High " 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
var int bullCount = 0
Bullish Bar Detection
Every time the close exceeds the previous bar's high, increment the counter:
if close > high
bullCount += 1
Reset on Bearish Bar
When there is a clear bearish reversal, the counter is reset to zero:
if close < low
bullCount := 0
█ SIGNAL GENERATION
1. SHORT ENTRY
A Short Signal is triggered when:
The count of consecutive bullish closes (where close > high ) 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 ), 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.
Consecutive
[SHORT ONLY] Consecutive Bars Above MA Strategy█ STRATEGY DESCRIPTION
The "Consecutive Bars Above MA Strategy" is a contrarian trading system aimed at exploiting overextended bullish moves in stocks and ETFs. It monitors the number of consecutive bars that close above a chosen short-term moving average (which can be either a Simple Moving Average or an Exponential Moving Average). Once the count reaches a preset threshold and the current bar’s close exceeds the previous bar’s high within a designated trading window, a short entry is initiated. An optional EMA filter further refines entries by requiring that the current close is below the 200-period EMA, helping to ensure that trades are taken in a bearish environment.
█ HOW ARE THE CONSECUTIVE BULLISH COUNTS CALCULATED?
The strategy utilizes a counter variable, `bullCount`, to track consecutive bullish bars based on their relation to the short-term moving average. Here’s how the count is determined:
Initialize the Counter
The counter is initialized at the start:
var int bullCount = na
Bullish Bar Detection
For each bar, if the close is above the selected moving average (either SMA or EMA, based on user input), the counter is incremented:
bullCount := close > signalMa ? (na(bullCount) ? 1 : bullCount + 1) : 0
Reset on Non-Bullish Condition
If the close does not exceed the moving average, the counter resets to zero, indicating a break in the consecutive bullish streak.
█ SIGNAL GENERATION
1. SHORT ENTRY
A short signal is generated when:
The number of consecutive bullish bars (i.e., bars closing above the short-term MA) meets or exceeds the defined threshold (default: 3).
The current bar’s close is higher than the previous bar’s high.
The signal occurs within the specified trading window (between Start Time and End Time).
Additionally, if the EMA filter is enabled, the entry is only executed when the current close is below the 200-period EMA.
2. EXIT CONDITION
An exit signal is triggered when the current close falls below the previous bar’s low, prompting the strategy to close the short position.
█ ADDITIONAL SETTINGS
Threshold: The number of consecutive bullish bars required to trigger a short entry (default is 3).
Trading Window: The Start Time and End Time inputs define when the strategy is active.
Moving Average Settings: Choose between SMA and EMA, and set the MA length (default is 5), which is used to assess each bar’s bullish condition.
EMA Filter (Optional): When enabled, this filter requires that the current close is below the 200-period EMA, supporting entries in a downtrend.
█ PERFORMANCE OVERVIEW
This strategy is designed for stocks and ETFs and can be applied across various timeframes.
It seeks to capture mean reversion by shorting after a series of bullish bars suggests an overextended move.
The approach employs a contrarian short entry by waiting for a breakout (close > previous high) following consecutive bullish bars.
The adjustable moving average settings and optional EMA filter allow for further optimization based on market conditions.
Comprehensive backtesting is recommended to fine-tune the threshold, moving average parameters, and filter settings for optimal performance.
Consecutive Bearish Candle Strategy█ STRATEGY DESCRIPTION
The "Consecutive Bearish Candle Strategy" is a momentum-based strategy designed to identify potential reversals after a sustained bearish move. It enters a long position when a specific number of consecutive bearish candles occur and exits when the price shows strength by exceeding the previous bar's high. This strategy is optimized for use on various timeframes and instruments.
█ SIGNAL GENERATION
1. LONG ENTRY
A Buy Signal is triggered when:
The close price has been lower than the previous close for at least `Lookback` consecutive bars. This indicates a sustained bearish move, suggesting a potential reversal.
The signal occurs within the specified time window (between `Start Time` and `End Time`).
2. EXIT CONDITION
A Sell Signal is generated when the current closing price exceeds the high of the previous bar (`close > high `). This indicates that the price has shown strength, potentially confirming the reversal and prompting the strategy to exit the position.
█ ADDITIONAL SETTINGS
Lookback: The number of consecutive bearish bars required to trigger a Buy Signal. Default is 3.
Start Time and End Time: The time window during which the strategy is allowed to execute trades.
█ PERFORMANCE OVERVIEW
This strategy is designed for markets with frequent momentum shifts.
It performs best in volatile conditions where price movements are significant.
Backtesting results should be analysed to optimize the `Lookback` parameter for specific instruments.
Consecutive count backtester / quantifytools- Overview
Consecutive counting is a simple method to mechanically define trending states to the upside and downside. Consecutive counts are calculated by taking reference price level (e.g. close 4 candles ago) and count closes above/below it up to a maximum count that resets the consecutive count back to 1. This tool provides the means to backtest each count by measuring % change in price after each count (e.g. % gain 2 candles after a given count).
Users can define reference source that starts the consecutive count (e.g. close 4 candles ago), maximum count where counter resets (e.g. after 9th count) and backtesting period (e.g. price change 2 candles after count).
Filters add extra conditions that must be met on the consecutive count to qualify as valid, which are also reflected on the backtest metrics. The counts can be refined using the following filters:
- RSI above/below X
- Price above/below/at moving average of choice
- Relative volume above/below X
Average gain corresponding to each count as they occur can be toggled off for less clutter. Average price change can also be visualized using candle color. Colors, gradient and table/label sizes are fully customizable.
- Practical guide
Example #1: Identify reversal potential
Consecutive counting is a simple yet effective method to for detecting reversals, for which 7-9 counts are traditionally used. Whether that holds true or not can now be put through a test with different variations of the method as well as using additional filters to improve the probability of a turn.
Example #2: Identify trend following potential
Consecutive counts can also have utility value for trend following. When historical short term change is to the downside, expect downside, when to the upside, expect upside.
Candles - 2 or 3 consecutive pattern + Custom pips thresholdFEATURES:
- Detect a 2 or 3 consecutive candlestick pattern. Input the value into the first input value.
- Choose the minimum and the maximum amount of pips of the candle that you want to detect. The indicator will detect candles within that pips range and highlight the consecutive pattern
- Choose to not use the pips threshold. If disabled the indicator will constantly check for consecutive candles pattern.
- Choose if calculate pips taking into consideration OC (Open - Close of candles - Body) or HL (High - Low - Body + Wick)
VISUALS:
- Enable Boxes: when enabled a box is drawn around the pattern detected
- Enable Lines: when enabled lines from top/bottom/mid of the boxes are drawn
- Extend the lines
BuP = Bullish Pattern
BeP = Bearish Pattern
AIM:
The aim of the indicator was to spot 2 common patterns in one indicator: Three White Soldiers and Three Black Crows
The rest is all implementation because I like coding.
Anyway on all timeframes 3 consecutive candles with a similar body length seems to be an alarm that Market Makers are joining the gfame before a major manipulation so it worth keep an eye on those.
From my experimentation from ltf 1 minute timeframe to htf 1H timeframe, 3 consecutive candles with a body length between 10 and 20 pips could be the ones to keep an eye on before a reversal or a strong continuation.
For sure they are zonez and levels where MM would come back later.
Adjust the settings as you want and happy trading!
This is just an indicator nothing more
Consecutive Unswept Lower Highs/ Higher Lows CounterCounts consecutive Lower Highs and Higher Lows; number resets to zero when previous pivot high or low gets swept
-To help give an idea of when a retracement / run-on-stops may be overdue. i.e. the higher the counter number grows, the longer we've gone without a proper retracement.
//inputs//
~pivot lookback/lookforward: increase this for more significant pivot highs and lows.
~number of pivot high 'counter' labels (pairs) to show in history.
~formatting options.
Consecutive positive/negative candlesConsecutive positive/negative candles
Shows the consecutive negative or positive candles
Determine Consecutive Candles█ OVERVIEW
This is a simple script that will plot labels over or under candles to show where there had been consecutive candles that closed in a similar fashion. This script was inspired by a Tweet about Bitcoin experiencing its first 7th-consecutive weekly black candle and I sought out to test that.
█ INPUTS
There are three inputs for this script.
"offset" ( integer ) - (Can be 0 or 1) Allows the user to apply this script at the currently closing candle or the most recently closed candle.
"Number of Candles" ( integer ) - (From 3 to 100*) Allows the user to select how many candles to back test for consecutive-ness.
"Black or White" ( boolean ) - Allows the user to select what kinds of candles to look for in this script. (true - Black , false - White ).
*Publishing open-sourced, this selection was arbitrary and can be modified at will.
█ USAGE
Because I had created this in a little over an hour, this is just a simple experiment that I wanted to share with others. Its applications are unknown to me, but I am interested in hearing how others may find what this script does useful.
Up/Down Long StrategyThis is a consecutive bar up/down strategy for going long only where you can specify how many bars up to buy and how many bars down to sell. It also has code to check and make sure the condition is still true when launching the official alert, which helps back testing and live results line up, however be sure to enter commission and slippage into the properties to accurately reflect profits. I added back testing date ranges to this so you can easily pull up and see back tested results for a certain date range. I also added a buy and sell message fields in the properties so you can launch alerts that will work with automated trading services. Simply enter your buy message and sell message into those fields in the properties and then when you create an alert enter {{strategy.order.alert_message}} into the alert body and it will dynamically pull in your buy and sell messages when it fires alerts.
Up/Down StrategyThis is a consecutive bar up/down strategy where you can specify how many bars up to buy and how many bars down to sell. It also has code to check and make sure the condition is still true when launching the official alert, which helps back testing and live results line up, however be sure to enter commission and slippage into the properties to accurately reflect profits. I added back testing date ranges to this so you can easily pull up and see back tested results for a certain date range. I also added a buy and sell message fields in the properties so you can launch alerts that will work with automated trading services. Simply enter your buy message and sell message into those fields in the properties and then when you create an alert enter {{strategy.order.alert_message}} into the alert body and it will dynamically pull in your buy and sell messages when it fires alerts.
Sequential Filter - An Original Filtering ApproachRemoving irregular variations in the closing price remain a major task in technical analysis, indicators used to this end mostly include moving averages and other kind of low-pass filters. Understanding what kind of variations we want to remove is important, irregular (noisy) variations have mostly a short term period, fully removing them can be complicated if the filter is not properly selected, for example we might want to fully remove variations with a period of 2 bars and lower, if we select an arithmetic moving average the filter output might still contain such variations because of the ripples in the frequency response passband, all it would take is a variation of high amplitude for that variation to be clearly visible.
Although all it would take for better filtering is a filter with better performance in the frequency domain (gaussian, Butterworth, Bessel...) we can design innovative approaches that does not rely on the model of classical moving averages, today a new technical indicator is proposed, the technical indicator fully remove variations lower than the selected period.
The Indicator Approach
In order for the indicator output to change the closing price need to produce length consecutive up's/down's, length control the variation threshold of the indicator, variations lower than length are fully removed. Lets see a visual example :
Here length = 3, the closing price need to make 3 consecutive up's/down's, when the sequence happen the indicator output is equal to src , here the closing price, else the indicator is equal to its precedent value, hence removing other variations. The value of 3 is the value by default, this is because i have seen in the past that the average smallest variations period where in general of 3 bars.
Because the indicator focus only on the variation sign, it totally ignore the amplitude of the movement, this provide an effective way to filter short term retracement in a fluctuation as show'n below :
The candle option of the indicator allow the indicator to only focus on the body color of a candle, thus ignoring potential gaps, below is an example with the candle option off :
If we activate the "candle" option we end up with :
Note that the candle option is based on the closing and opening price, if you use the indicator on another indicator output make sure to have the candle option off.
Length and Indicator Color
The closing price is infected by noise, and will rarely make a large sequence of consecutive up's/down's, the indicator can therefore be useful to detect consecutive sequence of length period, here 6 is selected on BTCUSD :
A consecutive up's/down's of period 6 can be considered a relatively rare event.
It is important to note that the color of the indicator used by default has nothing to do with the consecutive sequence detected, that is the indicator turning red doesn't necessarily mean that a consecutive down's sequence has occurred, but only that this sequence has occurred at a lower value than the precedent detected sequence. This is show'n below :
In order to make the indicator color based on the detected sequence check the "Color Based On Detected Sequence" option.
Conclusion
An original approach on filtering price variations has been proposed, i believe the indicator code is elegant as well as relatively efficient, and since high values of length can't really be used the indicator execution speed will remain relatively fast.
Thanks for reading !
Consecutive Candle Count Momentum StrategyVery simple strategy based on consecutive candle count. Simple but can be very profitable if you know how to execute.
Example:
- Buy when consecutive up closes exceeds 3
- Sell when consecutive down closes exceeds 3
For a buy signal, if price closes higher within 5 candles, it is defined as a win.
For a sell signal, if price closes lower within 5 candles, it is defined as a win.
Win rates for buy/sell signals are calculated over history of security.
Moving Average Consecutive Up/Down Strategy (by ChartArt)This simple strategy goes long (or short) if there are several consecutive increasing (or decreasing) moving average values in a row in the same direction. The bars can be colored using the raw moving average trend. And the background can be colored using the consecutive moving average trend setting. In addition a experimental line of the moving average change can be drawn.
The strategy is based upon the "Consecutive Up/Down Strategy" which was created by Tradingview.
All trading involves high risk; past performance is not necessarily indicative of future results. Hypothetical or simulated performance results have certain inherent limitations. Unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not actually been executed, the results may have under- or over-compensated for the impact, if any, of certain market factors, such as lack of liquidity. Simulated trading programs in general are also subject to the fact that they are designed with the benefit of hindsight. No representation is being made that any account will or is likely to achieve profits or losses similar to those shown.
Custom Indicator Clearly Shows If Bulls or Bears are in Control!The Two Versions of this Indicator I learned from Two Famous and Highly Successful Traders. This Indicator shows With No Lag Clear Up and Down Trends in Market by Documenting Clearly If Bulls or Bears are in Control. The Version In SubChart 1 Shows Consecutive Closes if the Current Close is Greater than of Less than the Midpoint of the Previous Bar (Why Midpoint Explained in Detail in 1st Post). The Version in SubChart 2 Shows Consecutive Closes that are Greater than or Less Than the Previous Close (Will Discuss Specific Uses in 1st Post). Works on Stocks, Forex, Futures, on All Timeframes.