PROTECTED SOURCE SCRIPT

Zen

Mis à jour
The Theory of Entanglement (缠论) is one of the most widely studied trading theories in China, but it is much less known among traders outside. Its philosophy is based on human greed, hatred, delusion, arrogance and doubt, which reveal the most fundamental aspect of the market. Fractals, strokes, line segments and pivots are basic elements in the Theory of Entanglement. However, manually drawing them on an ever-changing chart is both challenging and time consuming, and may lead to incorrect interpretation of the market trend. This indicator aims to automate the process of drawing strokes, line segments, and pivots for three consecutive levels such as 1m, 5m, and 30m (similar to time frames). The operation is then based on the so-called “same-level decomposition” technique. Buying and selling points are automatically marked on the chart, as well as points where trend divergence and range divergence occurred, which often signals a trend reversal.

Relations between fractal, stroke, line segment, pivot, and some important definitions:
• Stroke: Connecting two adjacent top and bottom fractals with at least one candlestick in between.
• Line segment: Consists of an odd number of strokes, at least three strokes are required, and the first three strokes must have overlapping parts.
• Level: Levels generally correspond to time frames of the chart, such as 1w, 1d, 4h, 30m, 5m, 1m etc. Sub-level: The above levels are respectively the sub-levels of the previous level.
• Pivot: The part of a trend type at a certain level that is overlapped by at least three consecutive sub-level trend types.
• Trend type: There are two trend types: trend and range. In trend, there are also two types: rising trend and falling trend.
• Range: At any level, a completed trend type contains only one pivot.
• Trend: At any level, a completed trend type contains at least two pivots in the same direction in sequence, which is called a trend at this level.

List of drawings on the chart:
1. Thin black lines: Strokes at the current level.
2. Thick blue lines: Strokes at a higher level, also line segments at the current level.
3. Purple dotted lines: Line segments at a higher level, also strokes at two levels higher from the current one.
4. Blue shaded rectangles: Pivots at the sub-level in a rising trend or range.
5. Red shaded rectangles: Pivots at the sub-level in a falling trend or range.
6. Green shaded rectangles: Pivots at the current level in a rising trend or range.
7. Orange shaded rectangles: Pivots at the current level in a falling trend or range.

List of symbols and labels on the chart (above the candle: sell signal, below the candle: buy signal)
1. Purple triangles below the candle: double golden cross of Stochastic and MACD, buy signal
2. Purple triangles above the candle: double death cross of Stochastic and MACD, sell signal
3. Blue triangles below the candle: EMA5 crosses EMA13 up, buy signal
4. Red triangles above the candle: EMA5 crosses EMA13 down, sell signal
5. Green triangles below the candle: EMA5 crosses EMA55 up, buy signal
6. Orange triangles above the candle: EMA5 crosses EMA55 down, sell signal
7. Blue circles on the low point of the candle: bottom divergence occurred, buy signal
8. Red circles on the high point of the candle: top divergence occurred, sell signal
9. Blue "R" label below the candle: bottom divergence calculated from RSI occurred, buy signal
10. Red "R" label above the candle: top divergence calculated from RSI occurred, sell signal
11. Blue "M" label below the candle: bottom divergence calculated from MACD occurred, buy signal
12. Red "M" label above the candle: top divergence calculated from MACD occurred, sell signal
13. Blue "RM" label below the candle: bottom divergence calculated from both RSI and MACD occurred, buy signal
14. Red "RM" label above the candle: top divergence calculated from both RSI and MACD occurred, sell signal
15. Blue "1(R)", "1(M)", "1(RM)" labels below the candle: 1st buying point due to bottom trend divergence or range divergence calculated from RSI, MACD, and both RSI and MACD occurred, respectively, buy signal
16. Red "1(R)", "1(M)", "1(RM)" labels above the candle: 1st selling point due to top trend divergence or range divergence calculated from RSI, MACD, and both RSI and MACD occurred, respectively, sell signal
17. Blue "3" label below the candle: 3rd buying point, buy signal
18. Red "3" label above the candle: 3rd selling point, sell signal
19. Green "3" label below the candle: 3rd buying point of a higher-level pivot, buy signal
20. Orange "3" label above the candle: 3rd selling point of a higher-level pivot, sell signal
21. Yellow-shaded vertical areas: candles where volume spikes occurred
22. Short red horizontal lines: highest point of volume spikes, potential support or resistance
23. Short blue horizontal lines: lowest point of volume spikes, potential support or resistance
Notes de version
Improved algorithm for volume spikes calculation.
Notes de version
Fixed bugs in drawing pivots.
Notes de version
Improved method for setting alerts. To set alerts for buy and sell signals, switch to the trading time frame, then choose Create Alert under the Alerts menu:
• For golden crosses (triangle symbols under candles), choose Zen -> Cross Up -> Less Than -> Value -> 0.00
• For death crosses (triangle symbols above candles), choose Zen -> Cross Down -> Greater Than -> Value -> 0.00
• For buying points (blue “R”, “M”, “RM”, “1(R)”, “1(M)”, “1(RM)”, and “3” labels), choose Zen -> Buying Point -> Less Than -> Zen -> Reference Point
• For selling points (red “R”, “M”, “RM”, “1(R)”, “1(M)”, “1(RM)”, and “3” labels), choose Zen -> Selling Point -> Greater Than -> Zen -> Reference Point
Notes de version
1. Added labels for 2nd buying points and 2nd selling points
2. Added colors for bullish/bearish outside strokes and bullish/bearish outside line segments
3. To set alerts for outside strokes and outside line segments, switch to the trading time frame, then choose Create Alert under the Alerts menu:
• For bullish outside stroke, choose Zen -> Outside Stroke/Line Segment -> Inside Channel -> (Upper Bound) Value -> -5.00 -> (Lower Bound) Value -> -15.00
• For bearish outside stroke, choose Zen -> Outside Stroke/Line Segment -> Inside Channel -> (Upper Bound) Value -> 15.00 -> (Lower Bound) Value -> 5.00
• For bullish outside line segment, choose Zen -> Outside Stroke/Line Segment -> Inside Channel -> (Upper Bound) Value -> -15.00 -> (Lower Bound) Value -> -25.00
• For bearish outside line segment, choose Zen -> Outside Stroke/Line Segment -> Inside Channel -> (Upper Bound) Value -> 25.00 -> (Lower Bound) Value -> 15.00
Notes de version
Revised method for highlighting outside strokes and line segments.
Notes de version
Fixed minor bugs in drawing pivots.
Notes de version
Added alert settings for volume spikes. To set alerts for volume spikes, switch to the trading time frame, then choose Create Alert under the Alerts menu:
• For 1st percentile volume spikes, choose Zen -> Volume Spike -> Inside Channel -> (Upper Bound) Value -> 25.00 -> (Lower Bound) Value -> 15.00
• For 2nd percentile volume spikes, choose Zen -> Volume Spike -> Inside Channel -> (Upper Bound) Value -> 15.00 -> (Lower Bound) Value -> 5.00
Notes de version
Enabled parameter settings for user input.
Notes de version
Added automatic drawing of Fibonacci retracement. Options for the input source: None, Last Stroke, Last Outside Stroke, Last Line Segment, Last Outside Line Segment.
Notes de version
1. Fixed minor bugs in drawing higher-level pivots. 2. Added black triangles above and under the candle for potentially incoming crash and rally.
Notes de version
1. Added options to turn off the display of triangles above and under candles (alerts are not affected). 2. Added two additional Fibonacci retracement levels: 1.382 and 1.272. 3. Added options to adjust label font size.
Notes de version
Major update !!! Now four levels of strokes and three levels of pivots are shown on the same chart. For example, on the 1m viewing time frame, the longest stroke at the highest level is the stroke of the 1d time frame.
Minor changes: 1. Added labels to indicate the end of higher level and higher higher level line segments. 2. Improved speed in drawing strokes and line segments.
Note: Alerts set previously may need to be updated or reset.
Notes de version
Added one more option for Auto Fibonacci Retracement: Last Line Segment (Higher Level).
Notes de version
Minor display adjustment.
Notes de version
1. Fixed minor issues in drawing current-level pivots. 2. Added an option to change label text color. 3. Added display of price information when moving mouse over labels. 4. Added the 2nd and 3rd buying and selling points on higher levels.
Notes de version
1. Fixed minor errors in drawing current-level pivots. 2. Added options to change colors of crossover symbols.
Notes de version
Minor bug fix.
Notes de version
1. Added labels for higher-level divergence points and the 1st buying and selling points. 2. Added Auto Fibonacci Extension with two input options: a. Last line segment, b. Last line segment (higher level).
Notes de version
1. Fixed errors when setting alerts under certain time frames. 2. Added options to extend Auto Fibonacci levels to left and right.
Notes de version
1. Completed adding all three levels of 1st, 2nd and 3rd buying and selling points, and all three levels of divergence points.
Notes de version
1. Adjusted label locations for better display. 2. Increased max_bars_back to resolve issues in setting alerts.
Notes de version
Fixed errors in drawing higher-level pivots.
Notes de version
Another major update! Now the lowest-level strokes are formed by connecting top and bottom fractals, exactly following the original theory. Also the labels (R, M, RM, 1(R), 1(M), 1(RM), 2, 3 etc.) are only displayed after top or bottom fractals appear, which provide more reliable entry signals.
Notes de version
Minor bug fix.
Notes de version
Redefined conditions for forming lowest-level strokes from fractals.
Notes de version
1. Improved method for volume spikes calculation. 2. Added requirement for forming strokes.
Notes de version
Fixed display errors.
Notes de version
Fixed errors in drawing strokes.
Notes de version
Fixed display errors on certain time frames.
Notes de version
Fixed display issues for free account.
Notes de version
1. Fixed display issues for certain time frames. 2. Added an option for changing the ratio between strokes, for regarding a single stroke as a line segment.
Notes de version
1. Converted the source code to Pine version 5. 2. Resolved issues in drawing lowest-level pivots.
Notes de version
1. Added an option to require minimum three overlapping candles along each stroke. 2. Fixed minor display issues.
Notes de version
1. Resolved issues in drawing strokes. 2. Adjusted the allowable range of the Ratio parameter in settings.
Notes de version
Minor bug fix.
Notes de version
1. Added options for changing pivot border colors. 2. Adjusted default parameters for volume spikes.
Notes de version
Added an option to select the type of strokes: Old style (minimum five candles per stroke), New style (minimum four candles per stroke).
Notes de version
For those who use the previous version of this indicator, there is no need to update.
Notes de version
The maintainance of this indicator has been stopped. Please do not update this version.
由于一些特定原因,本指标已停止维护,请之前使用此指标的用户不要再更新。
OscillatorsTrend Analysis

Script protégé

Ce script est publié en code source fermé et vous pouvez l'utiliser librement. Vous pouvez le préférer pour l'utiliser sur un graphique. Vous ne pouvez pas visualiser ou modifier son code source.

Vous voulez utiliser ce script sur un graphique ?

Clause de non-responsabilité