Setup. Establish the Trend
This is the first phase of a 2 indicator set. This indicator includes Setup, lines (also known as TDST), Risk levels and some additions that are described below. Sequential Countdown is not included and will be part of the second script.
Part 1. The Price flip
The “Price Flip” occurs if the market’s price momentum is weak. It compares the current bar’s close with the close n bars earlier and then shifts the inverted comparison with m bars in the past.
The weak momentum identifies when the comparison’s reading crosses.
The “Bullish price flip” occurs when the current bar’s close price is higher than the close price four bars earlier and the prior bar’s close is lower than the close five price bars earlier.
That could be written in Pine as:
close > close and close < close[4+1]
The “Bearish price flip” (and the consecutive “Buy Setup”) requirements are inverted and won’t be described further.
The classic reading of the indicator suggests to compare the close price to the close price four (Price Flip Lookback Period) bars earlier.
That can be changed in the script’s options. Sources are defined as Source1 (current bar) and Source2 (n bars earlier). With the adjustable Lookback Period and Price Flip Shift, the script allows to build custom Setup Initialization Points (Price flip occurrence).
When the Setup initialization Point is established we can continue to the next step:
Part 2. Setup Count
Setup is a time-based technique to identify market trends. When the initialization point (Price Flip prerequisite) is found, the system measures the momentum by comparing the close price with the close n (Setup Lookback Period) price bars earlier and counts consecutive occurrences. Sources are defined in inputs as Source1 (current bar) and Source2 (n bars earlier).
The Sell Setup starts when the Bullish Price Flip occurs.
- If the consecutive bars’ close price is higher than the close price four bars earlier, the count increases by one.
Number 9 represents the “Setup Count Limit” (or just “Count Limit", if we are not in the “Sequential Countdown” scope) and is adjustable in the script’s inputs.
When the exhaustion point is met, the script allows you to decide what to do next:
- Start the new Setup count in the same direction. This option will allow the script to calculate Double and Triple consecutive Setups.
- Continue the count. The setup count will continue until a price flip in the opposite direction occurs.
- Stop the count and wait for the Price Flip occurrence for the new Setup Initialization.
Part 3. Setup Analysis
The Sell Setup Perfection :
- The Count limit bar’s high price is higher than the high price two and three bars earlier.
- The high price of a bar prior to Count limit bar is higher than the high price one and two bars earlier.
- Bar number 9's high price is higher than the high price of bar numbers 6 and 7 for the Count Limit Perfection.
- Bar number 8's high price is higher than the high price of bar numbers 6 and 7 for the prior to Count Limit bar Setup Perfection.
The Sell Setup Intersection :
- The Count limit bar’s low price is lower than the high price three or more (up to Setup Start bar) bars earlier.
- Bar number 8 or 9's low price is lower than the high price of bars number 6, 5, 4, 3, 2, 1.
The Setup Risk Lines :
The script looks for the highest bar of the Sell setup and adds the True Range of that bar to it to calculate the Risk Level.
Setup risk line is often used as a stop-loss from the counter-trend entry on the Setup occurrence. Another technique is to place counter-trend bids at that level to catch stop hunts, instead of taking a position right after the setup (or add to your position).
The Double and Triple Setup :
Double and Triple Setup occurs when 2 and 3 consecutive Setups are formed without a price flip between the occurrences.
This usually indicates a strong trend likely to pullback to the reload zone and continue with the Sequentials phase 2 - Countdown.
The script will print "D" or "T" letters above/below bar.
The Setup Reload Zone and Setup Extension :
The Reload Zone measures the distance between the first Setup Bar and the Risk Line, and divides it using logic, which suggests an entry into the market between the 0.618 and 0.764 levels. The entry is canceled if price breaks the Trend (TSDT) line.
The Extension Zone takes the same distance into account and suggests exiting positions opened in the Reload Zone, using the 1.618 and 2.618 Fibonacci levels.
The Indicators® are a collection of registered trademarks protected by U.S. trademark law. They all belong to Market Studies, LCC .
This study makes no commercial use of the trademarks. This script is for educational use and the implementation of Indicators© concepts (such as TD Setup, TDST, TD Countdown, TD Sequential) is based on my interpretation from the books “The New Science of Technical Analysis” and “DeMark on Day-Trading Options” by Tom .
Special thanks to:
@LucF, for sharing his wisdom, limitless help and efforts with the code and leading my intentions to open-source this script.
@scarf and @allanster, for helping with final cuts before this publication goes public.
And unlimited amount of Pine open-source publishers, that helped me to understand how the pine works.
All their life against the stream
Searching for a hook to catch on
And see their sun beam
Then suffocate in painful tortures
On cutting tables of callous men
Under a knife of handsome butchers
Emeralds are ripped away