08-2018 Stochastic 5m [ALERT SETUP] [INDICATOR]This is an accumulation of small buy orders and a complete sell order strategy, that can be used for manual trading or for a trading bot. The strategy is based on stockastic divergences ( an indicator that I made myself and is published on my profile earlier ), and I added my personnal touch of course. Note that the bullish and bearish stochastic divergences are calculated separately and can be configured in the inputs.
To be used with a 5m timeframe, and on a flat or bullish pair.
Everyone can favorite the script, apply it to the chart, but only I can see or modify the code. If you need anything, leave a comment, thanks :D
More info about the script, such as inputs description, how to configure the script, strategy explanation, alert configuration can be found here : blockchainfiesta.com
--------------------------------------------------------------------------------------------------------------
I do commission work: TradingView Pine Script development & Reverse Engineering.
contact@blockchainfiesta.com.
You can also send me a message in TradingView or Discord (discord.gg)
Bitcoin address: 19sVQvCDmVfEACq7BiMnWSMqFPZ8qfSQ2K
ETH address: 0xc8a5d3a63a05db0c2363ea1c08b37a01cce9ebfb
Tìm kiếm tập lệnh với "bear"
RSI_EMA & Bearish EngulfingThis is a RSI-RSI of EMA and bearish candlestick reversal pattern formed by two candlesticks. Following an uptrend, the first candlestick is a up candlestick which is followed by a down candlestick which has a long real body that engulfs or contains the real body of the prior bar. following an uptrend, if RSI and EMA line cross then Sell and for downtrend if RSI and EMA line cross then Buy.
Spicytrader [BUY and SELL signals + Breakouts + Trendline]
BUY and SELL signals (with alerts)
Support and resistant breakout (with alerts)
Auto trendlines : Bullish and bearish market (with alerts)
100% Compatible with Autoview bot (Buy, Sell, Takeprofit, Stop loss)
TRY IT FOR FREE : spicytrader.com
Stochastique Divergences IndicatorHello,
I made a custom indicator.
Divergences with stochastique and price are really strong signals.
About the indicator
A bullish divergence happens when the stoch K makes a higher low and is depicted by a green triangle up.
A bearish divergence happens when the stoch K makes a lower high and is depicted by a red triangle down.
This script is the base for my next strategy that I should upload soon.
I will grant access (to this script and my others) to people willing to make a small donation.
Here is my BTC address : 19sVQvCDmVfEACq7BiMnWSMqFPZ8qfSQ2K
If you prefer ETH : 0xc8a5d3a63a05db0c2363ea1c08b37a01cce9ebfb
Send me a Private Message with the ID of the transaction
If you want to do some forward testing first, send me a message.
Also check blockchainfiesta.com
wTF50This is a customized trend filter that has several uses:
It helps identify trend direction, either bullish or bearish
It distinguishes between a pullback and a trend reversal
It helps identify areas where traders should stand aside
It highlights areas of consolidation
dTF50This is a customized trend filter that has several uses:
It helps identify trend direction, either bullish or bearish
It distinguishes between a pullback and a trend reversal
It helps identify areas where traders should stand aside
It highlights areas of consolidation
OBV divergence hidden and regular on both bearish and bullish.OBV (on balance volume) divergence indicator with hidden and regular signal on both bearish and bullish.
CMYK VRMI◊ Introduction
This script indicates the relative movement of price x volume.
◊ Origin
Based on 'The Relative Momentum Index' by Roger Altman : February, 1993 issue of Technical Analysis of Stocks & Commodities magazine.
While RSI counts up and down days from close to close, the Relative Momentum Index counts up and down days from the close relative to a close x number of days ago.
This results in an RSI that is smoother. The input has been changed to the change of a smoothed close multiplied by a smoothed volume.
The polarity of VRMI indicates bearish/bullish movement.
◊ Adjustments
CMYK color theme applied.
◊ Usage
VRMI indicates the force the market moves with.
◊ Future Prospects
-
◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊
CMYK VRMI RAYS ◊ Introduction
Introducing VRMI in this script, an RMI based on price movement and volume, to indicate bullish and bearish trends.
This script marks the background depending on RMI <> VRMI , VRMI polarity and large buy/sell sprees.
◊ Origin
Based on 'The Relative Momentum Index' by Roger Altman : February, 1993 issue of Technical Analysis of Stocks & Commodities magazine.
While RSI counts up and down days from close to close, the Relative Momentum Index counts up and down days from the close relative to a close x number of days ago.
This results in an RSI that is smoother.
In addition VRMI reacts quick, it is used to cut off latency from RMI, and it's polarity indicates the beginning and end of a trend.
Large buy sell sprees and detected in their proportion with an sma on the volume
◊ Adjustments
CMYK color theme applied.
◊ Usage
This indicator can be used to detect trends and mark reversals.
◊ Prospects
◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊ ◊
Bullish and Bearish Engulfing Patterns auto detectionThis simple indicator detects automatically most important bullish and bearish candlestick patterns formations. Used to locate potential supply and demand imbalances.
Copyright 2017 Alfonso Moreno www.set-and-forget.com
Super Envolvente (Bullish y Bearish)Identificador de Super-envolventes (SE), se encarga de darle un color verde a la SE alzista (Bullish) verde y rojo a la bajista (Bearish).
Bears VS BullsThis indicator will work on ANY instrument.
The red line is a moving average of ONLY sellers in the market.
The blue line is a moving average of ONLY buyers in the market.
The period or "length" of the individual moving averages can be adjusted in the indicator settings.
The default, it is set to 50.
Buying and selling trends often provide indications of market moves such as the most recent bottom in Cryptocurrencies.
Feel free to comment and share any indicator concepts or ideas for content you would like to see added to the Technical Indicator Bundle on www.kenzing.com
bearish Price Below PDL - Complete Multi-Confirmation Alert🎯 KEY IMPROVEMENTS:
1. Enhanced Alert Visibility:$jmoskyhigh
✅ HUGE triangle down marker with "SELL" text
✅ Alert title: "SELL SIGNAL - PDL BREAKDOWN CONFIRMED"
✅ Prominent info panel with red theme
✅ Clear "SELL ALERT: TRIGGERED" status
2. Better Visual Feedback:
Red frame around info panel
Larger shapes and markers
Color-coded confirmations (green = OK, red = FAIL)
Progress percentage displayed
Breakdown price label
3. Complete Alert System:
Main Alert: "SELL SIGNAL - PDL BREAKDOWN CONFIRMED"
Early Warning: "PDL Breakdown Started - Monitoring"
Reset Alert: "Confirmation Lost - Breakdown Reset"
Bearish signal using Point of Control (POC) with PAC by guruThis indicator code helps traders identify potential sell opportunities using several important technical indicators:
Point of Control (POC) – This is the price level where the most volume was traded over the past several days.
Previous Day's Low – This shows the lowest price reached during the previous day.
PAC (Price Action Channel) EMA – These are two moving averages (one based on the low price and one based on the close price) that help determine if the price is trending within a certain range.
Volume SMA – This is a 3-day simple moving average (SMA) of volume, which helps filter out signals based on market activity.
What the Script Does:
Point of Control (POC):
The script looks at the last 50 days (configurable) and calculates which price level had the highest trading volume.
It then plots a red line on the chart at the POC level. This is important because it helps identify areas where there was strong market interest in the past.
Volume Moving Average:
The script calculates a 3-day SMA of volume, but it excludes the current day to avoid premature signals based on today’s trading.
The volume SMA is used to ensure there’s enough market activity (with a threshold set to 25 units) before triggering a sell signal.
Price Action Channel (PAC) EMA:
The PAC consists of two exponential moving averages (EMAs):
The PAC Low EMA: This is based on the low prices over the last 34 periods (configurable).
The PAC Close EMA: This is based on the closing prices over the last 34 periods.
These EMAs help determine if the price is trending above or below certain price levels.
Sell Signal Logic: The script checks three conditions before displaying a "Sell" signal:
Price Below POC and Previous Day’s Low:
The close price must be below both the Point of Control (POC) and the previous day's low.
Volume SMA Above 25:
The 3-day volume SMA must be greater than 25. This ensures the signal only triggers when there’s enough trading volume in the market.
Today’s Low is Above PAC EMAs:
Today's low price must be above both the PAC low EMA and the PAC close EMA. This prevents sell signals when prices are already significantly below the PAC, indicating possible exhaustion in the downtrend.
If all three conditions are met, the script will display a red "Sell" label on the chart, signaling a potential selling opportunity.
No Sell Signal if Price Reverses:
If the price crosses back above the POC or the previous day's low, the script will remove the sell signal and reset for a new opportunity.
Summary of Conditions:
For the script to display a "Sell" label:
The close price must be below the Point of Control (POC) and the previous day’s low.
The 3-day volume SMA (excluding today) must be greater than 25 units.
The low price of the current day must be above both the PAC low EMA and the PAC close EMA.
If these conditions are met, a red sell label appears on the chart as a potential signal for a short (sell) trade.
Guneet-ScalperBearish trend candle color change to red with sell print
Bullish trend candle color change to green with buy print
thanks
jas toor
Liquidity Sweep Reentry ToolkitHere’s a clear breakdown of what your Liquidity Sweep Reentry Toolkit script does, and how you can use it on your charts:
🔎 Script Breakdown
1. Visual Controls (Inputs)
• : Master toggle to turn all visuals on/off.
• : Show labels when a liquidity sweep + ChoCh condition occurs.
• : Plot green/red triangles for bullish/bearish reentry signals.
• : Prevent multiple signals within the same swing.
• : Show HH/HL/LL/LH market structure letters.
• : Slider to adjust how dim the background of HH/HL/LL/LH labels appear.
2. Core Conditions
• Defines simple bullish () and bearish () candles.
• is a placeholder for your Change of Character logic.
3. Sweep Detection
• : Detects when price makes a new high compared to the last 5 bars.
• : Detects when price makes a new low compared to the last 5 bars.
4. Restriction Flags
• Tracks whether a sweep signal has already triggered in the current swing.
• Resets when sweeps end, so new signals can appear.
5. Composite Triggers
• : Fires when bullish candle + buy-side sweep + ChoCh condition align.
• : Fires when bearish candle + sell-side sweep + ChoCh condition align.
6. Visual Labels
• Gold labels mark “BS Sweep + ChoCh” or “SS Sweep + ChoCh” events.
• Green triangle below bar = bullish reentry.
• Red triangle above bar = bearish reentry.
• Blue HH/HL/LL/LH labels narrate market structure pivots, with adjustable transparency.
7. Alerts
• Alerts can be set for bullish or bearish sweep reentry triggers, so you get notified when conditions align.
📘 How to Use It
1. Apply to Chart
Add the script to your TradingView chart (works best on intraday timeframes like 5‑minute).
2. Configure Visuals
• Use the Visual Controls panel to toggle features on/off.
• Adjust the Label Transparency slider to dim or brighten the HH/HL/LL/LH labels.
3. Interpret Signals
• Gold labels show when a sweep + ChoCh condition occurs.
• Triangles mark potential reentry points (green = bullish, red = bearish).
• HH/HL/LL/LH labels narrate market structure shifts for clarity.
4. Set Alerts
• Use the built‑in alert conditions to get notified when bullish or bearish sweep reentry triggers fire.
👉 In short: this toolkit helps you spot liquidity sweeps, confirm with ChoCh, and visualize reentry signals, while also narrating market structure pivots. It’s modular, so you can toggle features depending on how much visual clutter you want.
🛠 Workflow Example
1. Setup
• Apply the script to your chart (e.g., 5‑minute S&P futures).
• In the indicator settings, decide which visuals you want:
• Turn on Sweep + ChoCh labels if you want to see gold tags narrating liquidity events.
• Keep Entry triangles on to highlight actionable reentry points.
• Adjust the Label Transparency slider so HH/HL/LL/LH structure labels are dim enough not to clutter.
2. Watch for Sweeps
• As price pushes above recent highs → a Buy‑side Sweep is detected.
• As price dips below recent lows → a Sell‑side Sweep is detected.
• If ChoCh logic is true at the same time, you’ll see a gold label (“BS Sweep + ChoCh” or “SS Sweep + ChoCh”).
3. Confirm Reentry
• If conditions align (bullish candle + buy‑side sweep + ChoCh), you’ll see a green triangle below the bar.
• If bearish candle + sell‑side sweep + ChoCh, you’ll see a red triangle above the bar.
• These triangles are your potential reentry triggers.
4. Narrate Market Structure
• HH/HL/LL/LH labels appear at pivots, giving you a running commentary of structure shifts.
• Example: HH → HL → HH shows bullish continuation; LH → LL → LH shows bearish pressure.
• Use the transparency slider to keep these labels subtle but visible.
5. Alerts
• Set alerts for “Bullish Sweep Reentry” or “Bearish Sweep Reentry” so you don’t miss signals even if you’re away from the screen.
📘 How to Use in Practice
• Intraday trading: On a 5‑minute chart, use the toolkit to spot liquidity grabs and confirm reentry points.
• Narration: The HH/HL/LL/LH labels help you keep track of structure without manually marking pivots.
• Decision making: Gold labels + triangles = potential trade setups. Structure labels = context for trend bias.
• Customization: Dim labels when you want a cleaner chart, brighten them when you’re focused on structure.
👉 In short: this script gives you a modular toolkit — sweeps, ChoCh confirmation, reentry signals, and structure narration — all adjustable so you can tailor the visuals to your workflow.
📈 Bullish Scenario Walkthrough
1. Market Context
• You’re watching the 5‑minute chart.
• Price has been consolidating near recent highs, building liquidity above.
2. Liquidity Sweep
• Price spikes above the prior swing high → the script detects a buy‑side sweep.
• A gold label appears: “BS Sweep + ChoCh” (if your ChoCh condition is true).
3. Change of Character (ChoCh)
• The candle closes bullish ().
• Your ChoCh condition confirms a structural shift.
• Together, sweep + ChoCh = potential reentry setup.
4. Reentry Trigger
• The script plots a green triangle below the bar.
• This marks a bullish sweep reentry signal: price grabbed liquidity and is now showing strength.
5. Market Structure Narration
• At the same time, the HH/HL labels update:
• The sweep bar prints a new HH.
• The next pivot low prints an HL.
• This narrates bullish continuation: HH → HL → HH.
6. Trade Decision
• You can use the green triangle as your entry cue.
• The HH/HL narration gives you confidence that structure supports the trade.
• Alerts can be set so you don’t miss the trigger.
7. Risk Management
• Stop placement: below the HL pivot or sweep low.
• Target: next liquidity pool above, or measured move.
🧭 How to Use This in Practice
• Gold label = liquidity event + ChoCh confirmation.
• Green triangle = actionable bullish reentry trigger.
• HH/HL narration = context for trend bias and trade management.
• Transparency slider = keep structure labels subtle so the chart stays clean.
📉 Bearish Scenario Walkthrough
1. Market Context
• You’re watching the 5‑minute chart.
• Price has been consolidating near recent lows, building liquidity underneath.
2. Liquidity Sweep
• Price spikes below the prior swing low → the script detects a sell‑side sweep.
• A gold label appears: “SS Sweep + ChoCh” (if your ChoCh condition is true).
3. Change of Character (ChoCh)
• The candle closes bearish ().
• Your ChoCh condition confirms a structural shift.
• Together, sweep + ChoCh = potential bearish reentry setup.
4. Reentry Trigger
• The script plots a red triangle above the bar.
• This marks a bearish sweep reentry signal: price grabbed liquidity below and is now showing weakness.
5. Market Structure Narration
• At the same time, the LH/LL labels update:
• The sweep bar prints a new LL.
• The next pivot high prints a LH.
• This narrates bearish continuation: LH → LL → LH.
6. Trade Decision
• You can use the red triangle as your entry cue.
• The LH/LL narration gives you confidence that structure supports the short.
• Alerts can be set so you don’t miss the trigger.
7. Risk Management
• Stop placement: above the LH pivot or sweep high.
• Target: next liquidity pool below, or measured move.
🧭 How to Use This in Practice
• Gold label = liquidity event + ChoCh confirmation.
• Red triangle = actionable bearish reentry trigger.
• LH/LL narration = context for trend bias and trade management.
• Transparency slider = keep structure labels subtle so the chart stays clean.
Kinetic RSI [Vel + Accel] + AlertsThe Problem with Standard RSI
Most traders use the Relative Strength Index (RSI) to see if a market is "Overbought" (above 70) or "Oversold" (below 30). The problem? A strong trend can stay overbought for days, burning short sellers, or an asset can stay oversold while price continues to crash. Standard RSI tells you where the price is, but it doesn't tell you how hard it is moving.
The Solution: Kinetic RSI
This script reimagines RSI by applying basic physics concepts: Velocity and Acceleration.
Instead of asking "Is RSI below 30?", this indicator asks: "Is RSI below 35 AND did it just make a violent, high-speed turn upwards?"
It filters out lazy, drifting price action and only signals when momentum is accelerating in a new direction.
How It Works (The Math)
Velocity: We calculate the speed of the RSI change (Current RSI - Previous RSI).
Acceleration: We calculate if that speed is increasing (Current Velocity - Previous Velocity).
The Trigger: A signal is only generated if the RSI is in an extreme zone (<35 or >65) AND it has high Velocity AND positive Acceleration.
How to Trade It
1. The "Kick" Signals (Background Highlights)
🟢 Green Background (Bullish Kick): The RSI was low, but buyers stepped in aggressively. The momentum is not just positive; it is accelerating upward. This is often a "V-Bottom" catch.
🔴 Red Background (Bearish Kick): The RSI was high, but sellers slammed the price down. Momentum is accelerating downward.
2. The Line Color
Lime Line: Velocity is positive (Momentum is rising).
Fuchsia Line: Velocity is negative (Momentum is falling).
Usage: If the background flashes Green (Buy Signal), but the line turns back to Fuchsia (Red) a few bars later, the move has failed—exit the trade.
Settings & Alerts
RSI Length: Standard 14 (Adjustable).
Velocity Threshold: Controls sensitivity.
Lower (e.g., 2-3): More signals, catches smaller reversals.
Higher (e.g., 5+): Fewer signals, catches only massive "shocks" to the price.
Alerts Included: You can set alerts for "Bullish Kick," "Bearish Kick," or "Any Kick" to get notified of volatility spikes.
Best Practices
Wait for the Close: This indicator measures the closing velocity. Always wait for the bar to close to confirm the background color signal.
Trend Filtering: This works best as a "Reversal" indicator. If the market is in a super-strong uptrend, ignore the Bearish (Red) signals and only take the Bullish (Green) dips.
NeuraLine v1Neuraline is a daily market-regime indicator designed to help traders stay aligned with the dominant trend while avoiding noise, false flips, and emotional overtrading.
Instead of reacting to every small move, Neuraline focuses on structural trend confirmation, combining trend strength, regime persistence, and higher-timeframe context into one clean visual layer.
1. Anti-Flip Trend Logic
Neuraline uses a buffered EMA regime system with built-in hysteresis.
This means the indicator does not flip trend on every minor crossover, but only when price confirms a meaningful shift.
Result: fewer false signals, more stability.
2. Market Strength Filter (ADX)
Trend changes are only validated when market strength confirms the move.
This prevents signals during low-volatility, choppy conditions where most indicators fail.
3. Clear Market Regime: Bullish or Bearish
Neuraline always operates in one of two states:
• Bullish regime
• Bearish regime
No confusion. No over-analysis.
Every signal is contextualized within the current regime.
4. Higher-Timeframe Structure via 50 / 200 Moving Averages
The integrated 50 & 200 day moving averages provide long-term market context:
• MA lines automatically adapt their color based on bullish or bearish alignment
• A subtle ribbon highlights the structural zone between them
This makes it instantly clear whether price action is occurring within a healthy trend or against macro structure.
5. Minimal, Emotion-Free Signals
Buy and sell signals are only triggered on confirmed regime transitions, not on every fluctuation. Signals are displayed as clean, non-intrusive icons directly on the chart — no clutter, no noise.
6. Designed for Daily & Swing Traders
Neuraline is optimized for:
• Daily charts
• Swing trading
• Position management
• Market bias confirmation
It is not a scalping tool.
It is a decision-filter.
Reversal Signal by Vahid.jafarzadehReversal Signal by Vahid.j is a technical analysis tool designed to identify potential market turning points using a combination of Donchian channels, Fibonacci levels, and multi-oscillator divergences. This indicator calculates dynamic support and resistance levels based on recent highs and lows, applies key Fibonacci retracement zones, and evaluates divergences across multiple oscillators including RSI, MACD, Momentum, CCI, OBV, Stochastic, DI Oscillator, VWMA, CMF, and MFI.
Signals are displayed as bull 🐂 and bear 🐻 icons on the chart to indicate potential buy and sell zones. The indicator also tracks the cumulative divergence count, offering a quantitative perspective of market strength and trend reversal probability.
Alerts can be set for both bullish and bearish signals, enabling timely entries and exits based on divergence and Donchian-Fibonacci confluence.
-------
فارسی :
سیگنال بازگشت توسط Vahid.j یک ابزار تحلیل تکنیکال است که برای شناسایی نقاط احتمالی تغییر جهت بازار طراحی شده و از ترکیبی از کانالهای دونچیان، سطوح فیبوناچی و واگرایی چند نوسانگر استفاده میکند. این اندیکاتور سطوح حمایت و مقاومت پویا را بر اساس بالاترین و پایینترین قیمتهای اخیر محاسبه کرده، سطوح کلیدی فیبوناچی را اعمال میکند و واگراییها را در چندین نوسانگر شامل RSI، MACD، مومنتوم، CCI، OBV، استوکاستیک، DI اسیلاتور، VWMA، CMF و MFI ارزیابی میکند.
سیگنالها به صورت آیکون گاو 🐂 و خرس 🐻 روی چارت نمایش داده میشوند تا مناطق خرید و فروش احتمالی را نشان دهند. همچنین این اندیکاتور تعداد واگراییهای تجمعی را ردیابی میکند و دید کمی نسبت به قدرت بازار و احتمال بازگشت روند ارائه میدهد.
امکان فعالسازی آلارم برای سیگنالهای صعودی و نزولی وجود دارد تا بر اساس همگرایی واگرایی و سطوح دونچیان-فیبوناچی، ورود و خروجهای به موقع انجام شود
Killshotcopy// This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
//@version=5
indicator("Killshot", overlay=true, format = format.price, max_labels_count=500, max_lines_count=500)
max_bars_back(time, 5000)
////////////////////////////////////////////////////////////////////////////
///// /////
///// Input Block /////
///// /////
////////////////////////////////////////////////////////////////////////////
// Color inputs for EMAs
short_color = input.color(defval=color.blue, title="Fast EMA Color", group="EMA Settings")
medium_color = input.color(defval=color.orange, title="Slow EMA Color", group="EMA Settings")
long_color = input.color(defval=color.red, title="Long EMA Color", group="EMA Settings")
// EMA period inputs
fastEMA = input.int(defval=20, title="Fast EMA", group="EMA Settings")
slowEMA = input.int(defval=50, title="Slow EMA", group="EMA Settings")
longEMA = input.int(defval=238, title="Long EMA", group="EMA Settings")
//Support & Resistance
showSR = input.bool(title="Display Support and Resistance", defval=true, group="S&R; Settings")
atrMovement = input.float(title="ATR Movement Required", defval=1.0, step=0.5, tooltip="Minimum ATR distance price must move to consider a pivot zone to be 'major'")
lookback = input.int(title="High/Low Lookback", defval=25, step=5, tooltip="Lookback period for detecting swing highs/lows")
maxZoneSize = input.float(title="Max Zone Size (Compared to ATR)", defval=2.5, step=0.5, tooltip="If a zone is larger than the current ATR multiplied by this, it is considered too large and ignored")
newStructureReset = input.int(title="Zone Update Count Before Reset", defval=25, step=5, tooltip="The script draws two zones until they're violated - if the first zone is updated this many times, the second zone is reset")
drawPreviousStructure = input.bool(title="Draw Previous Structure", defval=true, tooltip="This turns on/off drawing 'support-turned-resistance' and 'resistance-turned-support'")
displayStars = input.bool(title="Display Stars", defval=true, group="Star Settings")
////////////////////////////////////////////////////////////////////////////
///// /////
///// EMA Cross Plot Block /////
///// /////
////////////////////////////////////////////////////////////////////////////
short = ta.ema(close, fastEMA)
medium = ta.ema(close, slowEMA)
long = ta.ema(close, longEMA)
plot(short, color=short_color, linewidth=1)
plot(medium, color=medium_color, linewidth=1)
plot(long, color=long_color, linewidth=1)
//Show the directional arrows
plotshape(ta.cross(short,medium) and short>medium ? short : na, style=shape.triangleup, color=color.blue, size=size.small, location=location.belowbar)
plotshape(ta.cross(short,medium) and shortmedium ? bullColor : bearColor
plot(series=low, style=plot.style_columns, color=c_ma)
////////////////////////////////////////////////////////////////////////////
///// /////
///// Support & Resistance Code Block /////
///// /////
////////////////////////////////////////////////////////////////////////////
// Get current ATR value
atr = ta.atr(14)
// Get highest body and lowest body for the current candle
highestBody = open > close ? open : close
lowestBody = open > close ? close : open
// Set up our persistent S&R; variables (1 = the wick and 2 = the body)
var res1 = 0.0
var res2 = 0.0
var sup1 = 0.0
var sup2 = 0.0
var lookForNewResistance = true
var lookForNewSupport = true
// Set up our *previous* support & resistance variables (for drawing support-turned-resistance etc)
var previousRes1 = 0.0
var previousRes2 = 0.0
var previousSup1 = 0.0
var previousSup2 = 0.0
// Set up our ATR variables (for identifying significant declines/rallies to validate S&R; zones)
var atrSaved = 0.0
var potentialR1 = 0.0
var potentialR2 = 0.0
var potentialS1 = 0.0
var potentialS2 = 0.0
// Detect fractal swing highs for resistance
// We're looking for this pattern: .|.
if high == ta.highest(high, lookback) and high < high and lookForNewResistance
r1 = high
r2 = highestBody > highestBody ? highestBody : highestBody > highestBody ? highestBody : highestBody
if (r1 - r2) / atr <= maxZoneSize
lookForNewResistance := false
potentialR1 := r1
potentialR2 := r2
atrSaved := atr
// Detect fractal swing lows for support
// We're looking for this pattern: *|*
if low == ta.lowest(low, lookback) and low > low and lookForNewSupport
s1 = low
s2 = lowestBody < lowestBody ? lowestBody : lowestBody < lowestBody ? lowestBody : lowestBody
if (s2 - s1) / atr <= maxZoneSize
lookForNewSupport := false
potentialS1 := s1
potentialS2 := s2
atrSaved := atr
// Check if potential resistance zone has already been violated. If it has, reset our potential R1 & R2
if close > potentialR1 and barstate.isconfirmed
potentialR1 := na
potentialR2 := na
// Check if potential support zone has already been violated. If it has, reset our potential S1 & S2
if close < potentialS1 and barstate.isconfirmed
potentialS1 := na
potentialS2 := na
// Check if we've had a significant decline since detecting swing high
if potentialR1 - low >= (atrSaved * atrMovement)
previousRes1 := na(previousRes1) ? potentialR1 : previousRes1 // Store previous resistance if we're not already drawing it
previousRes2 := na(previousRes2) ? potentialR2 : previousRes2
res1 := potentialR1
res2 := potentialR2
potentialR1 := na
potentialR2 := na
// Check if we've had a significant rally since detecting swing low
if high - potentialS1 >= (atrSaved * atrMovement)
previousSup1 := na(previousSup1) ? potentialS1 : previousSup1 // Store previous support if we're not already drawing it
previousSup2 := na(previousSup2) ? potentialS2 : previousSup2
sup1 := potentialS1
sup2 := potentialS2
potentialS1 := na
potentialS2 := na
// Declare support & resistance update counters
// This is used for forcing a zone reset if a zone is not violated within a reasonable period of time
var supCount = 0
var resCount = 0
// If the previous resistance high has been violated then begin searching for a new resistance zone
if close >= res1 and barstate.isconfirmed
lookForNewResistance := true
lookForNewSupport := true
resCount := resCount + 1
// If the previous support low has been violated then begin searching for a new support zone
if close <= sup1 and barstate.isconfirmed
lookForNewSupport := true
lookForNewResistance := true
supCount := supCount + 1
// If our current resistance zone has been violated, store its values to draw new *potential* support zone
// The idea being that once a major resistance zone is violated it often becomes future support
// But we only save previous S&R; if we don't already have one saved (or our zone update count exceeds newStructureReset)
if (close > res1 and na(previousRes1) and barstate.isconfirmed) or previousRes1 == 0.0 or supCount >= newStructureReset
previousRes1 := res1
previousRes2 := res2
supCount := 0
// If our current support zone has been violated, store its values to draw new *potential* resistance zone
// The idea being that once a major support zone is violated it often becomes future resistance
// But we only save previous S&R; if we don't already have one saved (or our zone update count exceeds newStructureReset)
if (close < sup1 and na(previousSup1) and barstate.isconfirmed) or previousSup1 == 0.0 or resCount >= newStructureReset
previousSup1 := sup1
previousSup2 := sup2
resCount := 0
// If our resistance-turned-support zone has been violated, reset our saved resistance variables
if close < previousRes2 and barstate.isconfirmed
previousRes1 := na
previousRes2 := na
// If our support-turned-resistance zone has been violated, reset our saved support variables
if close > previousSup2 and barstate.isconfirmed
previousSup1 := na
previousSup2 := na
// Draw our current resistance zone
r1 = plot(res1 == res1 ? res1 : na, color=close >= res1 ? color.green : color.red, style=plot.style_linebr, title="R1")
r2 = plot(res1 == res1 ? res2 : na, color=close >= res1 ? color.green : color.red, style=plot.style_linebr, title="R2")
fill(r1, r2, color=close > res1 ? color.green : color.new(color.red, 50), title="Resistance Zone")
// Draw our current support zone
s1 = plot(sup1 == sup1 ? sup1 : na, color=close < sup1 ? color.red : color.green, style=plot.style_linebr, title="S1")
s2 = plot(sup1 == sup1 ? sup2 : na, color=close < sup1 ? color.red : color.green, style=plot.style_linebr, title="S2")
fill(s1, s2, color=close < sup1 ? color.red : color.new(color.green, 50), title="Support Zone")
// Draw our previous support zone (turned potential resistance)
ps1 = plot(previousSup1 == previousSup1 and previousSup1 != sup1 and drawPreviousStructure ? previousSup1 : na, color=color.red, style=plot.style_linebr, title="PS1")
ps2 = plot(previousSup1 == previousSup1 and previousSup1 != sup1 and drawPreviousStructure ? previousSup2 : na, color=color.red, style=plot.style_linebr, title="PS2")
fill(ps1, ps2, color=color.new(color.red, 10), title="Previous Support Zone")
// Draw our previous resistance zone (turned potential support)
pr1 = plot(previousRes1 == previousRes1 and previousRes1 != res1 and drawPreviousStructure ? previousRes1 : na, color=color.green, style=plot.style_linebr, title="PR1")
pr2 = plot(previousRes1 == previousRes1 and previousRes1 != res1 and drawPreviousStructure ? previousRes2 : na, color=color.green, style=plot.style_linebr, title="PR2")
fill(pr1, pr2, color=color.new(color.green, 10), title="Previous Resistance Zone")
////////////////////////////////////////////////////////////////////////////
///// /////
///// STARS Code Block /////
///// /////
////////////////////////////////////////////////////////////////////////////
//calculation variables. Hardcoded for now.
Depth1 = 5
Depth2 = 13
Depth3 = 34
Deviation1 = 1
Deviation2 = 8
Deviation3 = 13
Backstep1 = 3
Backstep2 = 5
Backstep3 = 8
// STAR Color settings - MEDIUM NOW BLUE
color1 = input(title = "Small Stars Color", defval = color.yellow)
color2 = color1
color3 = input(title = "Medium Stars Color", defval = color.aqua)
color4 = color3
color5 = input(title = "Large Sell Stars Color", defval = color.red)
color6 = input(title = "Large Buy Stars Color", defval = color.lime)
repaint = true
// CHATGPT FIX #1: Add useStar parameter
zigzag(Depth0, Deviation0, Backstep0, color0, color00, size0, useStar) =>
var last_h = 1
last_h += 1
var last_l = 1
last_l += 1
var lw = 1
var hg = 1
lw += 1
hg += 1
p_lw = -ta.lowestbars(Depth0)
p_hg = -ta.highestbars(Depth0)
lowing = lw == p_lw or low - low > Deviation0 * syminfo.mintick
highing = hg == p_hg or high - high > Deviation0 * syminfo.mintick
lh = ta.barssince(not highing )
ll = ta.barssince(not lowing )
down = ta.barssince(not(lh > ll)) >= Backstep0
lower = low > low
higher = high < high
if lw != p_lw and (not down or lower)
lw := p_lw < hg ? p_lw : 0
lw
if hg != p_hg and (down or higher)
hg := p_hg < lw ? p_hg : 0
hg
label point = na
x1 = down ? lw : hg
y1 = down ? low -3 : high
if down == down
if repaint
label.delete(point )
down
if down != down
if down
last_h := hg
last_h
else
last_l := lw
last_l
if not repaint
nx = down ? last_h : last_l
point := label.new(bar_index-nx, down ? high : low -6, text = "🟡", style=down?label.style_label_down:label.style_label_up)
down
if repaint
// FINAL FIX: Use red/green circle emojis for Depth3, yellow circles for Depth1/2
txt = useStar ? (down ? "🟢" : "🔴") : "🟡"
point := label.new(bar_index - x1, y1, txt, style=label.style_none, size=size0, textcolor=down ? color00 : color0, xloc=xloc.bar_index, yloc=yloc.price, force_overlay=true)
if displayStars
// CHATGPT FIX #3: Pass false for Depth1/2, true for Depth3
zigzag(Depth1, Deviation1, Backstep1, color1, color2, size.normal, false)
zigzag(Depth2, Deviation2, Backstep2, color3, color4, size.large, false)
zigzag(Depth3, Deviation3, Backstep3, color5, color6, size.huge, true)
////////////////////////////////////////////////////////////////////////////
///// /////
///// Trigger Alerts /////
///// /////
////////////////////////////////////////////////////////////////////////////
// Code Alerts
alert_message = ""
if ta.cross(short,medium) and short>medium
alert_message := "EMA Cross Buy alert for " + syminfo.description + "\nprice: " + str.tostring(math.round(open, 2))
alert(alert_message, freq=alert.freq_once_per_bar)
if ta.cross(short,medium) and short






















