Trendoscope

Auto Harmonic Pattern - Backtester [Trendoscope]

Trendoscope Wizard 已更新   
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".


版本注释:
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.


Log Scale
Added option to scan patterns and project targets in log scale.

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.

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.
版本注释:
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.

仅限邀请脚本

仅限作者授权的用户访问此脚本,并且通常需要付费。您可以将其添加到收藏中,但是只有在向作者请求并获得许可之后,才能使用它。 请与Trendoscope联系以获取更多信息,或按照以下作者的说明进行操作。

在您100%信任脚本作者并了解脚本的工作原理之前,TradingView不建议您购买脚本并使用它。在很多情况下,您可以在我们的公共指标库中免费找到一个不错的开源替代品。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

作者的说明

Trial - www.trendoscope.io/trial Subscribe - www.trendoscope.io/pricing

想在图表上使用此脚本?

警告:请阅读,然后再请求访问权限。