­[e2] Setup

e2e4mfck Premium Updated   
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.
เอกสารเผยแพร่: quickfix
เอกสารเผยแพร่: ___VERSION 1.5

》 Stealth Setup.
Stealth Setup occurs when:
1) Market closed at the price flip and new setup count started
2) During that candle the opposite direction count limit was reached but didn't sustained (closed more/less then 4(by default) bars earlier).

If turned on in the options ("Show Stealth Setup"):
- Stealth Setup is marked with "S" char.
- Trend Support/Resistance are calculated from that setup, as it was completed.
- Draw a regular Setup rectangle with dashed lines.
- Statistics count it as a regular completed Setup.

》 Statistics improvement.
- Statistics could be hidden in the tooltips from the script's options. Just hover the mouse.
- Count number of Setups in a row.
- Convert number of bars into Weeks/Days/Hours/Minutes format. (Credits to Kodify - https://kodify.net/tradingview/date-time...)
- Statistics offset function and label redraw method updated (Credits to LucF and midtownsk8rguy)

》Other updates.
- Double and Triple Trend calculation bug fixed.
- Code refactored ( PineScript Coding Conventions )
- Setup bug with the Continuous count fixed.
- Setup location could be changed from the script's options (Separately for Buy and Sell Setup)
เอกสารเผยแพร่: Fixed bugs:
- 10001 candle
- Intraday barsToDate calculation

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

ด้วยจิตวิญญาณของ TradingView อย่างแท้จริง ผู้เขียนสคริปต์นี้ได้เผยแพร่เป็นโอเพนซอร์ส เพื่อให้ผู้ค้าสามารถเข้าใจและตรวจสอบได้ ไชโยให้กับผู้เขียน! คุณสามารถใช้ได้ฟรี แต่การใช้รหัสนี้ซ้ำในสิ่งพิมพ์อยู่ภายใต้กฎของบ้าน คุณสามารถตั้งเป็นรายการโปรดเพื่อใช้บนชาร์ตได้


ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ เงื่อนไขการใช้บริการ