INVITE-ONLY SCRIPT

Auto Harmonic Pattern - Backtester [Trendoscope]

Aktualisiert
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.

https://www.tradingview.com/x/p70czv2O/

🎲 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.


https://www.tradingview.com/x/ZqVpAn8C/

🎯 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.

https://www.tradingview.com/x/5Ys6BfHF/

🎯 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

https://www.tradingview.com/x/0mtxJ0gE/

Pattern filters allow users to pick and chose patterns they want to trade. This can be done either individually or based on category
https://www.tradingview.com/x/b1dEiLDJ/

🎯 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


Here is a video on how to customise the alerts using templates and placeholders - HOW-TO-Customize-Alerts-With-Placeholders

https://www.tradingview.com/x/xx10F8nO/

🎯 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
https://www.tradingview.com/x/ilFX4zX5/

🎯 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".


https://www.tradingview.com/x/AvLhRIDC/

Versionshinweise
Update Bx1.1

Option to Enable/Disable force closure of positions upon pattern closure
Disabling this option will keep positions open even if patterns are closed. But, the script will continue to cancel pending orders when patterns close.

Regular Inverse Mode
Added option to trade regular and inverse mode. In inverse mode, you will be able to backtest the outcome of trading against the pattern. With this Entry % and Stop % parameters are replaced with new Stop/Entry/Target ratios of regular mode.

https://www.tradingview.com/x/nGx4SzOI/

Log Scale
Added option to scan patterns and project targets in log scale.
https://www.tradingview.com/x/ZwmA7zuD/

Custom Risk Calculation
Added option to calculate custom risk based on percent of equity or cash. In this method, trade position is calculated based on the risk amount rather than absolute position size. This can help to set equal risk for all trades irrespective of the pattern size.
https://www.tradingview.com/x/AkkwfHfy/

Note
When Force Close of position upon pattern closure is disabled, that means, the positions can run for longer time. This might block future pattern trades if the pyramiding is set to lower number. Hence, if the force close option is disabled, it is ideal to use higher number of pyramiding with very low position size. Which means, you will get into more trades but with smaller position size.

Default margin is set to 100 and also strategy position calculation logic are restricted not to use leveraged positions. This means, overall position size can never go beyond your capital.
Versionshinweise
Major Update Bx1.2

  • Migrated whole code to use type based libraries - that helps us structure the code in a more modular way and run more efficiently.
  • Strict mode for ratio checks enabled. This helps reduce the number of patterns for those who want to be selective.
  • Removed Use Confluence option as it is less useful than initial estimation.
  • Inverse trade mode is removed. Will reevaluate adding this option back in the future.
Chart patternsHarmonic PatternshewhomustnotbenamedTrend Analysistrendoscope

Skript nur auf Einladung

Der Zugriff auf dieses Skript ist auf vom Autor autorisierte User beschränkt und normalerweise kostenpflichtig. Sie können es zu Ihren Favoriten hinzufügen, aber Sie können es nur verwenden, nachdem Sie die Erlaubnis angefordert und vom Autor erhalten haben. Kontaktieren Sie Trendoscope für weitere Informationen oder folgen Sie den Anweisungen des Autors unten.

TradingView empfiehlt nicht, ein Script zu kaufen, wenn Sie den Autor nicht zu 100 % als vertrauenswürdig halten, oder nicht verstehen, wie das Script funktioniert. In vielen Fällen können Sie auch eine gute und kostenlose Open-Source-Alternative in unseren Community-Scripts entdecken.

Hinweise des Autors

Möchten Sie dieses Skript auf einem Chart verwenden?

Warnung: Bitte lesen Sie dies, bevor Sie Zugriff anfordern.

Haftungsausschluss