PercentX Trend Follower [Trendoscope]"Trendoscope" was born from our trading journey, where we first delved into the world of trend-following methods. Over time, we discovered the captivating allure of pattern analysis and the exciting challenges it presented, drawing us into exploring new horizons. However, our dedication to trend-following methodologies remains steadfast and continues to be an integral part of our core philosophy.
Here we are, introducing another effective trend-following methodology, employing straightforward yet powerful techniques.
🎲 Concepts
Introducing the innovative PercentX Oscillator , a representation of Bollinger PercentB and Keltner Percent K. This powerful tool offers users the flexibility to customize their PercentK oscillator, including options for the type of moving average and length.
The Oscillator Range is derived dynamically, utilizing two lengths - inner and outer. The inner length initiates the calculation of the oscillator's highest and lowest range, while the outer length is used for further calculations, involving either a moving average or the opposite side of the highest/lowest range, to obtain the oscillator ranges.
Next, the Oscillator Boundaries are derived by applying another round of high/low or moving average calculations on the oscillator range values.
Breakouts occur when the close price crosses above the upper boundary or below the lower boundary, signaling potential trading opportunities.
🎲 How to trade a breakout?
To reduce false signals, we employ a simple yet effective approach. Instead of executing market trades, we use stop orders on both sides at a certain distance from the current close price.
In case of an upper side breakout, a long stop order is placed at 1XATR above the close, and a short stop order is placed at 2XATR below the close. Conversely, for a lower side breakout, a short stop order is placed at 1XATR below the close, and a long stop order is placed at 2XATR above the ATR. As a trend following method, our first inclination is to trade on the side of breakout and not to find the reversals. Hence, higher multiplier is used for the direction opposite to the breakout.
The script provides users with the option to specify ATR multipliers for both sides.
Once a trade is initiated, the opposite side of the trade is converted into a stop-loss order. In the event of a breakout, the script will either place new long and short stop orders (if no existing trade is present) or update the stop-loss orders if a trade is currently running.
As a trend-following strategy, this script does not rely on specific targets or target levels. The objective is to run the trade as long as possible to generate profits. The trade is only stopped when the stop-loss is triggered, which is updated with every breakout to secure potential gains and minimize risks.
🎲 Default trade parameters
Script uses 10% equity per trade and up to 4 pyramid orders. Hence, the maximum invested amount at a time is 40% of the equity. Due to this, the comparison between buy and hold does not show a clear picture for the trade.
Feel free to explore and optimize the parameters further for your favorite symbols.
🎲 Visual representation
The blue line represents the PercentX Oscillator, orange and lime colored lines represent oscillator ranges. And red/green lines represent oscillator boundaries. Oscillator spikes upon breakout are highlighted with color fills.
Trendoscope
Master Supertrend Strategy [Trendoscope]Here is the strategy version of the indicator - Master Supertrend
Options and variations are same throughout.
🎲 Variations
Following variations are provided in the form of settings.
🎯 Range Type
Instead of ATR, different types of ranges can be used for stop calculation. Here is the complete list used in the script.
Plus/Minus Range* - Calculates plus range and minus range for each candle and uses them for different sides of stop calculation
Ladder ATR - Based on the existing concept of Ladder ATR defined in Supertrend-Ladder-ATR
True Range - True range derived from standard function ta.tr
Standard Deviation - Standard deviation of close prices
🎯 Applied Calculation
In standard ATR, rma of TR is used for calculations. But, the application calculation provides option to users to use different mechanisms. It can be a type of moving average or few other types of calculations.
Available values are
sma
ema
hma
rma
wma
high
median
🎯 Other options
Few other options provided are
Use Close Price - If selected stops are calculated based on the close price instead of high/low prices
Wait for Close If selected, change of supertrend direction is calculated based on close price instead of high/low prices
Diminishing Stop Distance - When selected, stop distance for the trend direction can only reduce and cannot increase. This option is useful for keeping the tight stops on strong trends.
🎯 Plus Minus Range*
One of the range type used is Plus/Minus Range. What it means and how are these ranges calculated? Let's have a look.
Plus Range is an upward movement of a candle from its last price or open price whichever is lower.
Minus Range is a downward movement of a candle from its last price or open price whichever is higher.
This divides True Range into two separate range for positive and negative side.
Note : Effectiveness on daily charts are quire visible. However, if you want to use it for lower timeframes, please play around with settings before settling on suitable configuration.
Band-Zigzag - TrendFollower Strategy [Trendoscope]Strategy Time!!!
Have built this on my earlier published indicator Band-Zigzag-Trend-Follower . This is just one possible implementation of strategy on Band-Based-Zigzag .
🎲 Notes
Experimental prototype. Not financial advise and strategy not guaranteed to make money despite backtest results
Not created or tested for any specific instrument or timeframe
Test and adopt with own risk
🎲 Strategy
This is trend following strategy built based on Bands and Zigzag. Traits of trend following strategies are
Lower win rate (Yes, thats right)
High risk reward (Compensates low win rate)
Higher drawdown
If market is choppy, trend following methods suffer.
The script implements few points to overcome the negatives such as lower win rate and higher drawdown by actively assessing pivots on the direction of trend along. This helps us take regular profits and exit on time during the end of trend. Most of the other concepts are defined and explained in indicator - Band-Zigzag-Trend-Follower and Band-Based-Zigzag
Defining a trend following method is simple. Basic rule of trend following is Buy High and Sell Low (Yes, you heard it right). To explain further - methodology involve finding an established trend which is flying high and join the trend with proper risk and optimal stop. Once you get into the trade, you will not exit unless there is change in the trend. Or in other words, the parameters which you used to define trend has reversed and the trend is not valid anymore.
🎯 Using bands
When price breaks out of upper bands (example, Bollinger Band , Keltener Channel, or Donchian Channel), with a pre determined length and multiplier, we can consider the trend to be bullish and similarly when price breaks down the lower band, we can consider the trend to be bearish .
🎯 Using Pivots
Simple logic using zigzag or pivot points is that when price starts making higher highs and higher lows, we can consider this as uptrend. And when price starts making lower highs and lower lows, we can consider this as downtrend. There are few supertrend implementations I have published in the past based on zigzags and pivot points .
Drawbacks of both of these methods is that there will be too many fluctuations in both cases unless we increase the reference length. And if we increase the reference length, we will have higher drawdown.
🎯 Band Based Zigzag Method
Here we use bands to define our pivot high and pivot low - this makes sure that we are identifying trend only on breakouts as pivots are only formed on breakouts
Our method also includes pivot ratio to cross over 1.0 to be able to consider it as trend. This means, we are waiting for price also to make new high high or lower low before making the decision on trend. But, this helps us ignore smaller pivot movements due to the usage of bands.
I have also implemented few tricks such as sticky bands (Bands will not contract unless there is breakout) and Adaptive Bands (Band will not expand unless price is moving in the direction of band). This makes the trend following method very robust.
To avoid fakeouts, we also use percentB of high/low in comparison with price retracement to define breakout.
🎲 Settings
Settings are fairly simpler and are explained as below. You will find most of the required information in tooltips.
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.