Yosef26 - Weighted Decision Model//@version=5
indicator("Yosef26 - Weighted Decision Model", overlay=true)
// === Moving Averages ===
ema20 = ta.ema(close, 20)
ema50 = ta.ema(close, 50)
ema100 = ta.ema(close, 100)
// === Candle Components ===
priceRange = high - low
body = math.abs(close - open)
upperWick = high - math.max(close, open)
lowerWick = math.min(close, open) - low
volSMA = ta.sma(volume, 20)
// === Volume Momentum (3-day uptrend) ===
volUp3 = (volume > volume ) and (volume > volume )
// === Candlestick Pattern Detection ===
bullishEngulfing = (close < open ) and (close > open) and (close > open ) and (open < close )
bearishEngulfing = (close > open ) and (close < open) and (close < open ) and (open > close )
doji = body < (priceRange * 0.1)
hammer = (lowerWick > body * 2) and (upperWick < body) and (close > open)
shootingStar = (upperWick > body * 2) and (lowerWick < body) and (close < open)
// === Support/Resistance Zones ===
atSupport = low <= ta.lowest(low, 5)
atResistance = high >= ta.highest(high, 5)
// === Scoring System for Entry ===
entryScore = 0
entryScore := entryScore + (bullishEngulfing ? 3 : 0)
entryScore := entryScore + (hammer ? 2 : 0)
entryScore := entryScore + (volUp3 ? 1 : 0)
entryScore := entryScore + ((volume > volSMA) ? 2 : 0)
entryScore := entryScore + ((close > ema20 or close > ema50) ? 1 : 0)
entryScore := entryScore + (atSupport ? 2 : 0)
entryScore := entryScore + ((close > close ) ? 1 : 0)
// === Scoring System for Exit ===
exitScore = 0
exitScore := exitScore + (bearishEngulfing ? 3 : 0)
exitScore := exitScore + (shootingStar ? 2 : 0)
exitScore := exitScore + (doji ? 1 : 0)
exitScore := exitScore + ((volume < volSMA * 1.1) ? 1 : 0)
exitScore := exitScore + ((close < ema50) ? 1 : 0)
exitScore := exitScore + (atResistance ? 2 : 0)
exitScore := exitScore + ((close < close ) ? 1 : 0)
// === Decision Thresholds ===
entryCond = (entryScore >= 7)
exitCond = (exitScore >= 6)
// === Position Tracking ===
var bool inPosition = false
var int barsInPosition = 0
var label entryLabel = na
var label exitLabel = na
if entryCond and not inPosition
inPosition := true
barsInPosition := 0
entryLabel := label.new(bar_index, close, "Entry @" + str.tostring(close), style=label.style_label_up, color=color.green, textcolor=color.white)
if inPosition
barsInPosition += 1
if exitCond
inPosition := false
barsInPosition := 0
exitLabel := label.new(bar_index, close, "Exit @" + str.tostring(close), style=label.style_label_down, color=color.red, textcolor=color.white)
// === Alerts ===
alertcondition(entryCond, title="Entry Alert", message="Yosef26: Entry Signal (Scored Decision)")
alertcondition(exitCond, title="Exit Alert", message="Yosef26: Exit Signal (Scored Decision)")
Indicators and strategies
Livelli di Sconto da All Time HighInspired by the philosophy of the discount buy, this indicator give the discount levels from all time. In the last times, in which there's a massive amount money flowing in the market due to massive use of etf. Ther usual metrics to buy assets are difficult to use. In my opinion, after a strong correction, the prices usualy goes up again, except for some strong macro event.
So, I hope this indicator could hepl, for some trending growing market, to help to take decisions for extra buy in pac/dca plan.
Automated Trading Session: London KillzoneAutomated Trading Session: London Killzone (Timezone & DST Aware)
This indicator automatically tracks the London Killzone session using intraday data and real-time timezone adjustments. Designed for traders who use session-based strategies, it draws the high/low box of the session and highlights it visually on the chart.
Key Features
Timezone & DST Support
Automatically adjusts to your selected timezone, accounting for daylight saving time changes to ensure accurate session timing.
Custom Session Input
Allows you to define the start and end time of the London Killzone to suit your trading style.
Visual Session Boxes
Draws a dynamic box marking the session's high and low after it ends, with optional background coloring and session labeling.
Alert Trigger
Built-in alert condition that notifies you when the session ends—helpful for automation or manual review.
Info Table Overlay
Displays the active session time and timezone directly on the chart for quick reference.
Suggested Use
This tool is useful for identifying significant market ranges formed during the London Killzone, which is often associated with institutional activity and early market volatility.
SessionBarThis PineScript is designed to display various visual elements on a chart to help traders track session activity within the lower time frames, specifically for the USA main session. Here's a breakdown of the script's functionality:
Session Tracking
The script tracks the USA main session, defined as 9:30 AM to 4:00 PM ET, Monday through Friday.
Visual Elements
The script displays various visual elements, including:
1. Session Open and Close Lines: Lines marking the open and close of the USA main session.
2. Session High and Low Lines: Lines marking the high and low of the USA sessions.
3. Active Session Bar: A Realtime Candle as the current session bar.
4. Overnight Session Bar: A Realtime Candle as the overnight session bar.
5. Session Timer: A label displaying the time left until the next session.
6. Background Colors: Colors indicating different session periods, such as pre-market, post-market, and active session.
Customization
The script allows users to customize various aspects, including:
1. Session Time: Users can adjust the session time.
2. Colors: Users can choose colors for different visual elements.
3. Display Options: Users can toggle the display of various visual elements.
Overall, this script provides a educational tool for traders to track session activity and visualize key market data.
BTC vs ALT Lag Detector [MEXC Overlay]This indicator monitors the price movement of Bitcoin (BTC) and compares it in real time to a customizable list of major altcoins on the MEXC exchange.
It helps you identify lagging altcoins — tokens that are underperforming or overperforming BTC’s price action over a selected timeframe. These temporary deviations can offer profitable entry or rotation opportunities, especially for scalpers, day traders, and arbitrage-style strategies.
Key Features:
- Real-time deviation detection between BTC and altcoins
- Customizable comparison timeframe: 1m, 6m, 12m, 30m, 1h, 4h, or 1d
- Deviation threshold alert: Highlights coins that lag BTC by more than 0.5%, 1%, 2%, or 3%
- Compact stats table embedded in the price chart
- Fully adjustable layout: Table position (Top/Bottom/Center + Left/Right), Font size (Tiny, Small, Medium)
- Built-in alert system when deviation exceeds your chosen threshold
How to Use It:
Set your desired timeframe for comparison (e.g., 1 hour).
Select a deviation threshold (e.g., 1.0%).
The table will show:
Each altcoin’s % change
BTC’s % change
The delta (deviation) vs BTC
Red highlights indicate alts whose deviation exceeded the threshold.
When at least one alt lags beyond your threshold, the indicator can trigger an alert — helping you capitalize on potential catch-up trades.
Please provide any feedback on it.
Darvas Box Breakout Signals v6 (Manus)Purpose:
This script is designed for TradingView to automatically identify potential "Darvas Boxes" on your price chart and signal when the price breaks out of these boxes.
How it Works:
Finds Highs: It looks back over a set number of bars (default is 20, but you can change this) to find the highest price point.
Confirms Box Top: It waits until the price stays below that high point for a specific number of bars (default is 3) to confirm the top of the box.
Confirms Box Bottom: After the top is confirmed, it looks for the lowest price reached and waits until the price stays above that low point for the same number of bars (3) to confirm the bottom of the box.
Draws Box (Optional): If enabled in the settings, it draws lines on the chart representing the top and bottom of the confirmed box.
What Signals It Shows:
Breakout Signal: When the price closes above the top line of a confirmed box, it plots a green upward-pointing triangle above that price bar. This suggests the stock might be starting a move higher.
Breakdown Signal: When the price closes below the bottom line of a confirmed box, it plots a red downward-pointing triangle below that price bar. This suggests the stock might be starting a move lower.
Key Features:
Uses the Darvas Box theory logic.
Provides clear visual signals for potential entries based on breakouts or breakdowns.
Allows customization of the lookback period and confirmation bars via the indicator settings.
Written in Pine Script version 6.
Remember, this script just provides signals based on price patterns; it doesn't predict the future or guarantee profits. It should be used as one tool within the larger trading plan we discussed, especially considering risk management.
High Probability FVG Detector (MTF)Utilizes the logic behind why Fair Value Gaps exist in the first place; momentum leaving orders partially filled, therefore leaving resting liquidity that still needs to be filled. The more orders remaining, the higher the likelihood of price revisiting. However, there are high quality fair value gaps and low quality fair value gaps. High quality FVG's (the one's most likely to act as support/resistance) would likely be formed during high liquidity. This creates a more volume saturated zone. Saturation meaning remaining orders at each tick level, or as close as possible. Low quality FVG's would be one's formed during low liquidity, which price movement range is more related to gaps in the order book (thin ladder) rather than volume based momentum. Due to the limitations of Pine Script I don't have access to DOM/Order Book functionality but this indicator will make use of volume. Here is the executive summary:
FVG Detection: It scans the price action for the specific three-candle pattern that defines a bullish or bearish FVG.
Multi-Timeframe (MTF) Capability: It allows you to detect FVGs on a timeframe different from the one currently displayed on your chart (e.g., find 1-hour FVGs while looking at a 5-minute chart).
Probability Filtering: It attempts to classify FVGs based on the conditions during their formation.
Volume Filter: Checks if the FVG was formed with volume significantly higher than average (indicating strong participation).
Candle Range Filter: Checks if the FVG was formed by a candle with a significantly larger range than average (using ATR, indicating strong momentum/volatility).
Differentiated Coloring: It visually distinguishes between different types of FVGs using different colors.
High Probability: FVGs that meet the enabled Volume and/or Range filter criteria.
Low Volume: FVGs that specifically fail the Volume filter (when enabled), potentially indicating weaker conviction.
Regular: FVGs that don't meet any specific filter criteria (if the option to show them is enabled).
Mitigation Tracking: It monitors if the price later trades back into the identified FVG zone (based on either the wick touching or the body closing within the zone, selectable by the user) and changes the color of the FVG box once this happens.
Visual Display: It draws colored boxes representing the price range of the FVGs, optionally extending unmitigated boxes into the future for easy visibility.
In essence, the indicator aims to automate the detection of these price inefficiencies, filter them based on volume and momentum characteristics, and track when they are revisited by price, providing traders with visual cues about potentially significant support/resistance zones and/or target zones for trading into.
Daily Range % with Conditional SPX DirectionThis indicator visualizes the short-term market sentiment by combining the trend of the S&P 500 index (SPX) with daily price volatility (DP%).
Key Features:
Calculates a 5-period Exponential Moving Average (EMA) of SPX to detect trend direction:
Rising EMA → Uptrend
Falling EMA → Downtrend
Calculates a 5-period Simple Moving Average (SMA) of Daily Price Range % (DP%) to assess volatility trend:
Rising DP% → Increasing volatility
Falling DP% → Decreasing volatility
Background Colors:
Green: SPX trend up & volatility down → Bullish
Yellow:
SPX trend up & volatility up, or
SPX trend down & volatility down → Neutral
Red: SPX trend down & volatility up → Bearish
On-screen Labels:
Displays SPX trend direction (⬆️ / ⬇️)
Displays volatility direction (⬆️ / ⬇️)
Displays overall market sentiment: Bullish / Neutral / Bearish
This tool is designed to help traders quickly assess the relationship between trend and volatility, aiding in market environment analysis and discretionary trading decisions.
Daily Range % with Conditional SPX DirectionThis indicator visualizes the short-term market sentiment by combining the trend of the S&P 500 index (SPX) with daily price volatility (DP%).
Key Features:
Calculates a 5-period Exponential Moving Average (EMA) of SPX to detect trend direction:
Rising EMA → Uptrend
Falling EMA → Downtrend
Calculates a 5-period Simple Moving Average (SMA) of Daily Price Range % (DP%) to assess volatility trend:
Rising DP% → Increasing volatility
Falling DP% → Decreasing volatility
Background Colors:
Green: SPX trend up & volatility down → Bullish
Yellow:
SPX trend up & volatility up, or
SPX trend down & volatility down → Neutral
Red: SPX trend down & volatility up → Bearish
On-screen Labels:
Displays SPX trend direction (⬆️ / ⬇️)
Displays volatility direction (⬆️ / ⬇️)
Displays overall market sentiment: Bullish / Neutral / Bearish
This tool is designed to help traders quickly assess the relationship between trend and volatility, aiding in market environment analysis and discretionary trading decisions.
Automated Trading Session: New York KillzoneAutomated Trading Session: New York Killzone (Timezone & DST Aware)
This indicator tracks the New York Killzone session using intraday data and real-time timezone adjustments. It draws high/low boxes after the session ends and highlights the active session on your chart, making it ideal for traders focused on U.S. market volatility.
Key Features
Timezone & DST Support
Accurately reflects session timing based on your selected timezone and daylight saving settings.
Custom Session Input
Set your preferred New York Killzone hours (default: 08:00–09:30 New York time).
Visual Session Boxes
High/low ranges of the session are boxed on the chart for quick reference.
End-of-Session Alert
Get notified when the session closes, supporting both manual and automated workflows.
On-Chart Info Table
Displays active session time and timezone directly on the chart.
FrankCo Super IndicatorThe FrankCo Super Indicator is a multi-factor technical analysis tool combining trend, candlestick patterns, and momentum oscillators to generate trading signals.
Guppy Multiple Moving Average (GMMA)The GMMA Momentum Indicator plots 12 EMAs on your chart, divided into two groups:
Short-term EMAs (6 lines, default periods: 3, 5, 8, 10, 12, 15): Represent short-term trader sentiment and momentum.
Long-term EMAs (6 lines, default periods: 30, 35, 40, 45, 50, 60): Reflect long-term investor behavior and broader market trends.
By analyzing the interaction between these two groups, the indicator identifies:
Bullish and bearish trends based on the relative positions of the short- and long-term EMAs.
Momentum strength through the spread or convergence of the EMAs.
Potential reversals or breakouts via compression signals.
This PineScript version enhances the traditional GMMA by adding visual cues like background colors, bearish signals, and compression detection, making it ideal for swing traders seeking clear, actionable insights.
The GMMA Momentum Indicator provides several key features:
1. Trend Identification
Bullish Trend: When the short-term EMAs (green lines) are above the long-term EMAs (blue lines) and spreading apart, it signals strong upward momentum. The chart background turns light green to highlight this condition.
Bearish Trend: When the short-term EMAs cross below the long-term EMAs and converge, it indicates downward momentum. The background turns light red, and an orange downward triangle appears above the bar to mark a new bearish signal.
2. Momentum Analysis
The spread between the short-term EMAs reflects the strength of short-term momentum. A wide spread suggests strong momentum, while a tight grouping indicates weakening momentum or consolidation. Similarly, the long-term EMAs act as dynamic support or resistance, guiding traders on the broader trend.
3. Compression Detection
Compression occurs when both the short-term and long-term EMAs converge, signaling low volatility and a potential breakout or reversal. A yellow upward triangle appears below the bar when compression is detected, alerting traders to watch for price action.
4. Visual Cues
Green short-term EMAs: Show short-term trader activity.
Blue long-term EMAs: Represent long-term investor sentiment.
Background colors: Light green for bullish trends, light red for bearish trends, and transparent for neutral conditions.
Orange downward triangles: Mark new bearish trends.
Yellow upward triangles: Indicate compression, hinting at potential breakouts.
How to Use the GMMA Momentum Indicator for Swing Trading
Swing trading involves capturing price moves over days to weeks, and the GMMA Momentum Indicator is an excellent tool for this strategy. Here’s how to use it effectively:
1. Identifying Trade Entries
Buy Opportunities:
Look for a bullish trend (green background) where the short-term EMAs are above the long-term EMAs and spreading apart, indicating strong momentum.
A compression signal (yellow triangle) followed by a breakout above resistance or a bullish candlestick pattern can confirm an entry.
Example: On a daily chart, if the short-term EMAs cross above the long-term EMAs and the background turns green, consider entering a long position, especially if volume supports the move.
Sell Opportunities:
Watch for a bearish signal (orange downward triangle) or a bearish trend (red background) where the short-term EMAs cross below the long-term EMAs.
Example: If the short-term EMAs collapse below the long-term EMAs and an orange triangle appears, it may signal a shorting opportunity or a time to exit longs.
2. Managing Trades
Use the long-term EMAs as dynamic support (in uptrends) or resistance (in downtrends) to set stop-loss levels or trail stops.
Monitor the spread of the short-term EMAs. A widening spread suggests the trend is strong, while convergence may indicate it’s time to take profits or tighten stops.
3. Anticipating Reversals
Compression signals (yellow triangles) highlight periods of low volatility, often preceding significant price moves. Combine these with price action (e.g., breakouts or reversals) or other indicators (e.g., RSI or volume) for confirmation.
Example: If a compression signal appears near a key support level and the price breaks upward, it could signal the start of a new bullish swing.
4. Best Practices
Timeframes: The indicator works well on daily or 4-hour charts for swing trading, but you can adjust the EMA periods for shorter (e.g., 1-hour) or longer (e.g., weekly) timeframes.
Confirmation: Combine the GMMA with other tools like support/resistance levels, candlestick patterns, or oscillators (e.g., MACD) to reduce false signals.
Risk Management: Always use proper position sizing and stop-losses, as EMAs are lagging indicators and may produce delayed signals in choppy markets.
VWAP & EMAs with Accurate Color LogicThis Pine Script combines multiple technical indicators to help traders analyze price movements with precision. It features:
VWAP (Volume Weighted Average Price):
Displays the 5-minute VWAP with dynamic coloring:
White when the price is neutral.
Yellow when the price closes below the 5-minute VWAP.
Red when the price closes below the 15-minute VWAP.
Helps identify potential support and resistance levels.
VWAP Crossover Dots:
Blue dots appear on the chart whenever the price crosses the 5-minute VWAP, indicating a potential change in price direction.
Exponential Moving Averages (EMAs):
EMA 5, EMA 10, and EMA 21 with soft, eye-friendly colors.
EMA 50 and EMA 200 will only be displayed if the price is near them (within 1% threshold), helping you spot key support and resistance levels when the price is close to these longer-term moving averages.
This script is designed to assist day traders and swing traders by highlighting key price levels and crossovers, making it easier to spot trends and market reversals.
6 Moving Averages Difference TableIndicator Summary: 6 Moving Averages Difference Table (6MADIFF)
This TradingView indicator calculates and plots up to six distinct moving averages (MAs) directly on the price chart. Users have extensive control over each MA, allowing selection of:
Type: SMA, EMA, WMA, VWMA, HMA, RMA
Length: Any positive integer
Color: User-defined
Visibility: Can be toggled on/off
A core feature is the on-chart data table, designed to provide a quick overview of the relationships between the MAs and the price. This table displays:
$-MA Column: The absolute difference between the user-selected Input Source (e.g., Close, Open, HLC3) and the current value of each MA.
MA$ Column: The actual calculated price value of each MA for the current bar.
MA vs. MA Matrix: A grid showing the absolute difference between every possible pair of the calculated MAs (e.g., MA1 vs. MA2, MA1 vs. MA3, MA2 vs. MA5, etc.).
Customization Options:
Input Source: Select the price source (Open, High, Low, Close, HL2, HLC3, OHLC4) used for all MA calculations and the price difference column.
Table Settings: Control the table's visibility, position on the chart, text size, decimal precision for displayed values, and the text used for the column headers ("$-MA" and "MA$").
Purpose:
This indicator is useful for traders who utilize multiple moving averages in their analysis. The table provides an immediate, quantitative snapshot of:
How far the current price is from each MA.
The exact value of each MA.
The spread or convergence between different MAs.
This helps in quickly assessing trend strength, potential support/resistance levels based on MA clusters, and the relative positioning of short-term versus long-term averages.
Forex Sessions - Simple//@version=5
indicator("Forex Sessions - Simple", overlay=true)
// === INPUTS === //
showSydney = input.bool(true, "Show Sydney")
showTokyo = input.bool(true, "Show Tokyo")
showLondon = input.bool(true, "Show London")
showNY = input.bool(true, "Show New York")
// Color customization
colorSydney = input.color(color.new(color.blue, 70), "Sydney Color")
colorTokyo = input.color(color.new(color.orange, 70), "Tokyo Color")
colorLondon = input.color(color.new(color.green, 70), "London Color")
colorNY = input.color(color.new(color.red, 70), "New York Color")
// === SESSION LOGIC (UTC TIME) === //
sydneySession = showSydney and ((hour >= 22) or (hour < 7))
tokyoSession = showTokyo and (hour >= 0 and hour < 9)
londonSession = showLondon and (hour >= 8 and hour < 17)
nySession = showNY and (hour >= 13 and hour < 22)
// Determine active session (priority order: NY > London > Tokyo > Sydney)
sessionColor = color(na)
if nySession
sessionColor := colorNY
else if londonSession
sessionColor := colorLondon
else if tokyoSession
sessionColor := colorTokyo
else if sydneySession
sessionColor := colorSydney
// === BACKGROUND COLOR === //
bgcolor(sessionColor, title="Session Highlight")
// === SESSION LEGEND === //
var table legend = table.new(position.top_right, 1, 5, border_width=1)
if bar_index == 0
table.cell(legend, 0, 0, "Sessions", bgcolor=color.gray, text_color=color.white)
table.cell(legend, 0, 1, "Sydney", bgcolor=colorSydney)
table.cell(legend, 0, 2, "Tokyo", bgcolor=colorTokyo)
table.cell(legend, 0, 3, "London", bgcolor=colorLondon)
table.cell(legend, 0, 4, "New York", bgcolor=colorNY)
MACD+RSI Cross Alert – Clean Signal by TFGMACD + RSI Cross Alert (Lightweight & Clean Visuals)
This script highlights potential momentum shifts using MACD line crossovers with RSI confirmation.
Clean, minimal ▲▼ markers make it suitable for any chart setup.
▲ Upward Marker: When MACD line crosses above signal line and RSI is above 50
▼ Downward Marker: When MACD line crosses below signal line and RSI is below 50
Signals are semi-transparent and offset for visual clarity
Compatible with any timeframe and symbol
🔰 For beginners:
These markers may suggest trend initiation or a momentum shift.
They can serve as timing references when used with support/resistance zones or moving averages.
MACD+RSIクロス マーカー(軽量・視認性重視)
このスクリプトは、MACDのクロスとRSIの方向をもとに、勢いの変化を示すマーカーを表示します。
チャートを邪魔しない小さな▲▼のみ表示され、シンプルで軽量な構成です。
▲ 上向きマーカー:MACDがシグナルを上抜け、かつRSIが50より上の場合
▼ 下向きマーカー:MACDがシグナルを下抜け、かつRSIが50より下の場合
半透明かつオフセット配置で視認性を確保
すべての時間足・銘柄に対応
🔰 初心者向け補足:
このマーカーは、トレンドの始まりや勢いの変化の可能性を示します。
サポートライン・移動平均などと組み合わせて、タイミングの参考として活用できます。
Strong Trend Bars (ATR-based)This is a ChatGPT pinescript meant as an indicator for detecting strength in the market. The primary function I use it for is to decide which bars to trail a stop loss beneath.
💥 Explanation of adjustable inputs:
Bull Close Threshold (default 0.6):
If set to 0.6, bull bars must close above 60% of bar height → low + 0.6 * barHeight
Bear Close Threshold (default 0.6):
If set to 0.6, bear bars must close below 40% of bar height → high - 0.6 * barHeight
This lets you experiment with tighter or looser filters. For example:
0.7 → only bars closing near the extremes will light up
0.5 → about midpoint
0.8 → very demanding, “almost full body” bars
7 MAs DEMA🧠 Indicator: 7 MAs DEMA – Advanced Trend Setup
This indicator displays 7 Double Exponential Moving Averages (DEMA) to provide a clear view of market trends across multiple timeframes.
📊 DEMA Periods Used:
DEMA 11 – Ultra Short-Term
DEMA 47 – Short-Term
DEMA 94 – Short to Mid-Term
DEMA 204 – Mid-Term
DEMA 408 – Intermediate Trend
DEMA 885 – Long-Term
DEMA 1754 – Macro Trend / Overall Market Direction
🧠 Indicador: 7 MAs DEMA – Setup Avançado de Tendência
Este indicador utiliza 7 Médias Móveis DEMA (Double Exponential Moving Averages) para identificar com precisão a tendência do mercado em diferentes prazos.
📊 Períodos Utilizados:
DEMA 11 – Ultra Curto Prazo
DEMA 47 – Curto Prazo
DEMA 94 – Tendência de Curto a Médio Prazo
DEMA 204 – Médio Prazo
DEMA 408 – Tendência Intermediária
DEMA 885 – Longo Prazo
DEMA 1754 – Tendência Macro / Força de Fundo
Dragon Harmonic Pattern [TradingFinder] Dragon Detector// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
// © TFlab
//@version=6
indicator('Dragon Harmonic Pattern Dragon Detector', 'Dragon Pattern TFlab', overlay = true, max_bars_back = 5000, max_lines_count = 500, max_labels_count = 500)
// Import Library
import TFlab/Harmonic_Chart_Pattern_Library_TradingFinder/3 as HP
import TFlab/AlertSenderLibrary_TradingFinder/1 as AlertSender
import TFlab/Dark_Light_Theme_TradingFinder_Switching_Colors_Library/1 as Color
// Logical Input
PP = input.int(3, 'ZigZag Pivot Period', group = 'Logical Setting')
ShVF = input.bool(false, 'Show Valid Format', group = 'Logical Setting')
FLPC = input.bool(false, 'Show Formation Last Pivot Confirm', group = 'Logical Setting')
FLPCPeriod = input.int(2, 'Period of Formation Last Pivot', group = 'Logical Setting')
// Display Input
ShowBull = input.bool(true, 'Show Bullish Pattern', group = 'Display Setting')
ShowBear = input.bool(true, 'Show Bearish Pattern', group = 'Display Setting')
ColorBull = input.color(#0609bb, 'Color Bullish Pattern', group = 'Display Setting')
ColorBear = input.color(#0609bb, 'Color Bearish Pattern', group = 'Display Setting')
LineWidth = input.int(1, 'Width Line', group = 'Display Setting')
LabelSize = input.string(size.small, 'Label size', options = , group = 'Display Setting')
Mode = input.string('Light', 'Switching Colors Theme Mode', options = , group = 'Display Setting')
= Color.SwitchingColorMode(ColorBull, Mode)
= Color.SwitchingColorMode(ColorBear, Mode)
// Alert Input
Alert = input.string('On', 'Alert', , 'If you turn on the Alert, you can receive alerts and notifications after setting the "Alert".', group = 'Alert')
AlertName = input.string('Dragon Harmonic Pattern ', 'Alert Name', group = 'Alert')
Frequncy = input.string('Once Per Bar', 'Message Frequency', , 'The triggering frequency. Possible values are: All' + ' (all function calls trigger the alert), Once Per Bar (the first function call during the bar triggers the alert), ' + ' Per Bar Close (the function call triggers the alert only when it occurs during the last script iteration of the real-time bar,' + ' when it closes). The default is alert.freq_once_per_bar.)', group = 'Alert')
UTC = input.string('UTC', 'Show Alert time by Time Zone', group = 'Alert')
MessageBull = input.text_area('Long Signal Position Based on Dragon Harmonic Pattern', 'Long Position Message', group = 'Alert')
MessageBear = input.text_area('Short Signal Position Based on Dragon Harmonic Pattern', 'Short Position Message', group = 'Alert')
// Call Harmonic Pattern Function
= HP.XABCD('Bullish Dragon', 'Bearish', ShowBull, ColorBullish, #ff3030, #36b936, LineWidth, LabelSize, ShVF, FLPC, FLPCPeriod, PP, 0.38, 0.62, 0.8, 1.1, 0.4, 0.8, 0.2, 0.4)
= HP.XABCD('Bearish Dragon', 'Bullish', ShowBear, ColorBearish, #ff3030, #36b936, LineWidth, LabelSize, ShVF, FLPC, FLPCPeriod, PP, 0.38, 0.62, 0.8, 1.1, 0.4, 0.8, 0.2, 0.4)
// Call Alert Sender Function
AlertSender.AlertSender(BullAlert, Alert, AlertName, 'Analysis', '', 'Basic', 'Once Per Bar', 'UTC', 'Off', MessageBull, open, high, low, close, 0, 0, 0, 0, 0)
AlertSender.AlertSender(BearAlert, Alert, AlertName, 'Analysis', '', 'Basic', 'Once Per Bar', 'UTC', 'Off', MessageBear, open, high, low, close, 0, 0, 0, 0, 0)
// Candle Confirmation
plotshape(BearCandleConfirm, style = shape.arrowdown, color = color.red)
plotshape(BullCandleConfirm, style = shape.arrowup, color = color.green, location = location.belowbar)