andyhitchman

TD Setup and Countdown

***********************************************************
TD Sequential Setup and Countdown.
(c) Andrew Hitchman, 2017. All rights reserved.
***********************************************************
An implementation of Tom DeMark's (https://en.wikipedia.org/wiki/Thomas_DeM...) Sequential Setup and Countdown indication.
Based on the rules described at https://oxfordstrat.com/indicators/td-se...


Tips:
======
If you make money using this indicator, then please show your appreciation by sending a donation to:
BTC: 1Gy4fZLSTw7WFszFspJzhkbwCsdJqgRq1a
ETH: 0xaadd9e54031fc7a58c35bb79bd4a0ba50a32f94a
Dash: XimNeFbU41ZAHTtraDeZaWQoX4Jdm5az6Z


Features:
==========
Setup counts long/short (Encircled number above bar)
-------------------------------------------------------------------------
Close exceeds the close 4 bars earlier in the direction of the setup.
Setup must be contiguous. It resets if a close fails the test.

'Perfect' setups (Filled encircled 8 or 9 setup above bar)
----------------------------------------------------------------------------
The high exceeds the high 2 bars earlier in the direction of the setup.

Countdown long/short (Encircled number below bar)
----------------------------------------------------------------------
After a complete (9) setup, increment count for each close:
-- above the high of two bars earlier (rising short countdown).
-- below the low of two bars earlier (falling long countdown).
Is not contiguous, but resets if a new reversing setup completes, or if the high or low exceeds the extreme high or low of the triggering setup.
The setup exteme high/low recycles based on the fib rules desccribed.

'Perfect' countdown (Filled encircled 13 countdown below bar)
-----------------------------------------------------------------------------------
When the 13th high or low exceeds the close of countdown bar 8

Colour
----------
Green for rising setups/countdowns
Red for falling setups/countdowns
Reversible in configuration.

Variations from the rules: Does not implement the 'true high/low' rules. Uses simple high/lows.
Introduces 'perfection', and used this rather than defering the countdown 13.


How to trade:
==============

Works more reliably on longer timeframes, but is functional on any timeframe.
A '9' (or perfect '8') signals a potential reversal. Use with price action and candestick patterns and other trends & indicators for support analysis.
A '13' countdown is a stronger reversal indicator, with the same caveats as above.
A '13' on or near a '9' setup is an extremely strong signal.
'9' setups or '13' countdowns across multiple timeframes are the best possible signal. e.g. a monthly 9, a weekly 9, a daily 9.


Bug Reports / Issues:
======================
Please report bugs, isssues or suggest improvements by PM on Trading View https://www.tradingview.com/u/andyhitchm...


Change History:
===============
24.0 Initial development and first publication
Release Notes: Fix bug where countdown completion and setup completion on the same bar would prevent new countdown starting
Release Notes: Added TD Setup Trend Support and Resistance
Release Notes: Fixed bug in TDST and countdown recycling. Thanks @cmos.
Release Notes: Option to recycle setup on next bar. Requested by numerous people.
Release Notes: Fix regression to restore countdown to start on the bar that completes setup. Thanks to @fernandofurtado
Release Notes: Small update to prevent countdown 1's from repeating
Release Notes: Added TD Price Flip defaulting to on, gives cleaner setups after price pivots. Minor bug spotted by @fernandofurtado fixed.
Release Notes: TD Risk lines show the potential risk in a trade and a possible stop price. Another bug spotted by @fernandofurtado fixed.
Release Notes: Stricter definition of perfected setups and use of true range for TD Risk all suggested by @fernandofurtado.
Release Notes: Experimental feature: volatility smoothing; considers close in addition to close in setups. Numbers show in black.

Intended to allow for some 'whipsaw' action in volatile assets (e.g. crypto).

Off by default. Enable via format dialog.
Release Notes: Fix breaking change in underlying engine by adding max_bars_back=900 to study.
Release Notes: Add update comment
Release Notes: Fix issue found by namecnp where perfected countdowns were not correctly determined due to cd 8 being carried.
Release Notes: Fix issue where countdown is created in first bars of chart even when there has been no setup (thx namecnp).
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Want to use this script on a chart?