­[e2] Setup

Sequentials Phase 1

Setup. Establish the Trend
 This is the first phase of a 2 indicator set. This indicator includes Setup, Support and Resistance 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[4] and close[1] < close[4+1] 
The number 4 represents the “Price Flip Lookback Period”. The number 1 is a “Price Flip Shift”.

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.
 The count continues until the Setup Count Limit (point of exhaustion, by default: 9) and stops the count if the consecutive occurrence requirement is broken.
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.
When the Setup Count reaches the Count Limit, the script will evaluate the established Setup and check for a Setup's "Perfection", "Intersection" and "Double" or "Triple" Setup occurrences.

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.
If the Count Limit is set to 9 the Setup Perfection could be defined as::
  • 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.
If the Count Limit is set to 9 the Setup Intersection could be defined as:
  • 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 Fibonacci Retracement 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 Support/Resistance (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 DeMark 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 DeMark 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 Demark .

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.
從收藏腳本中移除 新增至收藏腳本
Pisces swimming through the river
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


This is magnificent!
+5 回覆
@scarf, indeed, thx for helping ;)
Thank you for all that you do! Looking forward to giving this one a go.
+3 回覆
@BMoom, Feel free to ask if you have any questions ;)
I definitely agreed as scarf comment "this is magnificent!"
The system nice and clean easy to read and understand what going on; thank you so much e2e4mfck for your generous shared =D
+2 回覆
@ICEKI, Thx for support!
Very few coders on TradingView can display that amount of information on a chart without turning it into mush. You achieve masterfully balanced, quality visuals that work seamlessly—of the kind Edward Tufte would show in his books. Kudos and respect.
+2 回覆
@LucF, Whats the point of the information if it is not readable? Those visuals intended to provide information to the human trader, algos and robots just read the variables.
@LucF, The community won't see this script without all your efforts @LucF, intended or not ;)
I am very grateful to you. I admire your work.
+1 回覆
首頁 股票篩選器 外匯篩選器 加密貨幣篩選器 全球財經日曆 如何運作 圖表功能 價格 推薦朋友 網站規則 幫助中心 網站 & 經紀商解決方案 小工具 圖表解決方案 輕量圖表庫 部落格 & 新聞 推特
概覽 個人資料設定 賬戶和賬單 推薦朋友 我的客服工單 幫助中心 發表的想法 粉絲 正在關注 私人訊息 在線聊天 登出