Macros Kill Zones Fusionadas (:20 - :40) / :50 - :10)Tiempo y precio ICT
Macros :20 - :40 representa el momento en que el algoritmo institucional confirma dirección y ejecuta desplazamiento tras inducir la liquidez de apertura.
Macros :50 - :10 es la fase de manipulación o acumulación previa al desplazamiento principal.
Time and Price in ICT
Macros :20 - :40 represent the moment when the institutional algorithm confirms direction and executes the displacement after inducing opening liquidity.
Macros :50 - :10 mark the manipulation or accumulation phase that occurs before the main displacement.
Cari dalam skrip untuk "纳斯达克指数期货cfd"
BIG BUY/SELL BY DANIEL KATZENSTEINAfter 10 years of trading, I decided to develop an indicator that suits me and shows large buys and sells.
Smart Money Concepts URUGUAYSmart money concept, Bos , choch , liquidiciones con niveles marcados con lineas perfecto
MTF 20 SMA Table - DXY**MTF 20 SMA Table - Multi-Timeframe Trend Analysis Dashboard**
**Overview:**
This indicator provides a comprehensive multi-timeframe analysis dashboard that displays the relationship between price and the 20-period Simple Moving Average (SMA) across four key timeframes: 15-minute, 1-hour, 4-hour, and Daily. It's designed to help traders quickly identify trend alignment and potential trading opportunities across multiple timeframes at a glance.  It's definitely not perfect but has helped me speed up my backtesting efforts as it's worked well for me eliminating flipping back and forth between timeframes excpet when I have confluence on the table, then I check the HTF.
**How It Works:**
The indicator creates a table overlay on your chart showing three critical metrics for each timeframe:
1. **Price vs SMA (Row 1):** Shows whether price is currently above (bullish) or below (bearish) the 20 SMA
   - Green = Price Above SMA
   - Red = Price Below SMA
2. **SMA Direction (Row 2):** Indicates the trend direction of the SMA itself over a lookback period
   - Green (↗ Rising) = Uptrend
   - Red (↘ Falling) = Downtrend
   - Gray (→ Flat) = Ranging/Consolidation
3. **Strength (Row 3):** Displays the distance between current price and the SMA in pips
   - Purple background = Strong move (>50 pips away)
   - Orange background = Moderate move (20-50 pips)
   - Gray background = Weak/consolidating (<20 pips)
   - Text color: Green for positive distance, Red for negative
**Key Features:**
- **Customizable Table Position:** Place the table anywhere on your chart (9 position options)
- **Adjustable SMA Lengths:** Modify the SMA period for each timeframe independently (default: 20)
- **Direction Lookback Settings:** Fine-tune how far back the indicator looks to determine SMA direction for each timeframe
- **Flat Threshold:** Set the pip threshold for determining when an SMA is "flat" vs trending (default: 5 pips)
- **DXY Optimized:** Calculations are calibrated for the US Dollar Index (1 pip = 0.01)
**Best Use Cases:**
1. **Trend Alignment:** Identify when multiple timeframes align in the same direction for higher probability trades
2. **Divergence Spotting:** Detect when lower timeframes diverge from higher timeframes (potential reversals)
3. **Entry Timing:** Use lower timeframe signals while higher timeframes confirm overall trend
4. **Strength Assessment:** Gauge how extended price is from the mean (SMA) to avoid overextended entries
**Settings Guide:**
- **SMA Settings Group:** Adjust the SMA period for each timeframe (15M, 1H, 4H, Daily)
- **SMA Direction Group:** Control lookback periods to determine trend direction
  - 15M: Default 5 candles
  - 1H: Default 10 candles
  - 4H: Default 15 candles
  - Daily: Default 20 candles
- **Flat Threshold:** Set sensitivity for "flat" detection (lower = more sensitive to ranging markets)
**Trading Strategy Examples:**
1. **Trend Following:** Look for all timeframes showing the same direction (all green or all red)
2. **Pullback Trading:** When Daily/4H are green but 15M/1H show red, wait for lower timeframes to flip green for entry
3. **Ranging Markets:** When multiple SMAs show "flat", consider range-bound strategies
**Important Notes:**
- This is a reference tool only, not a standalone trading system
- Always use proper risk management and combine with other analysis methods
- Best suited for trending instruments like indices and major forex pairs
- Calculations are optimized for DXY but can be used on other instruments (pip calculations may need adjustment)
**Credits:**
Feel free to modify and improve this code! Suggestions for enhancements are welcome in the comments.
---
**Installation Instructions:**
1. Add the indicator to your TradingView chart
2. Adjust the table position via settings to avoid overlap with price action
3. Customize SMA lengths and lookback periods to match your trading style
4. Monitor the table for timeframe alignment and trend confirmation
---
This indicator is published as open source for the community to learn from and improve upon. Happy trading! 📈
Z-Score Bands + SignalsZ-Score Statistical Market Analyzer 
 A multi-dimensional market structure indicator based on standardized deviation & regime logic 
 English Description 
Concept
This indicator builds a statistical model of price behaviour by converting every candle’s movement into a Z-score — how many standard deviations each close is away from its moving average.
It visualizes the normal distribution structure of returns and provides adaptive entry signals for both Mean Reversion and Breakout regimes.
Rather than predicting price direction, it measures statistical displacement from equilibrium and dynamically adjusts the decision logic according to the market’s volatility regime.
⚙️ Main Components
Z-Score Bands (±1σ, ±2σ, ±3σ)
– The core structure visualizes volatility boundaries based on rolling mean and standard deviation.
– Price outside ±2σ often indicates statistical extremes.
Dual Signal Systems
Mean Reversion (MRL / MRS): when price (or return z-score) crosses back inside ±2σ bands.
Breakout (BOL / BOS): when price continues to expand beyond ±2σ.
Volatility Regime Classification
The indicator detects whether the market is currently in a low-vol or high-vol regime using percentile statistics of σ.
Low vol → Mean Reversion preferred
High vol → Breakout preferred
🧠  Adaptive Switches 
 
 A. Freeze MA/σ - Use previous-bar stats to avoid repainting and lag.	
 B. Confirm on Close - Only generate signals once the base-timeframe bar closes (eliminates look-ahead bias).	
 C. Return-based Signal - Use log-return Z-score instead of price deviation — normalizes volatility across assets.	
 D. Outlier Filter - Exclude bars with abnormal single-bar returns (e.g., >20%). Reduces false spikes.	
 E. Regime Gating - Automatically switch between Mean Reversion and Breakout logic depending on volatility percentile.
 	
Each module can be toggled individually to test different statistical behaviours or tailor to a specific market condition.
📊 Interpretation
When the histogram of returns approximates a normal distribution, mean-reversion logic is often more effective.
When price persistently drifts beyond ±2σ or ±3σ, the distribution becomes leptokurtic (fat-tailed) — a breakout structure dominates.
Hence, this tool can help you:
Identify whether an asset behaves more “Gaussian” or “fat-tailed”;
Select the correct trading regime (MR or BO);
Quantitatively measure market tension and volatility clusters.
🧩 Recommended Use
Works on any timeframe and any asset.
Best used on liquid instruments (e.g., XAU/USD, indices, major FX pairs).
Combine with volume, sentiment or structural filters to confirm signals.
For strategy automation, pair with the companion script:
🧠 “Z-Score Strategy • Multi-Source Confirm (MRL/MRS/BOL/BOS)”.
⚠️ Disclaimer
This script is designed for educational and research purposes.
Statistical deviation ≠ directional prediction — use with sound risk management.
Past distribution patterns may shift under new volatility regimes.
==================================================================================
 中文说明(简体) 
概念简介
该指标基于价格的统计分布原理,将每根 K 线的波动转化为标准化的 Z-Score(标准差偏离值),用于刻画市场处于均衡或偏离状态。
它同时支持 均值回归(Mean Reversion) 与 突破延展(Breakout) 两种逻辑,并可根据市场波动结构自动切换策略模式。
⚙️ 主要功能模块
Z-Score 通道(±1σ / ±2σ / ±3σ)
用滚动均值与标准差动态绘制的统计波动带,价格超出 ±2σ 区域通常意味着极端偏离。
双信号系统
MRL / MRS(均值回归多空):价格重新回到 ±2σ 以内时触发。
BOL / BOS(突破延展多空):价格持续运行在 ±2σ 之外时触发。
波动率分层
自动识别市场处于高波动还是低波动区间:
低波动期 → 适合均值回归逻辑;
高波动期 → 适合突破趋势逻辑。
🧠 A–E 模块说明
A. 固定统计参数:使用上一根 K 线的均值和标准差,防止重绘。	
B. 收盘确认信号:仅在当前时间框架收盘后生成信号,避免前视偏差。	
C. 收益率信号模式:采用对数收益率的 Z-Score,更具普适性。	
D. 异常波过滤:忽略单根极端波动(如 >20%)的噪声信号。	
E. 波动率调节逻辑:根据市场处于高/低波动区间,自动切换 MRL/MRS 或 BOL/BOS。
	
📊 应用解读
如果收益率分布接近正态分布 → 市场倾向震荡,MRL/MRS 效果较佳;
若价格频繁偏离 ±2σ 或 ±3σ → 市场呈现“肥尾”分布,趋势延展占主导。
因此,该指标的核心目标是:
识别当前市场的统计结构类型;
根据波动特征自动切换交易逻辑;
提供结构化、可量化的市场状态刻画。
💡 使用建议
适用于所有时间框架与金融品种。
建议结合成交量或结构性指标过滤。
若用于策略回测,可搭配同名 “Z-Score Strategy • Multi-Source Confirm” 策略脚本。
⚠️ 免责声明
本指标仅用于研究与教学,不构成任何投资建议。
统计偏离 ≠ 趋势预测,实际市场行为可能在不同波动结构下改变。
Volumen Abreviado📌 Indicator Description:
Abbreviated Volume (K / M)
This indicator displays each candle’s volume in an abbreviated format (K for thousands, M for millions, B for billions), making it easier to read and avoiding overly large numbers on the chart.
Key Features:
Volume histogram colored by candle direction (green: bullish, red: bearish, gray: neutral).
Configurable volume average line.
Label showing the abbreviated volume on the latest bar.
Optimized Y-axis scale to display compact values.
Perfect for:
Traders who want to quickly read volume without being distracted by large numbers.
Charts with high trading volume where full numbers are hard to read.
Fast analysis in stocks, crypto, or futures markets.
How to Use:
Add the indicator to your chart.
Adjust the average period in the settings.
Toggle the last-bar label on or off based on your preference.
✅ Works with any time frame and market.
3-Candle PDFThe Dynamic Fusion Indicator (DFI) is a powerful analytical tool designed to identify high-probability trading opportunities by combining trend momentum, volatility, and volume flow into one clear signal. It adapts in real time to changing market conditions, highlighting optimal entry and exit zones with intuitive color coding. The DFI filters out market noise using a hybrid smoothing algorithm, ensuring clarity even in choppy environments. Suitable for all timeframes and instruments, it helps traders anticipate reversals, confirm trends, and manage risk more effectively. Whether you’re scalping or swing trading, the DFI provides a confident, data-driven edge in any market.
2-Candle PDFThe Dynamic Fusion Indicator (DFI) is a powerful analytical tool designed to identify high-probability trading opportunities by combining trend momentum, volatility, and volume flow into one clear signal. It adapts in real time to changing market conditions, highlighting optimal entry and exit zones with intuitive color coding. The DFI filters out market noise using a hybrid smoothing algorithm, ensuring clarity even in choppy environments. Suitable for all timeframes and instruments, it helps traders anticipate reversals, confirm trends, and manage risk more effectively. Whether you’re scalping or swing trading, the DFI provides a confident, data-driven edge in any market.
Multi-Session Viewer and AnalyzerFully customizable multi-session viewer that takes session analysis to the next level. It allows you to fully customize each session to your liking. Includes a feature that highlights certain periods of time on the chart and a Time Range Marker.
It helps you analyze the instrument that you trade and pinpoint which times are more volatile than others. It also helps you choose the best time to trade your instrument and align your life schedule with the market.
NZDUSD Example:
- 3 major sessions displayed.
- Although this is NZDUSD, Sydney is not the best time to trade this pair. Volatility picks up at Tokyo open.
- I have time to trade in the evening from 18:00 to 22:00 PST. I live in a different time zone, whereas market is based on EST. How does the pair behave during the time I am available to trade based on my time zone? Time Range Marker feature allows you to see this clearly on the chart (black lines).
- I have some time in the morning to trade during New York session, but there is no way I am waking up at 05:00 PST. 06:30 PST seems doable. Blue highlighted area is good time to trade during New York session based on what Bob said. It seem like this aligns with when I am available and when I am able to trade. Volatility is also at its peak.
- I am also available to trade between London close and Tokyo open on some days of the week, but... based on what I see, green highlighted area is clearly showing that I probably don't want to waste my time trading this pair from London close and until Tokyo open. I will use this time for something else rather than be stuck in a range.
Spooky Time (10/31/25) [VTB]Get ready to add some eerie fun to your charts this Halloween! "Spooky Time" is a lighthearted indicator that draws a festive, animated Halloween scene right on your TradingView chart. Perfect for traders who want to celebrate the spooky season without missing a beat on the markets. Whether you're analyzing stocks, crypto, or forex, this overlay brings a touch of holiday spirit to your setup.
#### Key Features:
- **Jack-o'-Lantern Pumpkin**: A detailed, glowing pumpkin with carved eyes, nose, and a jagged mouth. The eyes and mouth cycle through black (off), yellow, and red glows for a subtle animation effect, giving it that classic haunted vibe.
- **Flickering Candle**: A wax candle with a wick and an animated flame that shifts positions slightly across three frames, mimicking a real flickering light. The flame color changes between yellow, red, and orange for added dynamism.
- **Spider Web and Spider**: A spiral web with radial lines, complete with a creepy-crawly spider. The spider's legs animate with small movements, as if it's ready to pounce—perfect for that extra spooky touch!
- **Customization Options**: Toggle the "Desiringmachine" label on/off, choose its position on the chart (e.g., Bottom Center), and select the text color. The entire scene is positioned relative to the chart's open price and ATR for better scaling.
- **Animation Cycle**: The whole setup uses a simple 3-frame animation based on bar_index, making it feel alive without overwhelming your chart.
This indicator is purely visual and non-intrusive—it doesn't plot any trading signals or data, so it won't interfere with your strategies. Just add it to your chart for some Halloween cheer during your trading sessions!
**Date Note**: Timed for Halloween 2025 (10/31/25)—feel the spooky energy!
**Happy Halloween!!!** 🎃👻🕸️
MAHAR K Stochastic IndicatorWhat It Does
%K line calculates fast stochastic of _src over length, then re-smoothed twice: sk (smoothK), %D (smoothD), and slower %F (smoothF).
Plots the three lines, draws 80/50/20 bands, and highlights extreme values by drawing red circles when sk hits 100 and green when it hits 0.
Notable Details
sma_signal chooses the smoothing kernel (SMA, EMA, WMA, DEMA). ma() delegates to the selected function and contains a VWMA branch even though VWMA is not listed in the input options.
A custom dema() helper implements the classic double EMA.
stOBOS is always true, so the ternary wrappers around the circle plots can be simplified.
Risk / Edge Cases
If highestHigh == lowestLow (flat price over the window) the %K calculation divides by zero, yielding na. Consider guarding against that or defaulting to previous values.
To actually expose VWMA, add it to the input options; otherwise remove the dead code branch.
Next Steps
Decide whether to safeguard the denominator before plotting.
Align the smoothing options with the available choices and prune the redundant conditionals if desired.
Obj_XABCD_HarmonicLibrary   "Obj_XABCD_Harmonic" 
Harmonic XABCD Pattern object and associated methods. Easily validate, draw, and get information about harmonic patterns. See example code at the end of the script for details.
 init_params(pct_error, pct_asym, types, w_e, w_p, w_d) 
  Create a harmonic parameters object (used by xabcd_harmonic object for pattern validation and scoring).
  Parameters:
     pct_error (float) : Allowed % error of leg retracement ratio versus the defined harmonic ratio
     pct_asym (float) : Allowed leg length/period asymmetry % (a leg is considered invalid if it is this % longer or shorter than the average length of the other legs)
     types (array) : Array of pattern types to validate (1=Gartley, 2=Bat, 3=Butterfly, 4=Crab, 5=Shark, 6=Cypher)
     w_e (float) : Weight of ratio % error (used in score calculation, dft = 1)
     w_p (float) : Weight of PRZ confluence (used in score calculation, dft = 1)
     w_d (float) : Weight of Point D / PRZ confluence (used in score calculation, dft = 1)
  Returns: harmonic_params object instance. It is recommended to store and reuse this object for multiple xabcd_harmonic objects rather than creating new params objects unnecessarily.
 init(x, a, b, c, d, params, tp, p) 
  Initialize an xabcd_harmonic object instance from a given set of points
If the pattern is valid, an xabcd_harmonic object instance is returned. If you want to specify your
own validation and scoring parameters, you can do so by passing a harmonic_params object (params).
Or, if you prefer to do your own validation, you can explicitly pass the harmonic pattern type (tp)
and validation will be skipped. You can also pass in an existing xabcd_harmonic instance if you wish
to re-initialize it (e.g. for re-validation and/or re-scoring).
  Parameters:
     x (point type from dlmysolutions/Pattern/1) : Point X
     a (point type from dlmysolutions/Pattern/1) : Point A
     b (point type from dlmysolutions/Pattern/1) : Point B
     c (point type from dlmysolutions/Pattern/1) : Point C
     d (point type from dlmysolutions/Pattern/1) : Point D
     params (harmonic_params) : harmonic_params used to validate and score the pattern. Validation will be skipped if a type (tp) is explicitly passed in.
     tp (int) : Pattern type
     p (xabcd_harmonic) : xabcd_harmonic object instance to initialize (optional, for re-validation/re-scoring)
  Returns: xabcd_harmonic object instance if a valid harmonic, else na
 init(xX, xY, aX, aY, bX, bY, cX, cY, dX, dY, params, tp, p) 
  Initialize an xabcd_harmonic object instance from a given set of x and y coordinate values.
If the pattern is valid, an xabcd_harmonic object instance is returned. If you want to specify your
own validation and scoring parameters, you can do so by passing a harmonic_params object (params).
Or, if you prefer to do your own validation, you can explicitly pass the harmonic pattern type (tp)
and validation will be skipped. You can also pass in an existing xabcd_harmonic instance if you wish
to re-initialize it (e.g. for re-validation and/or re-scoring).
  Parameters:
     xX (int) : Point X bar index (required)
     xY (float) : Point X price/level (required)
     aX (int) : Point A bar index (required)
     aY (float) : Point A price/level (required)
     bX (int) : Point B bar index (required)
     bY (float) : Point B price/level (required)
     cX (int) : Point C bar index (required)
     cY (float) : Point C price/level (required)
     dX (int) : Point D bar index
     dY (float) : Point D price/level
     params (harmonic_params) : harmonic_params used to validate and score the pattern. Validation will be skipped if a type (tp) is explicitly passed in.
     tp (int) : Pattern type
     p (xabcd_harmonic) : xabcd_harmonic object instance to initialize (optional, for re-validation/re-scoring)
  Returns: xabcd_harmonic object instance if a valid harmonic, else na
 init(pattern, params, tp, p) 
  Initialize an xabcd_harmonic object instance from a given pattern
If the pattern is valid, an xabcd_harmonic object instance is returned. If you want to specify your
own validation and scoring parameters, you can do so by passing a harmonic_params object (params).
Or, if you prefer to do your own validation, you can explicitly pass the harmonic pattern type (tp)
and validation will be skipped. You can also pass in an existing xabcd_harmonic instance if you wish
to re-initialize it (e.g. for re-validation and/or re-scoring).
  Parameters:
     pattern (pattern type from dlmysolutions/Pattern/1) : Pattern
     params (harmonic_params) : harmonic_params used to validate and score the pattern. Validation will be skipped if a type (tp) is explicitly passed in.
     tp (int) : Pattern type
     p (xabcd_harmonic) : xabcd_harmonic object instance to initialize (optional, for re-validation/re-scoring)
  Returns: xabcd_harmonic object instance if a valid harmonic, else na
 method get_name(p) 
  Get the pattern name
  Namespace types: xabcd_harmonic
  Parameters:
     p (xabcd_harmonic) : Instance of xabcd_harmonic object
  Returns: Pattern name (string)
 method get_symbol(p) 
  Get the pattern symbol
  Namespace types: xabcd_harmonic
  Parameters:
     p (xabcd_harmonic) : Instance of xabcd_harmonic object
  Returns: Pattern symbol (1 byte string)
 method get_pid(p) 
  Get the Pattern ID. Patterns of the same type with the same coordinates will have the same Pattern ID.
  Namespace types: xabcd_harmonic
  Parameters:
     p (xabcd_harmonic) : Instance of xabcd_harmonic object
  Returns: Pattern ID (string)
 method set_target(p, target, target_lvl, calc_target) 
  Set value for a target. Use the calc_target parameter to automatically calculate the target for a specific harmonic ratio.
  Namespace types: xabcd_harmonic
  Parameters:
     p (xabcd_harmonic) : Instance of xabcd_harmonic object
     target (int) : Target (1 or 2)
     target_lvl (float) : Target price/level (required if calc_target is not specified)
     calc_target (string) : Target to auto calculate (required if target is not specified)
Options:  
  Returns: Target price/level (float)
 method erase_pattern(p) 
  Erase the pattern
  Namespace types: xabcd_harmonic
  Parameters:
     p (xabcd_harmonic) : Instance of xabcd_harmonic object
  Returns: p
 method draw_pattern(p, clr) 
  Draw the pattern
  Namespace types: xabcd_harmonic
  Parameters:
     p (xabcd_harmonic) : Instance of xabcd_harmonic object
     clr (color) 
  Returns: Pattern lines
 
 method erase_label(p) 
  Erase the pattern label
  Namespace types: xabcd_harmonic
  Parameters:
     p (xabcd_harmonic) : Instance of xabcd_harmonic object
  Returns: p
 method draw_label(p, clr, txt_clr, txt, tooltip) 
  Draw the pattern label. Default text is the pattern name.
  Namespace types: xabcd_harmonic
  Parameters:
     p (xabcd_harmonic) : Instance of xabcd_harmonic object
     clr (color) : Label color
     txt_clr (color) : Text color
     txt (string) : Label text
     tooltip (string) : Tooltip text
  Returns: Label
 harmonic_params 
  Validation and scoring parameters for a Harmonic Pattern object (xabcd_harmonic)
  Fields:
     pct_error (series float) : 		Allowed % error of leg retracement ratio versus the defined harmonic ratio
     pct_asym (series float) 
     types (array) 
     w_e (series float) 
     w_p (series float) 
     w_d (series float) 
 xabcd_harmonic 
  Harmonic Pattern object
  Fields:
     bull (series bool) : 			Bullish pattern flag
     tp (series int) 
     x (point type from dlmysolutions/Pattern/1) 
     a (point type from dlmysolutions/Pattern/1) 
     b (point type from dlmysolutions/Pattern/1) 
     c (point type from dlmysolutions/Pattern/1) 
     d (point type from dlmysolutions/Pattern/1) 
     r_xb (series float) 
     re_xb (series float) 
     r_ac (series float) 
     re_ac (series float) 
     r_bd (series float) 
     re_bd (series float) 
     r_xd (series float) 
     re_xd (series float) 
     score (series float) 
     score_eAvg (series float) 
     score_prz (series float) 
     score_eD (series float) 
     prz_bN (series float) 
     prz_bF (series float) 
     prz_xN (series float) 
     prz_xF (series float) 
     t1Hit (series bool) : 		Target 1 flag
     t1 (series float) 
     t2Hit (series bool) 
     t2 (series float) 
     sHit (series bool) : 			Stop flag
     stop (series float) : 			Stop level
     entry (series float) : 		Entry level
     eHit (series bool) 
     e (point type from dlmysolutions/Pattern/1) 
     invalid_d (series bool) 
     pLines (array) 
     pLabel (series label) 
     pid (series string) 
     params (harmonic_params)
PatternLibrary   "Pattern" 
Pattern object definitions and functions. Easily draw and keep track of patterns, legs, and points.
Supported pattern types:
Type			Leg validation		# legs
"xabcd"			Direction			3 or 4 (point D not required)
"zigzag"		Direction			>= 2
"free"			None				>= 2
Summary of exported types and associated methods/functions:
type point					A point on the chart (x,y)
draw_label()			Draw a point label
erase_label()			Erase a point label
type leg					A pattern leg (i.e. point A to point B)
leg_init()				Initialize/instantiate a leg
draw()					Draw a leg
erase()					Erase a leg
leg_getLineTerms()		Get the slope and y-intercept of a leg
leg_getPrice()			Get price (Y) at a given bar index (X) within a leg
type pattern				A pattern (set of at least 2 connected legs)
pattern_init()			Initialize/instantiate a pattern
draw()					Draw a pattern
erase()					Erase a pattern
*See bottom of the script for example usage*
 erase_label(this) 
  Delete the point label
  Parameters:
     this (point) : Point
  Returns: Void
 draw_label(this, position, clr, transp, txt_clr, txt, tooltip, size) 
  Draw the point label
  Parameters:
     this (point) : Point
     position (string) 
     clr (color) 
     transp (float) 
     txt_clr (color) 
     txt (string) 
     tooltip (string) 
     size (string) 
  Returns: line
 leg_init(a, b, prev, next, line) 
  Initialize a pattern leg
  Parameters:
     a (point) : Point A (required)
     b (point) : Point B (required)
     prev (leg) : Previous leg
     next (leg) : Next leg
     line (line) : Line
  Returns: New instance of leg object
 erase(this) 
  Delete the pattern leg
  Parameters:
     this (leg) : Leg
  Returns: Void
 erase(this) 
  Delete the pattern lines
  Parameters:
     this (pattern) : Pattern
  Returns: Void
 draw(this, clr, style, transp, width) 
  Draw the pattern leg
  Parameters:
     this (leg) : Leg
     clr (color) : Color
     style (string) : Style ("solid", "dotted", "dashed", "arrowleft", "arrowright")
     transp (float) : Transparency
     width (int) : Width
  Returns: line
 draw(this, clr, style, transp, width) 
  Draw the pattern
  Parameters:
     this (pattern) : Pattern
     clr (color) : Color
     style (string) : Style ("solid", "dotted", "dashed", "arrowleft", "arrowright")
     transp (float) : Transparency
     width (int) : Width
  Returns: line 
 leg_getLineTerms(this) 
  Get the slope and y-intercept of a leg
  Parameters:
     this (leg) : Leg
  Returns:  
 leg_getPrice(this, index) 
  Get the price (Y) at a given bar index (X) within the leg
  Parameters:
     this (leg) : Leg
     index (int) : Bar index
  Returns: Price (float)
 pattern_init(legs, tp, name, subType, pid) 
  Initialize a pattern object from a given set of legs
  Parameters:
     legs (array) : Array of pattern legs (required)
     tp (string) : Pattern type ("zigzag", "xabcd", or "free". dft = "free")
     name (string) : Pattern name
     subType (string) : Pattern subtype
     pid (string) : Pattern Identifier string
  Returns: New instance of pattern object, if one was successfully created
 pattern_init(points, tp, name, subType, pid) 
  Initialize a pattern object from a given set of points
  Parameters:
     points (array) 
     tp (string) : Pattern type ("zigzag", "xabcd", or "free". dft = "free")
     name (string) : Pattern name
     subType (string) : Pattern subtype
     pid (string) : Pattern Identifier string
  Returns: New instance of pattern object, if one was successfully created
 point 
  A point on the chart (x,y)
  Fields:
     x (series int) : 				Bar index (x coordinate)
     y (series float) 
     label (series label) 
 leg 
  A pattern leg (point A to point B)
  Fields:
     a (point) : 				Point A
     b (point) 
     deltaX (series int) 
     deltaY (series float) 
     prev (leg) 
     next (leg) 
     retrace (series float) 
     line (series line) 
 pattern 
  A pattern (set of at least 2 connected legs)
  Fields:
     legs (array) 
     type (series string) 
     subType (series string) 
     name (series string) 
     pid (series string)
EMA6 or SMA6 Touch AlertThis script monitors the market and notifies you whenever the price touches either the 6-period EMA or the 6-period SMA.
It helps identify potential pullbacks, reaction points, or entry zones, as price interaction with these moving averages often signals short-term market shifts.
What the script does:
Calculates the EMA 6 and SMA 6
Detects if price touches either moving average within the candle
Plots both lines on the chart for visibility
Allows you to set alerts to receive automatic notifications
Best suited for:
Scalping
Day Trading
Pullback Entries
Short-term trend reactions
DrawLibrary   "Draw" 
Draw patterns, lines, labels, shapes etc.
 pat_colors(bull, buLn, beLn, ltxt) 
  Parameters:
     bull (bool) 
     buLn (color) 
     beLn (color) 
     ltxt (color) 
 size(size) 
  Parameters:
     size (string) 
 label_style(style) 
  Parameters:
     style (string) 
 line_style(style) 
  Parameters:
     style (string) 
 font_size(size) 
  Parameters:
     size (string) 
 xabcd(xX, xY, aX, aY, bX, bY, cX, cY, dX, dY, iE, bull, bu, be) 
  Draw XABCD pattern
  Parameters:
     xX (int) 
     xY (float) 
     aX (int) 
     aY (float) 
     bX (int) 
     bY (float) 
     cX (int) 
     cY (float) 
     dX (int) 
     dY (float) 
     iE (float) 
     bull (bool) 
     bu (color) 
     be (color) 
 xabcd_inProgress(bull, type, tLimit, entry, stop, t1, t2, bcNt, bcFt, xaNt, xaFt, xX, xY, aY, bX, bY, cY, dX, dY, cBu, cBe, lTxt) 
  draw PRZ, entry, stop, targets, and projected reversal paths for XABCD pattern
  Parameters:
     bull (bool) 
     type (int) 
     tLimit (int) 
     entry (float) 
     stop (float) 
     t1 (float) 
     t2 (float) 
     bcNt (float) 
     bcFt (float) 
     xaNt (float) 
     xaFt (float) 
     xX (int) 
     xY (float) 
     aY (float) 
     bX (int) 
     bY (float) 
     cY (float) 
     dX (int) 
     dY (float) 
     cBu (color) 
     cBe (color) 
     lTxt (color) 
 xabcd_incInProgress(bull, type, tLimit, entry, xX, xY, aY, bX, bY, cX, cY, dY, cBu, cBe, lTxt) 
  Parameters:
     bull (bool) 
     type (int) 
     tLimit (int) 
     entry (float) 
     xX (int) 
     xY (float) 
     aY (float) 
     bX (int) 
     bY (float) 
     cX (int) 
     cY (float) 
     dY (float) 
     cBu (color) 
     cBe (color) 
     lTxt (color) 
 xabcd_inProgress2(bull, tLimit, entry, stop, t1, t2, xadl, bcdl, xcdl, xX, xY, bX, bY, dX, dY, cBu, cBe, lTxt) 
  draw PRZ, entry, stop, targets, and projected reversal paths for XABCD pattern
  Parameters:
     bull (bool) 
     tLimit (int) 
     entry (float) 
     stop (float) 
     t1 (float) 
     t2 (float) 
     xadl (float) 
     bcdl (float) 
     xcdl (float) 
     xX (int) 
     xY (float) 
     bX (int) 
     bY (float) 
     dX (int) 
     dY (float) 
     cBu (color) 
     cBe (color) 
     lTxt (color) 
 eHitLbl(x, e, dX, dY, bull, lOnly) 
  Draw entry hit label
  Parameters:
     x (int) 
     e (float) 
     dX (int) 
     dY (float) 
     bull (bool) 
     lOnly (bool) 
 tHitLbl(x, tgt, eX, eY, bull) 
  Draw target hit label
  Parameters:
     x (int) 
     tgt (float) 
     eX (int) 
     eY (float) 
     bull (bool) 
 sHitLbl(x, s, eX, eY, bull) 
  Draw stop hit label
  Parameters:
     x (int) 
     s (float) 
     eX (int) 
     eY (float) 
     bull (bool) 
 level(y, x, type, length, extend, padding, b_style, colr, txt_color, txt, txt_loc, txt_size) 
  Draw a level (box)
  Parameters:
     y (float) 
     x (int) 
     type (int) 
     length (int) 
     extend (string) 
     padding (float) 
     b_style (string) 
     colr (color) 
     txt_color (color) 
     txt (string) 
     txt_loc (string) 
     txt_size (string) 
 incTtTxt(tp, name, xbr, xbre, acr, acre, bcN, bcF, xaN, xaF, score, e) 
  Parameters:
     tp (int) 
     name (string) 
     xbr (float) 
     xbre (float) 
     acr (float) 
     acre (float) 
     bcN (float) 
     bcF (float) 
     xaN (float) 
     xaF (float) 
     score (float) 
     e (float)
TALibrary   "TA" 
General technical analysis functions
 div_bull(pS, iS, cp_length_after, cp_length_before, pivot_length, lookback, lookback_pivs, no_broken, pW, iW, hidW, regW) 
  Test for bullish divergence
  Parameters:
     pS (float) : Price series (float)
     iS (float) : Indicator series (float)
     cp_length_after (simple int) : Bars after current (divergent) pivot low to be considered a valid pivot (optional int)
     cp_length_before (simple int) : Bars before current (divergent) pivot low to be considered a valid pivot (optional int)
     pivot_length (simple int) : Bars before and after prior pivot low to be considered valid pivot (optional int)
     lookback (simple int) : Bars back to search for prior pivot low (optional int)
     lookback_pivs (simple int) : Pivots back to search for prior pivot low (optional int)
     no_broken (simple bool) : Flag to only consider divergence valid if the pivot-to-pivot trendline is unbroken (optional bool)
     pW (simple float) : Weight of change in price, used in degree of divergence calculation (optional float)
     iW (simple float) : Weight of change in indicator, used in degree of divergence calculation (optional float)
     hidW (simple float) : Weight of hidden divergence, used in degree of divergence calculation (optional float)
     regW (simple float) : Weight of regular divergence, used in degree of divergence calculation (optional float)
  Returns:  
flag = true if divergence exists (bool)
degree = degree (strength) of divergence (float)
type = 1 = regular, 2 = hidden (int)
lx1 = x coordinate 1 (int)
ly1 = y coordinate 1 (float)
lx2 = x coordinate 2 (int)
ly2 = y coordinate 2 (float)
 div_bear(pS, iS, cp_length_after, cp_length_before, pivot_length, lookback, lookback_pivs, no_broken, pW, iW, hidW, regW) 
  Test for bearish divergence
  Parameters:
     pS (float) : Price series (float)
     iS (float) : Indicator series (float)
     cp_length_after (simple int) : Bars after current (divergent) pivot high to be considered a valid pivot (optional int)
     cp_length_before (simple int) : Bars before current (divergent) pivot highto be considered a valid pivot (optional int)
     pivot_length (simple int) : Bars before and after prior pivot high to be considered valid pivot (optional int)
     lookback (simple int) : Bars back to search for prior pivot high (optional int)
     lookback_pivs (simple int) : Pivots back to search for prior pivot high (optional int)
     no_broken (simple bool) : Flag to only consider divergence valid if the pivot-to-pivot trendline is unbroken (optional bool)
     pW (simple float) : Weight of change in price, used in degree of divergence calculation (optional float)
     iW (simple float) : Weight of change in indicator, used in degree of divergence calculation (optional float)
     hidW (simple float) : Weight of hidden divergence, used in degree of divergence calculation (optional float)
     regW (simple float) : Weight of regular divergence, used in degree of divergence calculation (optional float)
  Returns:  
flag = true if divergence exists (bool)
degree = degree (strength) of divergence (float)
type = 1 = regular, 2 = hidden (int)
lx1 = x coordinate 1 (int)
ly1 = y coordinate 1 (float)
lx2 = x coordinate 2 (int)
ly2 = y coordinate 2 (float)
 test_cd(cd, bc, xa, xc, ad, pErr, p_types) 
  Validate CD leg of XABCD
  Parameters:
     cd (float) 
     bc (float) 
     xa (float) 
     xc (float) 
     ad (float) 
     pErr (float) 
     p_types (array) 
 pat_xabcd_testSym(xax, abx, bcx, cdx, pAsym) 
  Validate ΔX symmetry of XABCD pattern
  Parameters:
     xax (int) 
     abx (int) 
     bcx (int) 
     cdx (int) 
     pAsym (float) 
 harmonic_xabcd_validate(xX, xY, aX, aY, bX, bY, cX, cY, dX, dY, pErr, pAsym, gart, bat, bfly, crab, shark, cyph) 
  Validate harmonic XABCD pattern
  Parameters:
     xX (int) : X coordinate of point X (int)
     xY (float) : Y coordinate of point X (float)
     aX (int) : X coordinate of point A (int)
     aY (float) : Y coordinate of point A (float)
     bX (int) : X coordinate of point B (int)
     bY (float) : Y coordinate of point B (float)
     cX (int) : X coordinate of point C (int)
     cY (float) : Y coordinate of point C (float)
     dX (int) : X coordinate of point D (int)
     dY (float) : Y coordinate of point D (float)
     pErr (float) : Acceptable percent error of leg ratios (does not apply to legs defined within a range) (float)
     pAsym (float) : Acceptable percent asymmetry of leg ΔX (each leg tested against average ΔX of prior legs) (float)
     gart (bool) : Flag to validate Gartley pattern (bool)
     bat (bool) : Flag to validate Bat pattern (bool)
     bfly (bool) : Flag to validate Butterfly pattern (bool)
     crab (bool) : Flag to validate Crab pattern (bool)
     shark (bool) : Flag to validate Shark pattern (bool)
     cyph (bool) : Flag to validate Cypher pattern (bool)
  Returns:  
flag = true if valid harmonic
t1 = true if valid gartley
t2 = true if valid bat
t3 = true if valid butterfly
t4 = true if valid crab
t5 = true if valid shark
t6 = true if valid cypher
 harmonic_xabcd_validateIncomplete(xX, xY, aX, aY, bX, bY, cX, cY, pErr, pAsym, gart, bat, bfly, crab, shark, cyph) 
  Validate the first 3 legs of a harmonic XABCD pattern
  Parameters:
     xX (int) : X coordinate of point X (int)
     xY (float) : Y coordinate of point X (float)
     aX (int) : X coordinate of point A (int)
     aY (float) : Y coordinate of point A (float)
     bX (int) : X coordinate of point B (int)
     bY (float) : Y coordinate of point B (float)
     cX (int) : X coordinate of point C (int)
     cY (float) : Y coordinate of point C (float)
     pErr (float) : Acceptable percent error of leg ratios (does not apply to legs defined within a range) (float)
     pAsym (float) : Acceptable percent asymmetry of leg ΔX (each leg tested against average ΔX of prior legs) (float)
     gart (bool) : Flag to validate Gartley pattern (bool)
     bat (bool) : Flag to validate Bat pattern (bool)
     bfly (bool) : Flag to validate Butterfly pattern (bool)
     crab (bool) : Flag to validate Crab pattern (bool)
     shark (bool) : Flag to validate Shark pattern (bool)
     cyph (bool) : Flag to validate Cypher pattern (bool)
  Returns:  
flag = true if valid harmonic
t1 = true if valid gartley
t2 = true if valid bat
t3 = true if valid butterfly
t4 = true if valid crab
t5 = true if valid shark
t6 = true if valid cypher
 harmonic_xabcd_prz(type, xY, aY, bY, cY) 
  Get the potential reversal zone (PRZ) levels of a harmonic XABCD pattern
  Parameters:
     type (int) : Harmonic pattern type (int - 1 = Gartley, 2 = Bat, 3 = Butterfly, 4 = Crab, 5 = Shark, 6 = Cypher)
     xY (float) : Y coordinate of point X (float)
     aY (float) : Y coordinate of point A (float)
     bY (float) : Y coordinate of point B (float)
     cY (float) : Y coordinate of point C (float)
  Returns:  
bc_u = nearest BC retracement/extension level (nearest to point C)
bc_l = farthest BC retracement/extension level (nearest to point C)
xa_u = nearest XA retracement/extension level (or the only XA level, if applicable)
xa_l = farthest XA retracement/extension level (or na if not applicable)
 harmonic_xabcd_przClosest(l1, l2, l3, l4) 
  Get the confluent PRZ levels (i.e. the two closest PRZ levels)
Order of arguments does not matter
  Parameters:
     l1 (float) : level 1 (float)
     l2 (float) : level 2 (float)
     l3 (float) : level 3 (float)
     l4 (float) : level 4 (optional, float)
  Returns:  
lL = lower confluent PRZ level
lH = higher confluent PRZ level
 harmonic_xabcd_przRange(l1, l2, l3, l4) 
  Get upper and lower PRZ levels
  Parameters:
     l1 (float) 
     l2 (float) 
     l3 (float) 
     l4 (float) 
 harmonic_xabcd_eD(cpl1, cpl2, xY, aY, dY) 
  Measure closeness of D to either of the two closest PRZ levels, relative to height of the XA leg
  Parameters:
     cpl1 (float) 
     cpl2 (float) 
     xY (float) 
     aY (float) 
     dY (float) 
 harmonic_xabcd_przScore(xY, aY, l1, l2, l3, l4) 
  Measure the closeness of the two closest PRZ levels, relative to the height of the XA leg
  Parameters:
     xY (float) 
     aY (float) 
     l1 (float) 
     l2 (float) 
     l3 (float) 
     l4 (float) 
 harmonic_xabcd_rAndE(type, l, l1, l2) 
  Get the ratio of two pattern legs, and the percent error from the theoretical harmonic ratio
Order of arguments does not matter
  Parameters:
     type (int) : Harmonic pattern type (int - 1 = Gartley, 2 = Bat, 3 = Butterfly, 4 = Crab)
     l (string) : Leg ID ("xab", "abc", "bcd", or "xad") (string)
     l1 (float) : Line 1 height (float)
     l2 (float) : Line 2 height (float)
  Returns:  
 harmonic_xabcd_eAvg(xbre, acre, bdre, xdre, xcdre) 
  Get the avg retracement ratio % error
  Parameters:
     xbre (float) 
     acre (float) 
     bdre (float) 
     xdre (float) 
     xcdre (float) 
 pat_xabcd_asym(xX, aX, bX, cX, dX) 
  Get the avg asymmetry %
  Parameters:
     xX (int) 
     aX (int) 
     bX (int) 
     cX (int) 
     dX (int) 
 harmonic_xabcd_entry(t, tp, xY, aY, bY, cY, dY, e_afterC, e_lvlc, e_afterD, e_lvldPct) 
  Get potential entry levels for a harmonic XABCD pattern
  Parameters:
     t (bool) 
     tp (int) 
     xY (float) 
     aY (float) 
     bY (float) 
     cY (float) 
     dY (float) 
     e_afterC (bool) 
     e_lvlc (string) 
     e_afterD (bool) 
     e_lvldPct (float) 
 xabcd_entryHit(t, afterC, afterD, dX, e_afterC, e_afterD, dValBars) 
  Determine if entry level was reached. Assumes pattern is active/not timed out.
  Parameters:
     t (bool) 
     afterC (float) 
     afterD (float) 
     dX (int) 
     e_afterC (bool) 
     e_afterD (bool) 
     dValBars (int) 
 pat_xabcd_validate(xX, xY, aX, aY, bX, bY, cX, cY, dX, dY, xab, abc, bcd, xad, xcd, pErr, pAsym) 
  Validate custom XABCD pattern
  Parameters:
     xX (int) : X coordinate of point X (int)
     xY (float) : Y coordinate of point X (float)
     aX (int) : X coordinate of point A (int)
     aY (float) : Y coordinate of point A (float)
     bX (int) : X coordinate of point B (int)
     bY (float) : Y coordinate of point B (float)
     cX (int) : X coordinate of point C (int)
     cY (float) : Y coordinate of point C (float)
     dX (int) : X coordinate of point D (int)
     dY (float) : Y coordinate of point D (float)
     xab (float) 
     abc (float) 
     bcd (float) 
     xad (float) 
     xcd (float) 
     pErr (float) : Acceptable percent error of leg ratios (does not apply to legs defined within a range) (float)
     pAsym (float) : Acceptable percent asymmetry of leg ΔX (each leg tested against average ΔX of prior legs) (float)
  Returns: TRUE if pattern is valid
 pat_xabcd_validateIncomplete(xX, xY, aX, aY, bX, bY, cX, cY, xab, abc, pErr, pAsym) 
  Validate the first 3 legs of a custom XABCD pattern
  Parameters:
     xX (int) : X coordinate of point X (int)
     xY (float) : Y coordinate of point X (float)
     aX (int) : X coordinate of point A (int)
     aY (float) : Y coordinate of point A (float)
     bX (int) : X coordinate of point B (int)
     bY (float) : Y coordinate of point B (float)
     cX (int) : X coordinate of point C (int)
     cY (float) : Y coordinate of point C (float)
     xab (float) 
     abc (float) 
     pErr (float) : Acceptable percent error of leg ratios (does not apply to legs defined within a range) (float)
     pAsym (float) : Acceptable percent asymmetry of leg ΔX (each leg tested against average ΔX of prior legs) (float)
  Returns: TRUE if first 3 legs are valid
 pat_xabcd_prz(xY, aY, bY, cY, xad, bcd, xcd) 
  Get the potential reversal zone (PRZ) levels of a custom XABCD pattern
  Parameters:
     xY (float) : Y coordinate of point X (float)
     aY (float) : Y coordinate of point A (float)
     bY (float) : Y coordinate of point B (float)
     cY (float) : Y coordinate of point C (float)
     xad (float) 
     bcd (float) 
     xcd (float) 
  Returns:  
 pat_xabcd_avgDev(xX, xY, aX, aY, bX, bY, cX, cY, dX, dY) 
  Get the average deviation of an XABCD pattern
  Parameters:
     xX (int) 
     xY (float) 
     aX (int) 
     aY (float) 
     bX (int) 
     bY (float) 
     cX (int) 
     cY (float) 
     dX (int) 
     dY (float) 
 harmonic_xabcd_score(tp, xX, xY, aX, aY, bX, bY, cX, cY, dX, dY) 
  Get score values for a pattern
  Parameters:
     tp (int) 
     xX (int) 
     xY (float) 
     aX (int) 
     aY (float) 
     bX (int) 
     bY (float) 
     cX (int) 
     cY (float) 
     dX (int) 
     dY (float) 
 harmonic_xabcd_scoreTot(asym, eavg, przscore, eD, tp, w_a, w_e, w_p, w_d) 
  Get total weighted score value for a pattern
  Parameters:
     asym (float) 
     eavg (float) 
     przscore (float) 
     eD (float) 
     tp (int) 
     w_a (float) 
     w_e (float) 
     w_p (float) 
     w_d (float) 
 harmonic_xabcd_targets(xY, aY, bY, cY, dY, tgt1, tgt2, tgt3) 
  Get target level
  Parameters:
     xY (float) 
     aY (float) 
     bY (float) 
     cY (float) 
     dY (float) 
     tgt1 (string) 
     tgt2 (string) 
     tgt3 (string) 
 harmonic_xabcd_stop(stop, stopPct, bull, xY, dY, upper, lower, t1, eY) 
  Get stop level
  Parameters:
     stop (string) 
     stopPct (float) 
     bull (bool) 
     xY (float) 
     dY (float) 
     upper (float) 
     lower (float) 
     t1 (float) 
     eY (float) 
 harmonic_xabcd_fibDispTxt(tp) 
  Get fib ratio display text
  Parameters:
     tp (int) 
 harmonic_xabcd_symbol(tp) 
  Get pattern symbol
  Parameters:
     tp (int) 
 pat_xabcd(x_is_low, pivot_length, source, conf_length, incomplete) 
  Determine if an XABCD pattern has just completed (i.e. point D is on the previous bar)
  Parameters:
     x_is_low (bool) : Flag to determine if point X is a low pivot, i.e. bullish pattern (bool, dft = true)
     pivot_length (int) : Number of bars before and after a valid pivot (int, dft = 5)
     source (float) : Source series (float, dft = na, will use high and low series)
     conf_length (int) : Number of trailing bars after pivot point D to confirm a valid pattern (int, dft = 1)
     incomplete (bool) : Flag to return an incomplete XABC pattern (bool, dft = false)
  Returns:  
flag = true if valid XABCD pattern completed on previous bar
xx = X coordinate of point X (int)
xy = Y coordinate of point X (float)
ax = X coordinate of point A (int)
ay = Y coordinate of point A (float)
bx = X coordinate of point B (int)
by = Y coordinate of point B (float)
cx = X coordinate of point C (int)
cy = Y coordinate of point C (float)
dx = X coordinate of point D (int)
dy = Y coordinate of point D (float)
 pat_xabcdIncomplete(x_is_low, pivot_length, source, conf_length) 
  Determine if an XABCD pattern is in progress (point C was just confirmed)
  Parameters:
     x_is_low (bool) : Flag to determine if point X is a low pivot, i.e. bullish M pattern (bool, dft = true)
     pivot_length (int) : Number of bars before and after a valid pivot (int, dft = 5)
     source (float) : Source series (float, dft = na, will use high and low series)
     conf_length (int) : Number of trailing bars after pivot point D to confirm a valid pattern (int, dft = 1)
  Returns:  
flag = true if valid XABC pattern completed on bar_index 
xx = X coordinate of point X (int)
xy = Y coordinate of point X (float)
ax = X coordinate of point A (int)
ay = Y coordinate of point A (float)
bx = X coordinate of point B (int)
by = Y coordinate of point B (float)
cx = X coordinate of point C (int)
cy = Y coordinate of point C (float)
dx = X coordinate of point D (int)
dy = Y coordinate of point D (float)
 success(eX, stop, t1, t2) 
  Determine if trade is successful
  Parameters:
     eX (int) : Entry bar index (int)
     stop (float) : Stop level (float)
     t1 (float) : Target 1 level (float)
     t2 (float) : Target 2 level (float)
  Returns:  
 tradeClosed(eX, eY, stop, t1h, t2h, t1, t2) 
  Determine if Target or Stop was hit on the current bar
  Parameters:
     eX (int) 
     eY (float) 
     stop (float) 
     t1h (bool) 
     t2h (bool) 
     t1 (float) 
     t2 (float)
TrigLibrary   "Trig" 
Trigonometric functions
 rt_get_angleAlpha(a, b, c, deg) 
  Get angle α of a right triangle, given the lengths of its sides
  Parameters:
     a (float) : length of leg a (float)
     b (float) : length of leg b (float)
     c (float) : length of hypotenuse (float)
     deg (simple bool) : flag to return angle in degrees (bool - default = false)
  Returns: angle α in radians (or degrees if deg == true)
 rt_get_angleAlphaFromLine(x1, y1, x2, y2, l, deg) 
  Get angle α of a right triangle formed by the given line
  Parameters:
     x1 (int) : x coordinate 1 (int - optional, required if argument l is not specified)
     y1 (float) : y coordinate 1 (float - optional, required if argument l is not specified)
     x2 (int) : x coordinate 2 (int - optional, required if argument l is not specified)
     y2 (float) : y coordinate 2 (float - optional, required if argument l is not specified)
     l (line) : line object (line - optional, required if x1, y1, x2, and y2 agruments are not specified)
     deg (simple bool) : flag to return angle in degrees (bool - default = false)
  Returns: angle α in radians (or degrees if deg == true)
 rt_get_angleBeta(a, b, c, deg) 
  Get angle β of a right triangle, given the lengths of its sides
  Parameters:
     a (float) : length of leg a (float)
     b (float) : length of leg b (float)
     c (float) : length of hypotenuse (float)
     deg (simple bool) : flag to return angle in degrees (bool - default = false)
  Returns: angle β in radians (or degrees if deg == true)
 rt_get_angleBetaFromLine(x1, y1, x2, y2, l, deg) 
  Get angle β of a right triangle formed by the given line
  Parameters:
     x1 (int) : x coordinate 1 (int - optional, required if argument l is not specified)
     y1 (float) : y coordinate 1 (float - optional, required if argument l is not specified)
     x2 (int) : x coordinate 2 (int - optional, required if argument l is not specified)
     y2 (float) : y coordinate 2 (float - optional, required if argument l is not specified)
     l (line) : line object (line - optional, required if x1, y1, x2, and y2 agruments are not specified)
     deg (simple bool) : flag to return angle in degrees (bool - default = false)
  Returns: angle β in radians (or degrees if deg == true)
AlgebraLibrary   "Algebra" 
 line_fromXy(x1, y1, x2, y2) 
  Get line slope and y-intercept from coordinates
  Parameters:
     x1 (int) : x coordinate 1 (int - bar index)
     y1 (float) : y coordinate 1 (float - price/value)
     x2 (int) : x coordinate 2 (int - bar index)
     y2 (float) : y coordinate 2 (float - price/value)
  Returns:   of line
 line_getPrice(x, slope, yInt) 
  Get price at X coordinate, given line slope and y-intercept
  Parameters:
     x (int) : x coordinate to solve for y (int - bar index)
     slope (float) : slope of line (float)
     yInt (float) : y-intercept of line (float)
  Returns: y (price/value)
 line_getPrice_fromXy(x, x1, y1, x2, y2) 
  Get price at X coordinate, given two points on a line
  Parameters:
     x (int) : x coordinate to solve for y (int - bar index)
     x1 (int) : x coordinate 1 (int - bar index)
     y1 (float) : y coordinate 1 (float - price/value)
     x2 (int) : x coordinate 2 (int - bar index)
     y2 (float) : y coordinate 2 (float - price/value)
  Returns: y (price/value)
 line_getRtSides(x1, y1, x2, y2, l) 
  Get length of sides of a right triangle formed by a given line
  Parameters:
     x1 (int) : x coordinate 1 (int - optional, required if argument l is not specified)
     y1 (float) : y coordinate 1 (float - optional, required if argument l is not specified)
     x2 (int) : x coordinate 2 (int - optional, required if argument l is not specified)
     y2 (float) : y coordinate 2 (float - optional, required if argument l is not specified)
     l (line) : line object (line - optional, required if x1, y1, x2, y2 agruments are not specified)
  Returns:  
 line_length(x1, y1, x2, y2, l) 
  Get length of line, given a line object or two sets of coordinates
  Parameters:
     x1 (int) : x coordinate 1 (int - optional, required if argument l is not specified)
     y1 (float) : y coordinate 1 (float - optional, required if argument l is not specified)
     x2 (int) : x coordinate 2 (int - optional, required if argument l is not specified)
     y2 (float) : y coordinate 2 (float - optional, required if argument l is not specified)
     l (line) : line object (line - optional, required if x1, y1, x2, y2 agruments are not specified)
  Returns: length of line (float)
FibonacciLibrary   "Fibonacci" 
General Fibonacci functions. Get fib numbers, ratios, etc.
 fib_derived(f, precision) 
  Get the precise Fibonacci ratio, to the specified number of decimal places
  Parameters:
     f (float) : Fibonacci ratio (string, in form #.###)
     precision (simple int) : Number of decimal places (optional int, dft = 16, max = 32)
  Returns: Precise Fibonacci ratio (float)
* Deprecated (use fib_precise() instead), but keeping it here for science / experimenting with derivations
 fib_precise(f, precision) 
  Get the precise Fibonacci ratio, to the specified number of decimal places
  Parameters:
     f (float) : Fibonacci ratio (string, in form #.###)
     precision (simple int) : Number of decimal places (optional int, dft = 16, max = 16)
  Returns: Precise Fibonacci ratio (float)
 fib_from_string(r) 
  Get fib ratio value from string
  Parameters:
     r (string) : Fib ratio string (e.g. ".618")
  Returns: Fibonacci ratio value (float)
 fib_n(n) 
  Calculate the Nth number in the Fibonacci sequence
  Parameters:
     n (int) : Index/number in sequence (int)
  Returns: Fibonacci number (int)
UtilitiesLibrary   "Utilities" 
General utilities
 print_series(s, skip_na, position, show_index, from_index, to_index) 
  Print series values
  Parameters:
     s (string) : Series (string)
     skip_na (simple bool) : Flag to skip na values (optional bool, dft = false)
     position (simple string) : Position to print the Table (optional string, dft = position.bottom_center)
     show_index (simple bool) : Flag to show series indices (optional bool, dft = true)
     from_index (int) : First index to print (optional int, dft = 0)
     to_index (int) : Last index to print (optional int, dft = last_bar_index)
  Returns: Table object, if series was printed
 print(v, position, at_index) 
  Print value
  Parameters:
     v (string) : Value (string)
     position (simple string) : Position to print the Table (optional string, dft = position.bottom_center)
     at_index (int) : Index at which to print (optional int, dft = bar_index)
  Returns: Table object, if value was printed
 print(v, position, at_index) 
  Print value
  Parameters:
     v (int) : Value (int)
     position (simple string) : Position to print the Table (optional string, dft = position.bottom_center)
     at_index (int) : Index at which to print (optional int, dft = bar_index)
  Returns: Table object, if value was printed
 print(v, position, at_index) 
  Print value
  Parameters:
     v (float) : Value (float)
     position (simple string) : Position to print the Table (optional string, dft = position.bottom_center)
     at_index (int) : Index at which to print (optional int, dft = bar_index)
  Returns: Table object, if value was printed
 print(v, position, at_index) 
  Print value
  Parameters:
     v (bool) : Value (bool)
     position (simple string) : Position to print the Table (optional string, dft = position.bottom_center)
     at_index (int) : Index at which to print (optional int, dft = bar_index)
  Returns: Table object, if value was printed
 boolToIntArr(a) 
  return array of offsets (int) of true values
  Parameters:
     a (array) 
 intToBoolArr(a, n) 
  Parameters:
     a (array) 
     n (int)






















