123 Reversal Trading StrategyThe 123 Reversal Trading Strategy is a technical analysis approach that seeks to identify potential reversal points in the market by analyzing price patterns. This Pine Script™ code implements a version of this strategy, and here’s a detailed description:
Strategy Overview
Objective: The strategy aims to identify bullish reversal patterns using the 123 pattern and manage trades with a specified holding period and a 20-day moving average as an additional exit condition.
Key Components:
Holding Period: The number of days to hold a trade is adjustable, with the default set to 7 days.
Moving Average: A 200-day simple moving average (SMA) is used to determine an exitcondition based on the price crossing this average.
Pattern Recognition:
Condition 1: The low of the current day must be lower than the low of the previous day.
Condition 2: The low of the previous day must be lower than the low from three days ago.
Condition 3: The low two days ago must be lower than the low from four days ago.
Condition 4: The high two days ago must be lower than the high three days ago.
Entry Condition: All four conditions must be met for a buy signal.
Exit Condition: The position is closed either after the specified holding period or when the price reaches or exceeds the 200-day moving average.
Relevant Literature
Graham, B., & Dodd, D. L. (1934). Security Analysis. This classic work introduces fundamental analysis and technical analysis principles which are foundational to understanding patterns like the 123 reversal.
Murphy, J. J. (1999). Technical Analysis of the Financial Markets. Murphy provides an extensive overview of technical indicators and chart patterns, including reversal patterns similar to the 123 pattern.
Elder, A. (1993). Trading for a Living. Elder discusses various trading strategies and technical analysis techniques that complement the understanding of reversal patterns and their application in trading.
Risks and Considerations
Pattern Reliability: The 123 reversal pattern, like many technical patterns, is not foolproof. It can generate false signals, especially in volatile or trending markets. This may lead to losses if the pattern does not play out as expected.
Market Conditions: The strategy may perform differently under various market conditions. In strongly trending markets, reversal patterns might not be as reliable.
Lagging Indicators: The use of the 200-day moving average as an exit condition can be considered a lagging indicator. This means it reacts to price movements with a delay, which might result in late exits and missed profit opportunities.
Holding Period: The fixed holding period of 7 days may not be optimal for all market conditions or stocks. It is essential to adjust the holding period based on market dynamics and individual stock behavior.
Overfitting: The parameters used (like the number of days and moving average length) are set based on historical data. Overfitting can occur if these parameters are tailored too specifically to past data, leading to reduced performance in future scenarios.
Conclusion
The 123 Reversal Trading Strategy is designed to identify potential market reversals using specific conditions related to price lows and highs. While it offers a structured approach to trading, it is essential to be aware of its limitations and potential risks. As with any trading strategy, it should be tested thoroughly in various market conditions and adjusted according to the individual trading style and risk tolerance.
Harmonic Patterns
[strategy][1H] SPY slow stochastics
SPY slow stochastics
Overview
The "SPY Auto RSI Stochastics" strategy is designed to leverage a combination of Relative Strength Index (RSI) and Stochastic indicators to identify potential entry and exit points in trading the SPY $SP:SPX.
The technicals:
A simple yet effective strategy for identifying (reversal) trends on SPY (or any asset).
The logic is as follows:
1. Slow stochastics are effective at predicting momentum. They can also be used to effectively identify reversals.
2. A combination of slow and fast RSI (along with an SMA for the fast RSI) can be used to see potential changes in the directional trend of the underlying asset.
3. In order to reduce noise, a band in the middle of RSI values is ignored; think of this as the price converging and potential explosions (sometimes fake) on either side.
4. Outside this noise band, a crossover of fast RSI on slow RSI indicates an upward trend incoming.
5. A crossunder of fast RSI on slow RSI indicates a downward trend incoming.
Strategy Specific Notes -
1. Load this strategy on SPREADEX:SPX on an hourly chart for the best results.
2. This is a generic strategy, use it on anything - index, stocks, etc. You will need to adjust the parameters for the best results.
3. The RSI Upper defines the cutoff for two things -- threshold for entering a long AND exit signal for short. Likewise for RSI Lower.
4. To have alerts on the strategy, add this to your chart, be content with the backtesting results, select "strategy tester", the alert icon, replace the message body with "{{strategy.order.alert_message}}" without the ".
5. In my experience, the strategy won't be immediately profitable upon a signal but it does get there in the backtested results. Intuitively, this makes sense. Reversals take some time to kick in completely.
Inputs
- **slowRSILength**: Length parameter for the slow RSI calculation.
- **fastRSILength**: Length parameter for the fast RSI calculation.
- **smaRSILength**: Length parameter for the Simple Moving Average (SMA) of the fast RSI.
- **RSIUpperThreshold**: Upper threshold for the RSI, used in exit conditions.
- **RSILowerThreshold**: Lower threshold for the RSI, used in exit conditions.
- **RSIUpperDeadzone**: Upper deadzone threshold for the RSI.
- **RSILowerDeadzone**: Lower deadzone threshold for the RSI.
Strategy Logic
- **RSI Calculation**: The script calculates both slow and fast RSI values based on the provided lengths.
- **Entry Condition**: Entry conditions for long and short positions are based on the crossing of fast RSI over slow RSI and SMA RSI, respectively, along with avoidance of RSI deadzones and validation of trade time.
- **Exit Condition**: Exit conditions for both long and short positions are based on crossing RSI thresholds or opposite entry conditions.
Trade Management
- **Position Entry**: Long and short positions are entered based on predefined entry conditions.
- **Position Exit**: Positions are exited based on predefined exit conditions.
- **Alerts**: The script provides alert messages for entry and exit points.
Plotting
- **Slow RSI**: Plots the slow RSI on the chart.
- **SMA RSI**: Plots the Simple Moving Average of fast RSI on the chart.
Example Usage
The defaults work well for SPY on a 1H timeframe.
If you apply this to anything else DAX, EUSTX50, FTSE, CAC (these are what i have); tweak the input parameters.
Plotting
plot(slowRSI, "Slow RSI", color=color.green) //or fastRSI
plot(smaRSI, "SMA RSI", color=color.white)
Conclusion
The "SPY Auto RSI Stochastics" strategy combines RSI and Stochastic indicators to provide potential trade signals for the SPY ETF. Traders can use this strategy with proper risk management and analysis to enhance their trading decisions.
Auto Harmonic Pattern - Backtester [Trendoscope]We are finally here with the implementation of backtesting tool for Auto-Harmonic-Pattern-UltimateX .
CAUTION: THIS IS NOT A STRATEGY AND SHOULD NOT BE FOLLOWED BLINDLY. WE ENCOURAGE USERS TO UTILISE THIS AS BACKTESTING TOOL FOR BUILDING THEIR STRATEGY BASED ON HARMONIC PATTERNS
This script is based on our premium indicator - Auto-Harmonic-Pattern-UltimateX . In this script, along with implementation of scanning harmonic patterns, we provide various options via settings which enables users to build their own strategy based on harmonic patterns, use them with custom coded filters, backtest them on various tickers and timeframes.
Harmonic Patterns is concept and we can trade harmonic pattern in many ways. While general interest around harmonic patterns is to find reversal zones and use them for short term swing trades. But, using it along trend following strategies can also be very rewarding. Here is one of the educational idea I shared about using harmonic patterns for trend following. These are just few possibilities where users can explore further on how they want to trade this. The settings of this script are crafted in such a way that it enables users to explore all these possibilities.
🎲 Components
Chart components of this script is lighter compared to Auto Harmonic Pattern - UltimateX. This is because we want to keep lighter interface in order to support seamless execution of emulator. Since pine strategy framework does most of the things such as calculating profitability, keeping track of trades and results etc, display with respect to - "Closed Trade Stats" are removed from this script and "Open Trade Stats" are made lighter.
🎲 Settings
🎯 Trade Settings : Few important settings under this section are
Due to pine limitations, we will not be able to support both long and short in a same setup. Hence, users need to chose either long or short trade setup.
Entry/Base/Target play important role in defining your strategy.
Confluence is another important factor which lets users use multiple patterns at once as confirmation.
🎯 Zigzag Settings : Zigzag settings determine the size of patterns being formed.
Please note that smaller patterns may not yield very good results and larger patterns may take time to complete trade. Similarly higher depth can cause runtime issues. Recursive zigzag option is alternative to deep search algorithm.
🎯 Filters :
Filters enable users to select trades based on specific conditions. Ability to use external filter even allows writing and using custom filters to be used with this algorithm. Here is a video which explains how this can be done. HOW-TO-Use-external-filters
Pattern filters allow users to pick and chose patterns they want to trade. This can be done either individually or based on category
🎯 Alerts :
Apart from strategy specific alerts, the script also implements customisable alerts via pine alert() function. Alerts can be configured to send upon three conditions
When new pattern is created
When an existing pattern updates entry/stop/target due to safe repaint of D (Only happens when Trail Entry Price is selected)
When a pattern in trade closes either due to hitting stop or target
Important Note: Alerts fired via this method may not match the trades shown on chart as trades which are controlled via pine strategy emulator depends on various other factors such as pyramiding.
Alert template is customisable and users can make use of available placeholders to get dynamic data in alerts. Valid placeholders are
{alertType} - Alert type - New/Update/Close
{id} - Pattern Id
{ticker} - Ticker
{timeframe} - Chart timeframe
{price} - Current price
{patterns} - Identified pattern names
{direction} - Direction - Long/Short
{entry} - Entry Price
{stop} - Stop Price
{target} - Target Price
{orderType} - Limit/Stop - applicable for only New and Update types
{status} - Trade status. Valid values are Pending/Cancelled/Stopped/Success
Template is common for all custom alert types. Hence, updating the template will impact all custom alerts - New/Update/Close
{
"alert" : "{alertType}",
"id" : {id},
"ticker" : "{ticker}",
"timeframe" : "{timeframe}",
"price" : {price},
"patterns" : "{patterns}",
"direction" : "{direction}",
"entry" : {entry},
"stop" : {stop},
"target" : {target},
"orderType" : {orderType}
"status" : {status}
}
Here is a video on how to customise the alerts using templates and placeholders - HOW-TO-Customize-Alerts-With-Placeholders
🎯 Miscellaneous :
These are simple settings to control display and backtest bars. If you are running alerts, we suggest turning of Open Trades and Drawings and limit backtest to minimal value in order to improve efficiency of
🎯 Backtest Engine Parameters :
Default settings are optimised for trend following. Users are encouraged to play around with settings and filters to build strategy out of this tool.
Position sizing is not leveraged. Margin settings makes sure that trades cannot exceed capital.
All measures are taken to avoid repainting. Script does not use request.security and real time bars. This drastically reduces the risk of repainting in scripts.
If you are premium user, please select "Bar Magnifier".
Wolfe Strategy [Trendoscope]Hello Everyone,
Wish you all Merry X-Mas and happy new year. Lets start 2023 with fresh new strategy built on Wolfe Indicator. Details of the indicator can be found here
🎲 Wolfe Concept
Wolfe concept is simple. Whenever a wedge is formed, draw a line joining pivot 1 and 4 as shown in the chart below:
For simplicity, we will only consider static value for Target and Stop. But, entry is done based on breaking the triangle. Revised strategy looks something like this:
🎲 Settings
Settings are simple and details of each are provided via tooltips.
Out of these, the most important one is minimum risk reward ratio. If you set lower risk reward threshold then losing few trades may generate more losses than more winning trades. Similarly higher value will filter out most of the trades and may not work efficiently. Default value set to 1 to make sure optimal risk reward is present before placing trade. Also make note that since the entry bar is always moving towards stop, as and when pattern progress, the RR will also increase. Hence, a pattern which is below RR threshold may become good to trade at certain point of time in future.
🎲 Strategy Parameters
Default strategy parameters are initialised via definition. Margins are set to 100 to disable leveraged trades. Appropriate values are chosen for other parameters. These can be altered based on individual strategy and trading plan.
As the strategy concentrates on the single pattern, number of trades generated are comparatively less. But, there is chance to increase the algorithm further to catch more such patterns on larger scale. Will try to work on them in next versions.
🎲 Pine Strategy limitations
Backtest can only be done on one direction as pine strategy cannot have both long and short open trades together. Hence, it is mandatory to chose either long/short trades in settings.
Since pyramiding is limited to 1, there is possibility of a pattern not generating trade even though the entry conditions are met. They are just based on pine limitations and not necessarily mean patterns are not good for placing trades.
Strategy Myth-Busting #20 - HalfTrend+HullButterfly - [MYN]#20 on the Myth-Busting bench, we are automating the " I Found Super Easy 1 Minute Scalping System And Backtest It 100 Times " strategy from " Jessy Trading " who claims 30.58% net profit over 100 trades in a couple of weeks with a 51% win rate and profit factor of 1.56 on EURUSD .
This one surprised us quite a bit. Despite the title of this strategy indicating this is on the 1 min timeframe, the author demonstrates the backtesting manually on the 5 minute timeframe. Given the simplicity of this strategy only incorporating a couple of indicators, it's robustness being able to be profitable in both low and high timeframes and on multiple symbols was quite refreshing.
The 3 settings which we need to pay most attention to here is the Hull Butterfly length, HalfTrend amplitude and the Max Number Of Bars Between Hull and HalfTrend Trigger. Depending on the timeframe and symbol, these settings greatly impact the performance outcomes of the strategy. I've listed a couple of these below.
And as always, If you know of or have a strategy you want to see myth-busted or just have an idea for one, please feel free to message me.
This strategy uses a combination of 3 open-source public indicators:
Hull Butterfly Oscillator by LuxAlgo
HalfTrend by Everget
Trading Rules
5 min candles but higher / lower candles work too.
Stop loss at swing high/low
Take Profit 1.5x the risk
Long
Hull Butterfly gives us green column, Wait for HalfTrend to present an up arrow and enter trade.
Short
Hull Butterfly gives us a red column , Wait for HalfTrend to present a down arrow and enter trade.
Alternative Trading Settings for different time frames
1 Minute Timeframe
Move the Hull Butterfly length from the default 11 to 9
Move the HalfTrend Amplitude from the default 2 to 1
Enabling ADX Filter with a 25 threshold
2 Hour Timeframe
Move the HalfTrend Amplitude from the default 2 to 1
Laddered Take Profits from 14.5% to 19% with an 8% SL
Hyper Bot | Self Optimizing Buy & SellThis strategy primarily uses Bollinger Bands with custom improvements and alterations in entry exit signals which i have learned over the past years.
How to use?
Visit strategy settings. You will see checkboxes before all options, meaning they can be turned ON and OFF.
For "Long SL %" to work, the "LONG" should be enabled aswell. If Long is not enabled, changing numbers in "Long SL%" won't make any difference.
Likewise if you want to test take profit, then either long or short or both should be enabled with "TP Long%" or "TP Short%"
This wide customization is being provided for you to be able to test all possible variations and choose whichever best is working for you. Play around with the numbers of SL% and TP% and find best ones that work for you in terms of drawdown, risk to profit etc.
Commission 0.1% by default is included, if however your commissions are lower, please change them to get better results.
This strategy is mainly optimized for Cryptocurrencies, however if you wish to use for indices and commodities please DM me, i will provide customization services.
Enjoy!
© Copyright 2022 "M Tahreem Alam"
Liquidity_Zone by SebasVentuLiquidity_Zone by SebasVentu It is a strategy that shows the liquidity zones and also has a simulator
Es una estrategia que muestra las zonas de liquidez y ademas cuenta con un simulador
[Herif's] Harmonic Patterns ProjectionBullish and bearish 5-point patterns are based on various Fibonacci retracement levels and signify potential reversal zones (PRZ).
As they become 0%-80% complete, the dashed-line pattern will appear, displaying the PRZ and giving you time to prepare for a reversal.
Different combinations of specific fib retracements and extensions result in different patterns, and each is named for identification.
Bullish patterns signify a potential turn to the upside are colored green.
Bearish patterns signify a potential turn to the downside are colored red.
1- Live harmonic patterns which are still in trade with XABCD and ratio with labels.
2- Entry, Stop and Target levels on chart for all patterns.
in Settings:
Error Percent - This is error tollerance for matching pattern ratios. Cannot expect price ratios to be exactly as per books. Hence, adding few error tolerance will help identify patterns better. In this indicator defatult 1%
When there are multiple patterns on chart, Entry, Stop, and Target labels and lines are created with specific distance from each other to provide clarity to the users.
Trailing and Targets
1-Trailing Start Stage - Defines when to start trailing stop-loss. It is recommended to set this value to either Target 1 or Target 2. Disabling the trailing or setting too far away may lead to being in trade on ranging market for too long. This may also result in drawing errors related to distance from current bar.
2- Custom Target Levels - Target and stop levels are set to optimal values based on individual patterns. If you want to override these levels, use the available input option to override targets and chose your custom Target1, Target2, Target3 and Target4
All Pending Patterns you can enable or disable
Classic Patterns : Gartley , Bat, Butterfly , Crab , Deep Crab , Cypher , Shark , Nenstar
Anti Patterns: Anti Nenstar, Anti Shark , Anti Cypher , Anti Crab , Anti Butterfly , Anti Bat, Anti Gartley , Navarro 200
This is a Strategy version of indicator below