Update - Build 76
This build contains many updates addressing various issues which surfaced during the ongoing beta test. Most of the changes are contained and featured in the strategy version of this script. The study (this script) mirrors those changes where applicable. Please use strategy version 107 with study version 76 as a matched set. Thank you all for your valuable input.
Complementary Mode
Complementary long and short modes are changed in this version. This modification broadens the scope of the feature thereby increasing the number of trades. This change is not backward compatible with previous versions and breaks existing templates. Complementary mode puts the system into a trend following bias long or short. The resultant script behavior is range trading along persistent price pressure.
Summary Report
Additional fields are added to the summary report in this build. The strategy version contains a margin call indicator which can be used to stress test the simulated account capital. The script summary report is the navy blue label that shows up at the live end of the chart. It contains useful information not produced in the TradingView performance report. The summary report has two sections the upper and lower. Elements of the lower section can be used to compare the study with the strategy version. The upper section contains elements useful in live trading.
Strategy Inputs
Two new fields are added to the inputs dialog box. The strategy version of this script has seven new inputs. These two plus five more intended to aid in producing a Sharpe Ratio for this script. The Sortino Ratio, R-Squared, Beta Calculation and others are also supported. Please see the strategy version for more information. The following fields have been added in this build:
- Expand Reentry Scope - When enabled this feature extends the “Reentry Bar Window” beyond the number of bars specified. The “Reentry Bar Window” together with the “Reentry Minimum Span” are a loss prevention mechanism intended to reduce the number of consecutive counter trades during spiking price moves. For example, if the market exhibits a powerful down swing the natural behavior of the range trading script is to enter long trades in anticipation of a reversal. If the long trade is stopped new trades in the same direction will be reduced while the market remains within the period defined by the “Reentry Bar Window” and within the price range defined by the “Reentry Minimum Span”. When “Expand Reentry Scope” input is enabled trades will continue to be reduced in the same direction as the most recent stop-loss. This feature will reduce the number of trades the backtest will produce but can come in handy when trading instruments which routinely experience large price swings. It can be especially useful when trading on low volume cryptocurrency exchanges.
- Composite Strength/Weakness - A new field was added to the long and short sections of the input dialog. The “Buy Composite Strength” and “Sell Composite Weakness” feature exhibits trend following behavior in its titular direction. Similar to the “Complementary Long/Short Mode” except new trades are generated not just excluded. This feature only works when exclusively “Long” or “Short” trading modes are selected. The basic premise is fewer trades are generated during the backtest when unidirectional modes are enabled. However, trading opportunities apparent on the chart are not taken since the configuration requires a strong pullback entry. Loosening the configuration permits more trades but at worse price points. This feature attempts to solve this problem by determining the composite price pressure and generating trades in the commensurate direction. When enabled, a more complete backtest with fewer dead spots is created. The result of the backtest, ideally, is range trading during indecisive market sessions and trend following during complementary price moves.