Educational
cc AJ TIME WITH TIME EXTENSIONcc AJ TIME WITH TIME EXTENSION – Flexible Session & Time-Based Highlighter (v6)
A fully customizable Pine Script® indicator that lets you highlight specific times of day using three different calculation methods and draw extended background rectangles (session boxes) forward in time.
Features:
• Up to 6 independent time rules
• Three selectable detection methods for each rule (you can combine them):
– Direct minute match (e.g. when the current minute = your target)
– Addition method (hour + minute = target value)
– Subtraction method (minute − hour = target value)
• Each rule can independently color candles (barcolor) and/or draw a price-level rectangle
• Rectangles automatically extend right for a user-defined duration (hours + minutes)
• Individual control over fill color, opacity, border color, and border thickness
• Works on any timeframe and any symbol
• Uses UTC+2 as reference timezone (common for many European/London-based sessions – change in code if needed)
Perfect for marking custom session windows, recurring intraday time windows, or any personal time-based confluences you trade.
No external data, no repainting, no hidden calculations – completely transparent and compliant with TradingView House Rules.
Educational / personal use only • Not financial advice
NAS Oracle AlgoThe NAS Oracle Algo is a powerful and versatile daily trading indicator designed to provide clear, automated support and resistance levels for both long and short trading strategies. By calculating a dynamic range based on the previous day's price action, it projects key entry points, stop-losses, and up to six profit targets onto your chart, giving you a complete roadmap for the trading day.
Key Features:
Dual-Sided Strategy: Generates independent levels for BUY and SELL setups, making it effective for both directional and range-bound markets.
Customizable Reference Point: Choose between using the current day's "Open" or the previous day's "Pre Close" as the base for all calculations.
Comprehensive Levels:
Entry Level: The price level to execute a trade.
Stop Loss: A predefined level to limit potential losses.
Profit Targets (1-6): Six incremental take-profit levels, allowing for partial profit-taking strategies.
Multiple Display Options:
Visual Levels & Labels: Clean horizontal lines and text labels are drawn directly on the chart for easy price reference.
Information Table: A highly customizable data table that summarizes all key levels, which can be positioned at the Top or Bottom of the chart and resized.
Flexible Configuration: Toggle the visibility of levels and choose to show either 3 or 6 profit targets to suit your trading style and avoid chart clutter.
How to Use:
Add the Indicator: Apply the "NAS Oracle Algo" to your chart. It works best on daily and intraday timeframes.
Configure Settings: In the indicator's settings, choose your preferred Option (Open/Pre Close), toggle levels and the table on/off, and adjust their position and size.
Interpret the Signals:
BUY Setup: When the price moves above the green "Buy Above" level, consider a long entry.
Stop Loss: Place your stop loss at the BUY_SL level.
Take Profit: Scale out of your position at the six progressively higher target levels (T1 to T6).
SELL Setup: When the price moves below the red "Sell Below" level, consider a short entry.
Stop Loss: Place your stop loss at the SELL_SL level.
IC Opposite Candle Zones – BOXESWhat this does
✔ Detects bullish & bearish institutional candles
✔ Finds the last opposite candle before it
✔ Creates a zone using that candle’s full wick range
✔ Draws it with actual boxes that extend forward
✔ Deletes old boxes so your chart doesn’t get cluttered
Hamaada RangeThis indicator plots the Daily DR/IDR range (19:30–23:00 NY) for each weekday, Monday to Friday.
It automatically draws the Daily Range (DR) and Initial Daily Range (IDR) highs, lows, midlines, and opening price.
Each day’s DR/IDR box extends into the following session for clarity and projection.
All lines and colors are fully customizable per-day.
Tracks 3-bar swings after the DR window closes.
Automatically detects when price violates the DR high or low.
Draws a “Swing Violation Line” from the last valid swing to the end of the extension period.
Friday DR extends to next Monday and supports cross-week swing violation detection.
Background shading, labels, and opening lines are optional.
Designed for precision session modeling in NY timezone (America/New_York recommended).
[GetSparx] Nova Pro⚡ Nova Pro – Position Calculator
This indicator is a user-friendly TradingView indicator designed to help traders plan and visualize their entry and exit points, calculate position sizing, and instantly display key risk metrics. By simply entering three price levels (Entry, Take Profit and Stop Loss) along with a risk amount in USD, the indicator draws color-coded lines and labels on the chart, and generates a concise table with all computed values. This allows you to assess the risk-reward profile of any trade at a glance, without performing manual calculations.
⚙️ How It Works
When the indicator is added to the chart it will ask to specify the price inputs and the risk amount in USD.
Price Inputs (Entry, TP, SL)
• You specify three price levels: the entry price, the profit target (Take Profit) and the loss threshold (Stop Loss).
• Inputs use TradingView’s native price-picker fields. Any change is immediately reflected on the chart.
Visual Display
• Each level is plotted as a line stretching into the future for enough room.
• Labels on the right show the exact price, color-coded: orange for Entry, green for TP and red for SL.
• Previous lines and labels are automatically removed when parameters change, ensuring the chart remains clean.
Risk Calculations
• The entered risk amount (in USD) is combined with the distance between Entry and SL to compute the optimal number of units (Qty) to trade.
• The script automatically detects whether it’s a long or short trade based on the relative positions of Entry and TP.
• Note that the risk and reward calculations do not factor in exchange fees, slippage, funding rates or any other trading costs. Actual profit and loss may differ once transaction fees and market execution variances are applied, so be sure to adjust your position sizing and expectations accordingly.
🎯 What You Can Do With It
• Consistent Position Sizing
Automate your position size so you consistently risk the same dollar amount, regardless of price volatility or stop distance.
• Clear Risk Management
Instantly view your Reward-to-Risk ratio, potential profit in USD and exact risk amount, so you make well-informed decisions.
• Rapid Scenario Analysis
Adjust TP, SL or Entry on the fly to see how each change affects your potential profit, loss and RR ratio.
• Publication-Ready Charts
The visual elements and integrated table are optimized for TradingView publications, giving your analysis a professional, polished look.
📊 Explanation of Table Values
• Entry
Calculation: rounded to the nearest tick of your entered entry price.
Marks the exact level at which you initiate the trade and serves as the reference point for all further risk and reward calculations.
• Quantity (Qty)
Calculation: Risk USD ÷ (Entry − Stop Loss).
Determines how many units, contracts or shares to trade so that a stop-out at your SL equals exactly your predefined dollar risk, resulting in consistent per-trade exposure.
• Risk to Reward (RR)
Calculation: (Take Profit − Entry) ÷ (Entry − Stop Loss).
Expresses how many dollars of potential profit you target for each dollar you risk. Values above 1 mean the reward exceeds the risk, guiding you to favorable setups.
• Take Profit (TP)
Calculation: rounded to the nearest tick of your entered take-profit price.
Your target exit level for booking gains, highlighted in green on the chart. Shows where you plan to capture profits if the market moves in your favor.
• Profit
Calculation: Qty × (Take Profit − Entry).
Gives the absolute potential gain in USD if price reaches your TP. Useful for comparing total return across different instruments or setups.
• Stop Loss (SL)
Calculation: rounded to the nearest tick of your entered stop-loss price.
The level at which your trade is automatically closed to cap losses, highlighted in red on the chart. Ensures you never lose more than your defined risk amount.
• Risk
Calculation: equals the entered Risk USD.
The maximum dollar amount you’re willing to lose on this trade. Acts as the upper boundary for your exposure, keeping your position sizing disciplined.
📝 Examples
• Long Example 1: Bitcoin/USD
Entry: $11851.1
Take Profit: $123853.9
Stop Loss: $115467.7
Risk USD: $500
The Risk to Reward ratio results in 2.25, which means the reward exceeds the risk.
For each dollar you risk, this setup has potential gains of 2.25 dollars.
• Long Example 2: Algorand/USD
Entry: $0.2919
Take Profit: $0.3491
Stop Loss: $0.2655
Risk USD: $1000
The Risk to Reward ratio on this trade results in 2.17 and has a potential profit target of $2166.67. With a risk of $1000 USD the table conveniently shows a quantity of 37878 ALGO is needed for the trade.
• Short Example 1: Forex EUR/USD
Entry: $1.16666
Take Profit: $1.15459
Stop Loss: $1.17374
Risk USD: $200
With a risk of $200 USD and a RR of 2.17, this example shows how a short trade can be accomplished on EUR/USD.
• Short Example 2: Gold
Entry: $3366.29
Take Profit: $3272.01
Stop Loss: $3386.87
Risk USD: $1500
Within this short setup a risk of $1500 USD is used, which results in a RR of 4.58. The potential profit for this trade is $6871.72.
⚠ Disclaimer
This tool is for educational and analytical use only. It does not provide financial advice or trading signals. Always use proper risk management and do your own due diligence.
AstraEdgeAstra Edge Tool
Astra Edge is built from the ground up, through years of real market experience, observation, and execution — not theory.
It reflects how I personally analyze price structure, volatility, and directional bias in live markets.
The indicator combines multiple layers of technical logic — multi-timeframe trend context, fixed daily structure levels, volatility bands, and range compression detection — into one stable, easy-to-read system.
It does not predict or guarantee direction; it reads what the market is doing right now and presents it visually in a structured way.
Every element of Astra Edge — the dashboard, zones, and compression highlights — is designed to help traders interpret market behavior, not chase it.
It aims to bring clarity and control to your intraday or swing decision-making by helping you focus on structure, momentum, and context instead of noise.
It’s not a shortcut or a holy grail.
It’s a refined tool that mirrors how experienced traders actually think — visually, contextually, and systematically.
⚙️ Features
🟢 Multi–Timeframe Dashboard
A clean grid showing five user-selected symbols across three timeframes — giving instant trend alignment and strength visibility.
LTP, % change, and SMA direction are colour-coded for quick interpretation.
🔵 Fixed Market Structure Levels
Automatic plotting of previous day and today’s high, low, open, and close —
the four most powerful reference points for intraday structure and reaction levels.
No repainting, no recalculation — just static, reliable structure.
🟣 Zone Bands
Calculates zones from the prior candles
Weekly or custom timeframe zones
Zones are highlighted dynamically and labeled clearly, helping you identify balance, breakout, and reversal regions visually.
🟠 Sideways Zone Detector
Built-in compression detector that identifies when the market is stuck in range.
Highlights consolidation zones and labels them with optional Zig Zag markers, helping traders avoid choppy conditions or plan breakout traps early.
🟡 Optional Bollinger Framework
Toggleable Bollinger structure that adds volatility context to the chart, helping spot expansions, squeezes, or range resets quickly.
⚙️ Customization
Dashboard and Sideways Zone ON/OFF switches
Adjustable zone thickness, label names, and colours
Works across stocks, indices, forex, and crypto
Optimized for dark and light chart themes
🧠 How to Use
Best for intraday and positional structure analysis
Works on any timeframe — but ideal visualization on 1m to 1h charts
Ideal timeframe 5mins
Focus on zone reactions and structure shifts, not standalone signals
Combine with your own entry confirmation or volume logic
Remember — Astra Edge shows structure, it doesn’t decide trades.
💎 Philosophy
“Every trader has tools. The elite have Astra Edge.”
Astra Edge was built for traders who prefer clarity over clutter and discipline over guesswork.
It combines multiple technical frameworks — not to replace your strategy, but to enhance your judgment.
⚠️ Disclaimer
I am not a SEBI-registered advisor.
This indicator is created purely for educational and informational purposes.
It does not guarantee profits, nor should it be considered investment advice or a trading signal system.
Trading and investing involve risk — use at your own discretion and consult a SEBI-registered financial advisor before making any financial decisions.
Astra Edge follows price action — price action does not follow Astra Edge.
Sometimes it will align perfectly with the trend, other times it won’t.
This is not a Holy Grail, it’s a structured lens to view the market more intelligently.
BTST Stats BTST Statistical Edge Analyzer — VCR · Volume · SMA · RSI Filtered
This indicator isn’t a trading signal generator.
It’s a research framework designed to answer a simple but valuable question:
“Does Buy-Today-Sell-Tomorrow (BTST) have statistical edge under specific market conditions?”
Most traders assume BTST works because they feel markets gap.
This script measures whether that belief holds true — and under what filters.
🔍 What the Indicator Does
For each bar, the script simulates a BTST trade:
Entry: previous bar’s close
Exit: current bar’s open
Result: Open(next day) − Close(previous day)
But a BTST trade is only counted if the entry bar satisfies the filter logic.
🎯 Entry Filters You Can Tune
A trade is included only if ALL activated conditions are satisfied:
Filter Rule
VCR Filter Candle volatility ratio must exceed threshold: `(High−Low) /
Volume Filter Volume must be greater than n × AverageVolume
SMA Trend Filter (Optional) Close must be above a user-selected SMA length
RSI Condition (Optional) RSI must be between a user-defined min/max band
This allows testing BTST under different volatility, trend, and momentum conditions.
📊 What the Table Shows
For all qualifying trades inside the chosen lookback window, the indicator displays:
Metric Meaning
Profitable Trades Count of BTST trades with positive overnight return
Losing Trades Count of negative overnight returns
Avg Profit Average upside gain on winner trades
Avg Loss Average downside loss on losing trades
Avg Net per Trade Overall expectancy across all trades
Avg High After Entry Average maximum price movement above entry (potential upside)
Avg Low After Entry Average price movement against the entry (risk exposure)
Winner-Only High/Low Stats How far good trades move and how much heat they take
Loser-Only High/Low Stats How bad trades behave, including early fake-outs
Together, these reveal:
Opportunity potential
Risk exposure
Whether trades behave cleanly or chaotically
Whether exits are leaving money on the table
🧠 Why This Matters
BTST edges change drastically across:
Market regimes
Trend direction
Volatility clusters
Earnings cycles
Volume surges
This tool helps identify when BTST should be traded — and when it should be avoided entirely.
Rather than guessing, traders can:
Validate if their BTST assumptions hold,
Apply filters until the expectancy improves,
Rank symbols and conditions where the system performs best.
🚫 Not a Buy/Sell Indicator
This script does not place arrows, signals, alerts, or entries.
It exists for analysis and system development, not live execution.
Use it to:
Build ideas
Validate hypotheses
Compare symbols
Optimize BTST frameworks
Decide if BTST belongs in your playbook — or in the trash
🔧 Who This Is For
✔ System traders
✔ Quant-minded traders
✔ Options/Index traders who rely on gaps
✔ Swing traders testing overnight holds
✔ Developers building automated BTST logic
Final Thought
BTST isn’t magic — it’s just a behavior pattern.
Some markets reward it.
Some punish it.
Some reward it only under the right volatility and volume conditions.
This tool tells you which is which.
Astra EdgeAstra Edge Tool
Astra Edge is built from the ground up, through years of real market experience, observation, and execution — not theory.
It reflects how I personally analyze price structure, volatility, and directional bias in live markets.
The indicator combines multiple layers of technical logic — multi-timeframe trend context, fixed daily structure levels, volatility bands, and range compression detection — into one stable, easy-to-read system.
It does not predict or guarantee direction; it reads what the market is doing right now and presents it visually in a structured way.
Every element of Astra Edge — the dashboard, zones, and compression highlights — is designed to help traders interpret market behavior, not chase it.
It aims to bring clarity and control to your intraday or swing decision-making by helping you focus on structure, momentum, and context instead of noise.
It’s not a shortcut or a holy grail.
It’s a refined tool that mirrors how experienced traders actually think — visually, contextually, and systematically.
⚙️ Features
🟢 Multi–Timeframe Dashboard
A clean grid showing five user-selected symbols across three timeframes — giving instant trend alignment and strength visibility.
LTP, % change, and SMA direction are colour-coded for quick interpretation.
🔵 Fixed Market Structure Levels
Automatic plotting of previous day and today’s high, low, open, and close —
the four most powerful reference points for intraday structure and reaction levels.
No repainting, no recalculation — just static, reliable structure.
🟣 Zone Bands
Calculates zones from the prior candles
Weekly or custom timeframe zones
Zones are highlighted dynamically and labeled clearly, helping you identify balance, breakout, and reversal regions visually.
🟠 Sideways Zone Detector
Built-in compression detector that identifies when the market is stuck in range.
Highlights consolidation zones and labels them with optional Zig Zag markers, helping traders avoid choppy conditions or plan breakout traps early.
🟡 Optional Bollinger Framework
Toggleable Bollinger structure that adds volatility context to the chart, helping spot expansions, squeezes, or range resets quickly.
⚙️ Customization
Dashboard and Sideways Zone ON/OFF switches
Adjustable zone thickness, label names, and colours
Works across stocks, indices, forex, and crypto
Optimized for dark and light chart themes
🧠 How to Use
Best for intraday and positional structure analysis
Works on any timeframe — but ideal visualization on 1m to 1h charts
Ideal timeframe 5mins
Focus on zone reactions and structure shifts, not standalone signals
Combine with your own entry confirmation or volume logic
Remember — Astra Edge shows structure, it doesn’t decide trades.
💎 Philosophy
“Every trader has tools. The elite have Astra Edge.”
Astra Edge was built for traders who prefer clarity over clutter and discipline over guesswork.
It combines multiple technical frameworks — not to replace your strategy, but to enhance your judgment.
⚠️ Disclaimer
I am not a SEBI-registered advisor.
This indicator is created purely for educational and informational purposes.
It does not guarantee profits, nor should it be considered investment advice or a trading signal system.
Trading and investing involve risk — use at your own discretion and consult a SEBI-registered financial advisor before making any financial decisions.
Astra Edge follows price action — price action does not follow Astra Edge.
Sometimes it will align perfectly with the trend, other times it won’t.
This is not a Holy Grail, it’s a structured lens to view the market more intelligently.
💼 Access
“Access available to invite-only users.”
All existing users will receive lifetime updates and improvements without any additional charges.
Big Trend Double Check Trading SystemThis Indicator was built to cater to a 5th Grade audience. Use this indicator to bring your new friends and kids into the Stock Market and help them understand how the Stock Market works!
Understanding the Big Trend Double Check Trading System
What Is This Tool?
This is a helper tool for buying and selling stocks. Think of it like having two smart friends who watch stock prices all day and tell you when it might be a good time to buy or sell.
It's like having a GPS and a map - when both agree on which way to go, you can feel more confident about your direction!
The Two Helpers
1. Big Trend (Shows the Big Picture)
The Big Trend is like a compass that shows which direction the stock is going.
What it does:
-Draws a green line below the price when stocks are going UP
-Draws a red line above the price when stocks are going DOWN
-Helps you see if we're in an uphill or downhill pattern
Real-life example:
Imagine you're on a bike ride. The Big Trend tells you if the road ahead is going uphill or downhill. You can see the general direction you're traveling.
2. Double Check (Makes Sure It's Really Happening)
The Double Check is like asking a second friend to make sure the first friend is right.
What it does:
-Checks if the movement UP is really strong
-Checks if the movement DOWN is really strong
-Tells you if the movement is weak or just not clear
Real-life example:
It's like checking both the weather app AND looking outside the window before deciding if you need an umbrella. If both say it's raining, you definitely need that umbrella!
How Do They Work Together?
The magic happens when BOTH helpers agree! This is called being "In Sync."
🚀 Strong Go Up Signal (Maybe Time to Buy)
When does this happen?
-Big Trend says: "We're going UP!" ↑
-Double Check says: "Yes! And it's going up STRONG!" ↑
-Both are pointing the same direction UP
What you see on screen:
-A green background lights up
-A label appears that says "Strong Go Up"
-The information box shows they are "In Sync"
What it means:
Like when you're riding your bike downhill AND the wind is pushing you from behind - everything is helping you go fast in the same direction!
🔻 Strong Go Down Signal (Maybe Time to Sell)
When does this happen?
-Big Trend says: "We're going DOWN!" ↓
-Double Check says: "Yes! And it's going down STRONG!" ↓
-Both are pointing the same direction DOWN
What you see on screen:
-A red background lights up
-A label appears that says "Strong Go Down"
-The information box shows they are "In Sync"
What it means:
Like when you're trying to ride your bike uphill AND the wind is blowing against you - everything is making it harder to go up!
Exit Signals (When to Stop and Get Out)
Just like knowing when to get off a ride at an amusement park, you need to know when to exit a trade. This tool helps with that too!
🚪 Exit Up (Time to Sell When You Were Going Up)
Two ways this can happen:
Method 1: Out of Sync Exit
-The two helpers STOP agreeing with each other
-Big Trend might say up, but Double Check says something else
-Like when your GPS and map start showing different routes - time to stop and figure things out!
Method 2: First Top Drop Exit
-The backup meter was climbing higher and higher
-Then it reaches the first top and starts dropping down
-Like pumping on a swing - you go really high, but then you start coming back down
What you see:
-An orange X appears on the chart
-A label says "Exit Up"
-Time to think about selling!
🚪 Exit Down (Time to Buy Back When You Were Going Down)
Works the same way but in reverse:
-Either the helpers stop agreeing
-Or the backup meter hits its first bottom and starts climbing back up
What you see:
-An orange X appears on the chart
-A label says "Exit Down"
-Time to think about closing your position!
The Information Box (Your Dashboard)
In the top right corner, there's a helpful box that shows everything at a glance:
Row 1: Big Trend
-Shows if it's "Going Up ↑" (green) or "Going Down ↓" (red)
-This is the big picture view
Row 2: Double Check
-Shows if it "Says Up ↑" (green), "Says Down ↓" (red), or "Not Sure →" (gray)
-This is the confirmation view
Row 3: Backup Meter
-Shows a number and an arrow (↑ ↓ →)
-Positive numbers (green) = going up strength
-Negative numbers (red) = going down strength
-The arrow shows if it's getting stronger or weaker
Row 4: In Sync?
-"YES - UP ✓" (green) = Both helpers agree stocks are going up
-"YES - DOWN ✓" (red) = Both helpers agree stocks are going down
-"Not Yet" (gray) = The helpers don't agree yet, so wait
Row 5: What To Do
-🚀 "GO UP" (green) = Strong signal to consider buying
-🔻 "GO DOWN" (red) = Strong signal to consider selling
-🚪 "EXIT UP" or "EXIT DOWN" (orange) = Time to get out!
-"Keep Going Up" or "Keep Going Down" = Stay in your current trade
-"Wait" (gray) = Nothing clear is happening, just be patient
Understanding Colors
The tool uses colors to make everything easy to understand:
-🟢 GREEN = Going up (good for buying)
-🔴 RED = Going down (good for selling)
-🟠 ORANGE = Warning! Time to exit!
-⚫ GRAY = Nothing clear, just wait
Memory trick: Think of a traffic light!
-Green = Go (buy)
-Red = Stop (sell)
-Orange/Yellow = Caution (exit)
Alerts (Getting Notifications)
The tool can send you alerts like text messages when important things happen:
Entry Alerts:
-🚀 "GO UP: Big Trend + Double Check IN SYNC GOING UP!"
-🔻 "GO DOWN: Big Trend + Double Check IN SYNC GOING DOWN!"
Exit Alerts:
-🚪 "EXIT UP: Exit condition happened!"
-🚪 "EXIT DOWN: Exit condition happened!"
Why this helps: You don't have to watch the screen all day! The tool will let you know when something important happens.
Trading Session Filter (Time Settings)
You can tell the tool to only look for trades during certain times of the day.
Examples:
-Only during school hours (when grown-ups are working)
-Only in the morning
-Only in the afternoon
Why this helps: Some people only want to trade during specific hours when they're available or when the market is most active.
Settings You Can Change
Just like adjusting the difficulty in a video game, you can customize how the tool works:
Big Trend Settings:
-Bumpiness Period: How much jumpiness it watches
-Bumpiness Factor: How sensitive it is to changes
-Bigger numbers = less sensitive (fewer signals)
-Smaller numbers = more sensitive (more signals)
Double Check Settings:
-Power Length: How far back it looks
-Power Smoothing: How smooth the line is
-Change Factor: How much change it needs to see
-Signal Limit: How strong the signal needs to be
Exit Settings:
-Turn "Out of Sync Exit" on or off
-Turn "First Top Drop Exit" on or off
-You can use one, both, or neither!
Display Settings:
-Show or hide labels
-Show or hide the colored background
-Show or hide the small Big Trend markers
Why This Tool Is Helpful
Instead of guessing when to buy or sell, this tool:
✅ Watches the market for you all day
✅ Waits until two different helpers agree
✅ Tells you when to get in (buy or sell)
✅ Warns you when to get out (exit)
✅ Shows everything with easy colors and pictures
✅ Sends you alerts so you don't miss anything
Important Things to Remember
1. Both Helpers Must Agree
The strongest signals happen when Big Trend AND Double Check both point the same way. Don't act on just one helper!
2. Green Means Up, Red Means Down
This is super easy to remember. The colors tell you everything!
3. Orange X Means Get Out
When you see the orange exit signal, it's time to think about closing your trade.
4. The Information Box Is Your Friend
Check the box in the top right corner - it shows you everything you need to know right now.
5. Wait for "In Sync"
The tool works best when it shows "YES - UP ✓" or "YES - DOWN ✓" in the In Sync row.
6. Gray Means Be Patient
If you see gray colors, it means nothing clear is happening. That's okay! Just wait for a better signal.
Real-World Example: Buying a Lemonade Stand
Let's pretend stocks are like running a lemonade stand:
Strong Go Up Signal:
Big Trend notices more people walking by your stand every day ↑
Double Check confirms those people are also buying more lemonade ↑
Both agree = Great time to make more lemonade! (Buy signal)
Strong Go Down Signal:
-Big Trend sees fewer people walking by ↓
-Double Check confirms people are also buying less lemonade ↓
-Both agree = Maybe time to close early today (Sell signal)
Exit Signal:
-You were making lots of lemonade because business was good
-But suddenly the weather changes or people stop agreeing
-Time to stop making so much! (Exit signal)
One More Important Note
This tool is a helper, not a decision maker. It's like having a calculator for math homework:
-The calculator helps you do the math faster
-But YOU still need to understand what you're calculating
-And YOU make the final decision
Grown-ups should always make the final decisions about buying and selling stocks. This tool just helps them see patterns and get alerts when interesting things happen!
Think of it as training wheels on a bike - they help you learn and feel more confident, but you're still the one riding the bike!
Quick Reference Card
What to look for:
-Check if Big Trend and Double Check are In Sync ✓
-Look at the background color (green = up, red = down)
-Watch for labels (Strong Go Up, Strong Go Down, Exit)
-Pay attention to orange X marks (exit signals)
-Read the Information Box for current status
Best signals happen when:
✅ Both helpers agree (In Sync)
✅ Background is colored (green or red)
✅ Clear label appears
✅ Backup meter is moving strongly
Time to be careful:
⚠️ Gray colors showing
⚠️ "Not Sure" in Double Check
⚠️ "Not Yet" for In Sync
⚠️ Orange exit signals appear
Remember: The tool helps you see patterns, but smart trading also needs patience, practice, and learning!
Price Action - Bar CountDrawing from Al Brooks' emphasis on session rhythms in his books, this counts bars from market opens, resetting at US (0930-1600 ET), HK (0930-1200,1300-1600 HKT), or London (0800-1630 GMT) if selected. Labels every N bars (default 2) below, with custom colors per session and after-hours gray. Up to 79 in regular color, then faded. Helps track opening range tests and two-legged moves—focus on first hour dynamics for high-probability trades.
Price Action - H/L BarBased on Al Brooks' "Bar by Bar" (Chapter 09A, p.45-50) and "Trends" (p.98-105), this marks H (higher high with close above mid) and L (lower low with close below mid) swings. Marking pauses after each, resuming on pullback. Labels "H" above and "L" below bars for swing counting in trends or ranges. Key: Markets form two legs—use for measured moves or failed breakouts, always in context of prior extremes.
Price Action - Trend BarFrom Al Brooks' "Trading Price Action Trends," this indicator colors strong trend bars. Bull trend bars (green body ≥50%, close ≥60% up range, larger than 1.5x average) highlight buyer control, while bear trend bars (red body ≥50%, close ≤40% down range) show seller dominance. Use to identify trend resumption or climaxes. Philosophy: Trends persist until tested—focus on high-probability entries after pullbacks, avoiding barbwire noise.
Price Action - Reversal BarInspired by Al Brooks' "Trading Price Action Reversals," this indicator detects potential bull and bear reversal bars. Bull reversals require a green bar with close above mid-range, small upper tail (≤30%), large lower tail (≥30%), and low below previous low without significant overlap. Bear reversals are the opposite. Triangles mark these setups for early reversal signals in trends or climaxes. Remember, markets test extremes—use with trend lines for confirmation, as single bars are often traps without a second leg.
CandleMapTF — Price Delivery Description:
Multi-timeframe “Phases Of Price Delivery” mapper.
Classifies each higher-timeframe candle into:
- Consolidation
- Retracement
- Expansion
Disclaimer:
This script is for educational and informational purposes only and does not
constitute financial advice, investment advice, or a trading recommendation.
Use at your own risk.
CrossX GR v3.3 Oh, the sacred CrossX signal! He came down from heaven to show us the way to 35% profit. And if not, then it's not your risk management that will be to blame, but the fact that you didn't wait for the third green candle.
Lord, give me strength. You're risking money based on an indicator that sells for likes. Skin in the game? Your "guru" only risks not getting 500 reposts.
The real support is not a line on the chart. This is the size of your position, at which you won't panic when this pseudo-analysis fails. And he will fail.
Recursive WMA Angle StrategyDescription: This strategy utilizes a recursive Weighted Moving Average (WMA) calculation to determine the trend direction and strength based on the slope (angle) of the curve. By calculating the angle of the smoothed moving average in degrees, the script filters out noise and aims to enter trades only during strong momentum phases.
How it Works:
Recursive WMA: The script calculates a series of nested WMAs (M1 to M5), creating a very smooth yet responsive curve.
Angle Calculation: It measures the rate of change of this curve over a user-defined lookback period and converts it into an angle (in degrees).
Entry Condition (Long): A long position is opened when the calculated angle exceeds the Min Angle for BUY threshold (default: 0.2), indicating a strong upward trend.
Exit Condition: The position is closed when the angle drops below the Min Angle for SELL threshold (default: -0.2), indicating a sharp trend reversal.
Settings:
MA Settings: Adjust the base lengths for the recursive calculation.
Angle Settings: Fine-tune the sensitivity by changing the Buy/Sell angle thresholds.
Date Filter: Restrict the backtest to a specific date range.
Note: This strategy is designed for Long-Only setups.
MAYUR XAUUSD 1 MIN SUPPORT RESISTANCEFOR BETTER TRADING – USE 1 MIN & 5 MIN CHARTS
Intraday traders should always focus on short–term charts to catch quick market moves.
Here’s why 👇
🔹 1-Minute Chart
• Best for scalping and fast entries
• Helps track real-time price action
• Useful for capturing momentum and breakout trades
• Identify immediate support and resistance
🔹 5-Minute Chart
• Gives more apparent trend confirmation
• Helps avoid false breakouts from the 1-minute chart
• Perfect for trade execution with reduced noise
• Better for holding trades for 10–30 minutes
✨ Pro Tip
• Use a 1-minute chart for entry signals
• Use 5-minute chart to confirm direction & trend
• Mark important levels from 15-min / 1-hour chart for accuracy
• Follow volume and candle patterns before executing
📌 If both timeframes show the same direction → High-probability trade
📌 If mismatch → Wait for alignment (No emotion, only discipline!)
Bitcoin Macro Fair Value [Structural]//@version=6
indicator("Bitcoin Macro Fair Value ", overlay=true)
// --- Model Coefficients (Derived from Python Analysis 2019-2025) ---
intercept = input.float(3.156434, "Intercept")
c_m2 = input.float(0.132827, "Real M2 Coef")
c_corp = input.float(0.742593, "Corp Spread Coef")
c_hy = input.float(-0.617968, "HY Spread Coef")
c_dxy = input.float(0.009772, "DXY Coef")
c_real30 = input.float(0.713311, "Real 30Y Coef")
c_be30 = input.float(-1.059273, "Breakeven 30Y Coef")
c_slope = input.float(0.402220, "Slope 10Y-2Y Coef")
// --- Data Fetching ---
m2 = request.security("FRED:M2SL", "M", close)
cpi = request.security("FRED:CPIAUCSL", "M", close)
real_m2 = m2 / cpi
corp = request.security("FRED:BAMLC0A0CM", "D", close)
hy = request.security("FRED:BAMLH0A0HYM2", "D", close)
dxy = request.security("TVC:DXY", "D", close)
real30 = request.security("FRED:DFII30", "D", close)
nom30 = request.security("FRED:DGS30", "D", close)
be30 = nom30 - real30
nom10 = request.security("FRED:DGS10", "D", close)
nom2 = request.security("FRED:DGS2", "D", close)
slope = nom10 - nom2
// --- Calculation ---
log_fv = intercept + (c_m2 * real_m2) + (c_corp * corp) + (c_hy * hy) + (c_dxy * dxy) + (c_real30 * real30) + (c_be30 * be30) + (c_slope * slope)
fair_value = math.exp(log_fv)
plot(fair_value, "Macro Fair Value", color=color.new(color.blue, 0), linewidth=2)
NeuraEdge Block Trades v1.0NEURAEDGE BLOCK TRADES
═══════════════════════════════════════════════════════════════════════
We are excited to release Block Trades!
WHY THIS INDICATOR EXISTS?
Retail traders face a fundamental challenge: institutions move markets, but their activity is hidden. When smart money accumulates at support or distributes at resistance, retail traders often find themselves on the wrong side of the move.
Understanding where institutions are actively buying or selling is crucial for:
• Validating trade setups with volume confirmation
• Identifying supply and demand zones that actually hold
• Avoiding false breakouts driven by retail sentiment
• Spotting accumulation before major moves up
• Detecting distribution before major moves down
Most volume indicators simply show size without context. Block Trades was created to bridge this gap by detecting abnormally large volume bars and determining their directional bias, giving retail traders insight into institutional activity.
═══════════════════════════════════════════════════════════════════════
WHAT IT DOES:
Block Trades identifies volume spikes that likely represent institutional order flow and classifies them as buying pressure, selling pressure, or contested zones. The indicator then validates these prints against directional flow analysis and groups nearby prints into accumulation or distribution clusters.
This helps you answer critical questions:
• Is this support level being defended by institutions?
• Are smart money players distributing into this rally?
• Is heavy volume confirming my trade or warning against it?
• Where are institutional interest zones forming?
KEY FEATURES:
• Multi-tier volume detection (Large: 2x, Huge: 3x, Massive: 5x average)
• Directional classification with flow validation
• Accumulation/distribution zone detection
• Print clustering for institutional interest areas
• Confluence scoring system (0-10 points)
• Real-time statistics dashboard
• Clean, minimal chart labels
═══════════════════════════════════════════════════════════════════════
HOW IT WORKS:
VOLUME SPIKE DETECTION
The indicator monitors volume against a moving average baseline. When current volume significantly exceeds this average (default thresholds: 2x, 3x, 5x), it flags the bar as a potential institutional print.
DIRECTIONAL CLASSIFICATION
Buy Print: Large volume + closes in top 70% of range
Sell Print: Large volume + closes in bottom 70% of range
Neutral Print: Large volume + mid-range close (absorption/contested)
The close position within the bar's range reveals who won the battle. A bar with massive volume that closes near its high indicates aggressive buying. The same volume closing near the low indicates aggressive selling.
FLOW VALIDATION
Each print is validated against underlying institutional flow calculations. This filters out volume spikes that don't align with directional pressure, significantly reducing false signals. Buy prints require bullish flow, sell prints require bearish flow.
ACCUMULATION & DISTRIBUTION ZONES
When multiple prints occur at similar price levels with consistent direction:
• Repeated buy prints + bullish trend = Accumulation (institutions building positions)
• Repeated sell prints + bearish trend = Distribution (institutions unloading positions)
These zones often become powerful support/resistance levels because institutions have established significant positions there.
PRINT CLUSTERING
The indicator groups nearby prints (within configurable ATR distance) into clusters. When 3 or more prints form a cluster, it marks an institutional interest zone. These clusters frequently act as price magnets and reversal points.
PRINT CLUSTERING
The indicator groups nearby prints (within configurable ATR distance) into clusters. When 3 or more prints form a cluster, it marks an institutional interest zone. These clusters frequently act as price magnets and reversal points.
CONFLUENCE SCORING
Each print receives a confluence score (0-10 points) based on:
• Volume size (Massive: +3, Huge: +2, Large: +1)
• Flow alignment (+2 points, configurable)
• Trend alignment (+1)
• New high/low made (+1)
• Extreme close position (+1)
Prints with 5+ points receive a star marker, indicating ultra-high conviction setups.
═══════════════════════════════════════════════════════════════════════
HOW TRADERS USE IT:
USE CASE 1: TRADE VALIDATION
Your system signals a long entry at support. Check Block Trades:
• Buy prints present at this level? Institutions defending = Take the trade
• Sell prints present? Institutions distributing = Skip or wait
• No prints? Proceed with normal risk management
USE CASE 2: IDENTIFYING EXHAUSTION
Price rallies to resistance with heavy volume:
• Sell prints appear = Distribution, institutions unloading into strength
• Likely reversal coming, consider shorts or exit longs
• Confirmed by multiple sell prints = High conviction reversal setup
USE CASE 3: FINDING SUPPORT/RESISTANCE
Accumulation cluster forms at 450 level:
• Multiple buy prints over several sessions
• Institutions building positions at this price
• 450 becomes high-probability support for future pullbacks
• Use for entries or stop placement
USE CASE 4: BREAKOUT CONFIRMATION
Price breaks above key resistance:
• Buy print on breakout bar = Real institutional participation
• High confluence score (5+) = Ultra-high conviction
• Fake breakout would show sell prints or no prints
USE CASE 5: AVOIDING TRAPS
Price spikes up on huge volume:
• Sell print appears (closes low in range) = Trap
• Institutions selling into retail FOMO
• Avoid chasing, prepare for reversal
═══════════════════════════════════════════════════════════════════════
VISUAL ELEMENTS:
ON-CHART LABELS
Buy Print: Green label below bar showing size (LARGE/HUGE/MASSIVE)
Sell Print: Red label above bar showing size
Contested Print: Orange label at bar high (large volume, mid-range close)
Accumulation: Green "ACCUM" label with diamond symbol
Distribution: Red "DISTRIB" label with diamond symbol
WHAT CONTESTED MEANS:
When a bar has massive volume but closes in the middle of its range (neither top nor bottom 70%), it indicates a battle between buyers and sellers with no clear winner. This often occurs at:
• Major support/resistance levels where institutions are absorbing supply/demand
• Transition zones before a directional move
• Areas of genuine price discovery and uncertainty
Contested prints can signal absorption (institutions quietly building positions) or genuine indecision. Watch for follow-through on the next bar to determine which side won.
LABEL MODIFIERS
∆ checkmark = Flow validated (institutional flow aligns with print)
Star symbol = High confluence (5+ points, ultra-high conviction)
CLUSTER ZONES
Semi-transparent boxes marking areas where multiple prints occurred
Extend to the right to show ongoing institutional interest zones
Color-coded: green for bullish clusters, red for bearish clusters
DASHBOARD (TOP RIGHT)
• Current volume state and ratio
• Institutional flow direction
• Cumulative trend direction
• Recent print count (last 20 bars)
• Active cluster count
• Volume thresholds
STATISTICS (BOTTOM LEFT)
• Total session prints
• Buy/sell percentage split
═══════════════════════════════════════════════════════════════════════
SETTINGS:
PRINT DETECTION
• Volume Lookback Period: 20 bars (for average calculation)
• Large Print Threshold: 2.0x average
• Huge Print Threshold: 3.0x average
• Massive Print Threshold: 5.0x average
• Min Candle Size: 0.3x ATR (filters doji bars)
CLASSIFICATION
• Directional Threshold: 70% (how far in range to qualify as buy/sell)
• Show Neutral Prints: Toggle contested zones
• Require New High/Low: Optional stricter filter
INSTITUTIONAL FLOW
• Enable Flow Confluence: On/Off toggle
• Flow Confluence Weight: 2 points (adjustable 1-5)
CLUSTERING
• Enable Clustering: On/Off
• Cluster Distance: 1.0x ATR (how close prints must be)
• Min Prints for Cluster: 3 prints
• Show Cluster Zones: On/Off
DISPLAY
• Show Print Labels: Toggle all labels
• Show Accumulation/Distribution/Contested Labels: Toggle special labels
• Label Size: Tiny/Small/Normal
• Colors: Customizable buy/sell/neutral colors
FILTERS
• Minimum Volume: 0 (set threshold to ignore low volume bars)
• Session Filter: Avoid first/last 15 minutes (low liquidity)
═══════════════════════════════════════════════════════════════════════
BEST PRACTICES:
DO:
✓ Use as confluence with your primary trading system
✓ Pay attention to accumulation/distribution zones
✓ Look for high confluence prints (5+ stars)
✓ Validate breakouts with print direction
✓ Use cluster zones as future support/resistance
✓ Combine with higher timeframe analysis
✓ Works best on liquid instruments (major pairs, indices, large cap stocks)
DON'T:
✗ Trade prints as standalone buy/sell signals
✗ Ignore the directional classification (context matters)
✗ Use on low-volume instruments (prints less reliable)
✗ Chase every print without confluence confirmation
✗ Trade during low liquidity hours (first/last 15 min)
✗ Expect 100% accuracy (it's a confluence tool, not crystal ball)
OPTIMAL TIMEFRAMES:
• 5-minute to 1-hour charts for intraday trading
• 1-hour to 4-hour charts for swing trading
• Daily charts for position trading
BEST INSTRUMENTS:
• Major forex pairs (EUR/USD, GBP/USD, etc.)
• Index futures (ES, NQ, YM)
• High-volume stocks (SPY, QQQ, TSLA, AAPL, etc.)
• Major cryptocurrencies (BTC, ETH)
═══════════════════════════════════════════════════════════════════════
IMPORTANT DISCLAIMERS
METHODOLOGY DISCLAIMER
This indicator identifies abnormally large volume bars and estimates their directional bias based on price action and flow analysis. It does NOT have access to:
• Actual dark pool transaction data
• Off-exchange Alternative Trading System (ATS) prints
• Level 2 order book data
• Individual trade sizes or timestamps
• Institutional order identification
The prints detected are estimates based on publicly available volume and price data from TradingView. They indicate probable institutional activity patterns but are not confirmed block trades or dark pool executions.
USAGE DISCLAIMER
Block Trades is designed as a CONFLUENCE tool to validate trade setups - not as a standalone trading system. The indicator does not:
• Generate specific entry/exit signals
• Provide stop loss or take profit levels
• Constitute a complete trading strategy
• Guarantee profitable trades
Prints should be interpreted within the context of:
• Your overall trading strategy
• Market structure and trend
• Support/resistance levels
• Risk management rules
• Multiple timeframe analysis
RISK DISCLAIMER
Trading involves substantial risk of loss and is not suitable for every investor. Past performance is not indicative of future results. This indicator is a tool for technical analysis only and does NOT constitute financial advice, investment advice, trading advice, or a recommendation to buy or sell any securities or financial instruments.
You should not make any investment decision without conducting your own research and due diligence. The accuracy, completeness, and timeliness of the information provided by this indicator is not guaranteed. No representation is being made that using this indicator will guarantee profits or prevent losses.
By using this indicator, you acknowledge that you understand and accept all risks associated with trading, and you agree that the developer is not liable for any losses you may incur.
═══════════════════════════════════════════════════════════════════════
ALERTS
Available alert conditions:
• Massive Buy Print
• Massive Sell Print
• Huge Buy Print
• Huge Sell Print
• Accumulation Detected
• Distribution Detected
• High Confluence Buy (5+ points)
• High Confluence Sell (5+ points)
Happy Trading!
Naveen Prabhu with EMA//@version=6
indicator('Naveen Prabhu with EMA', overlay = true, max_labels_count = 500, max_lines_count = 500, max_boxes_count = 500)
a = input(2, title = 'Key Vaule. \'This changes the sensitivity\'')
c = input(5, title = 'ATR Period')
h = input(false, title = 'Signals from Heikin Ashi Candles')
BULLISH_LEG = 1
BEARISH_LEG = 0
BULLISH = +1
BEARISH = -1
GREEN = #089981
RED = #F23645
BLUE = #2157f3
GRAY = #878b94
MONO_BULLISH = #b2b5be
MONO_BEARISH = #5d606b
HISTORICAL = 'Historical'
PRESENT = 'Present'
COLORED = 'Colored'
MONOCHROME = 'Monochrome'
ALL = 'All'
BOS = 'BOS'
CHOCH = 'CHoCH'
TINY = size.tiny
SMALL = size.small
NORMAL = size.normal
ATR = 'Atr'
RANGE = 'Cumulative Mean Range'
CLOSE = 'Close'
HIGHLOW = 'High/Low'
SOLID = '⎯⎯⎯'
DASHED = '----'
DOTTED = '····'
SMART_GROUP = 'Smart Money Concepts'
INTERNAL_GROUP = 'Real Time Internal Structure'
SWING_GROUP = 'Real Time Swing Structure'
BLOCKS_GROUP = 'Order Blocks'
EQUAL_GROUP = 'EQH/EQL'
GAPS_GROUP = 'Fair Value Gaps'
LEVELS_GROUP = 'Highs & Lows MTF'
ZONES_GROUP = 'Premium & Discount Zones'
modeTooltip = 'Allows to display historical Structure or only the recent ones'
styleTooltip = 'Indicator color theme'
showTrendTooltip = 'Display additional candles with a color reflecting the current trend detected by structure'
showInternalsTooltip = 'Display internal market structure'
internalFilterConfluenceTooltip = 'Filter non significant internal structure breakouts'
showStructureTooltip = 'Display swing market Structure'
showSwingsTooltip = 'Display swing point as labels on the chart'
showHighLowSwingsTooltip = 'Highlight most recent strong and weak high/low points on the chart'
showInternalOrderBlocksTooltip = 'Display internal order blocks on the chart Number of internal order blocks to display on the chart'
showSwingOrderBlocksTooltip = 'Display swing order blocks on the chart Number of internal swing blocks to display on the chart'
orderBlockFilterTooltip = 'Method used to filter out volatile order blocks It is recommended to use the cumulative mean range method when a low amount of data is available'
orderBlockMitigationTooltip = 'Select what values to use for order block mitigation'
showEqualHighsLowsTooltip = 'Display equal highs and equal lows on the chart'
equalHighsLowsLengthTooltip = 'Number of bars used to confirm equal highs and equal lows'
equalHighsLowsThresholdTooltip = 'Sensitivity threshold in a range (0, 1) used for the detection of equal highs & lows Lower values will return fewer but more pertinent results'
showFairValueGapsTooltip = 'Display fair values gaps on the chart'
fairValueGapsThresholdTooltip = 'Filter out non significant fair value gaps'
fairValueGapsTimeframeTooltip = 'Fair value gaps timeframe'
fairValueGapsExtendTooltip = 'Determine how many bars to extend the Fair Value Gap boxes on chart'
showPremiumDiscountZonesTooltip = 'Display premium, discount, and equilibrium zones on chart'
modeInput = input.string( HISTORICAL, 'Mode', group = SMART_GROUP, tooltip = modeTooltip, options = )
styleInput = input.string( COLORED, 'Style', group = SMART_GROUP, tooltip = styleTooltip,options = )
showTrendInput = input( false, 'Color Candles', group = SMART_GROUP, tooltip = showTrendTooltip)
showInternalsInput = input( false, 'Show Internal Structure', group = INTERNAL_GROUP, tooltip = showInternalsTooltip)
showInternalBullInput = input.string( ALL, 'Bullish Structure', group = INTERNAL_GROUP, inline = 'ibull', options = )
internalBullColorInput = input( GREEN, '', group = INTERNAL_GROUP, inline = 'ibull')
showInternalBearInput = input.string( ALL, 'Bearish Structure' , group = INTERNAL_GROUP, inline = 'ibear', options = )
internalBearColorInput = input( RED, '', group = INTERNAL_GROUP, inline = 'ibear')
internalFilterConfluenceInput = input( false, 'Confluence Filter', group = INTERNAL_GROUP, tooltip = internalFilterConfluenceTooltip)
internalStructureSize = input.string( TINY, 'Internal Label Size', group = INTERNAL_GROUP, options = )
showStructureInput = input( false, 'Show Swing Structure', group = SWING_GROUP, tooltip = showStructureTooltip)
showSwingBullInput = input.string( ALL, 'Bullish Structure', group = SWING_GROUP, inline = 'bull', options = )
swingBullColorInput = input( GREEN, '', group = SWING_GROUP, inline = 'bull')
showSwingBearInput = input.string( ALL, 'Bearish Structure', group = SWING_GROUP, inline = 'bear', options = )
swingBearColorInput = input( RED, '', group = SWING_GROUP, inline = 'bear')
swingStructureSize = input.string( SMALL, 'Swing Label Size', group = SWING_GROUP, options = )
showSwingsInput = input( false, 'Show Swings Points', group = SWING_GROUP, tooltip = showSwingsTooltip,inline = 'swings')
swingsLengthInput = input.int( 50, '', group = SWING_GROUP, minval = 10, inline = 'swings')
showHighLowSwingsInput = input( false, 'Show Strong/Weak High/Low',group = SWING_GROUP, tooltip = showHighLowSwingsTooltip)
showInternalOrderBlocksInput = input( true, 'Internal Order Blocks' , group = BLOCKS_GROUP, tooltip = showInternalOrderBlocksTooltip, inline = 'iob')
internalOrderBlocksSizeInput = input.int( 5, '', group = BLOCKS_GROUP, minval = 1, maxval = 20, inline = 'iob')
showSwingOrderBlocksInput = input( true, 'Swing Order Blocks', group = BLOCKS_GROUP, tooltip = showSwingOrderBlocksTooltip, inline = 'ob')
swingOrderBlocksSizeInput = input.int( 5, '', group = BLOCKS_GROUP, minval = 1, maxval = 20, inline = 'ob')
orderBlockFilterInput = input.string( 'Atr', 'Order Block Filter', group = BLOCKS_GROUP, tooltip = orderBlockFilterTooltip, options = )
orderBlockMitigationInput = input.string( HIGHLOW, 'Order Block Mitigation', group = BLOCKS_GROUP, tooltip = orderBlockMitigationTooltip, options = )
internalBullishOrderBlockColor = input.color(color.new(GREEN, 80), 'Internal Bullish OB', group = BLOCKS_GROUP)
internalBearishOrderBlockColor = input.color(color.new(#f77c80, 80), 'Internal Bearish OB', group = BLOCKS_GROUP)
swingBullishOrderBlockColor = input.color(color.new(GREEN, 80), 'Bullish OB', group = BLOCKS_GROUP)
swingBearishOrderBlockColor = input.color(color.new(#b22833, 80), 'Bearish OB', group = BLOCKS_GROUP)
showEqualHighsLowsInput = input( false, 'Equal High/Low', group = EQUAL_GROUP, tooltip = showEqualHighsLowsTooltip)
equalHighsLowsLengthInput = input.int( 3, 'Bars Confirmation', group = EQUAL_GROUP, tooltip = equalHighsLowsLengthTooltip, minval = 1)
equalHighsLowsThresholdInput = input.float( 0.1, 'Threshold', group = EQUAL_GROUP, tooltip = equalHighsLowsThresholdTooltip, minval = 0, maxval = 0.5, step = 0.1)
equalHighsLowsSizeInput = input.string( TINY, 'Label Size', group = EQUAL_GROUP, options = )
showFairValueGapsInput = input( false, 'Fair Value Gaps', group = GAPS_GROUP, tooltip = showFairValueGapsTooltip)
fairValueGapsThresholdInput = input( true, 'Auto Threshold', group = GAPS_GROUP, tooltip = fairValueGapsThresholdTooltip)
fairValueGapsTimeframeInput = input.timeframe('', 'Timeframe', group = GAPS_GROUP, tooltip = fairValueGapsTimeframeTooltip)
fairValueGapsBullColorInput = input.color(color.new(#00ff68, 70), 'Bullish FVG' , group = GAPS_GROUP)
fairValueGapsBearColorInput = input.color(color.new(#ff0008, 70), 'Bearish FVG' , group = GAPS_GROUP)
fairValueGapsExtendInput = input.int( 1, 'Extend FVG', group = GAPS_GROUP, tooltip = fairValueGapsExtendTooltip, minval = 0)
showDailyLevelsInput = input( false, 'Daily', group = LEVELS_GROUP, inline = 'daily')
dailyLevelsStyleInput = input.string( SOLID, '', group = LEVELS_GROUP, inline = 'daily', options = )
dailyLevelsColorInput = input( BLUE, '', group = LEVELS_GROUP, inline = 'daily')
showWeeklyLevelsInput = input( false, 'Weekly', group = LEVELS_GROUP, inline = 'weekly')
weeklyLevelsStyleInput = input.string( SOLID, '', group = LEVELS_GROUP, inline = 'weekly', options = )
weeklyLevelsColorInput = input( BLUE, '', group = LEVELS_GROUP, inline = 'weekly')
showMonthlyLevelsInput = input( false, 'Monthly', group = LEVELS_GROUP, inline = 'monthly')
monthlyLevelsStyleInput = input.string( SOLID, '', group = LEVELS_GROUP, inline = 'monthly', options = )
monthlyLevelsColorInput = input( BLUE, '', group = LEVELS_GROUP, inline = 'monthly')
showPremiumDiscountZonesInput = input( false, 'Premium/Discount Zones', group = ZONES_GROUP , tooltip = showPremiumDiscountZonesTooltip)
premiumZoneColorInput = input.color( RED, 'Premium Zone', group = ZONES_GROUP)
equilibriumZoneColorInput = input.color( GRAY, 'Equilibrium Zone', group = ZONES_GROUP)
discountZoneColorInput = input.color( GREEN, 'Discount Zone', group = ZONES_GROUP)
type alerts
bool internalBullishBOS = false
bool internalBearishBOS = false
bool internalBullishCHoCH = false
bool internalBearishCHoCH = false
bool swingBullishBOS = false
bool swingBearishBOS = false
bool swingBullishCHoCH = false
bool swingBearishCHoCH = false
bool internalBullishOrderBlock = false
bool internalBearishOrderBlock = false
bool swingBullishOrderBlock = false
bool swingBearishOrderBlock = false
bool equalHighs = false
bool equalLows = false
bool bullishFairValueGap = false
bool bearishFairValueGap = false
type trailingExtremes
float top
float bottom
int barTime
int barIndex
int lastTopTime
int lastBottomTime
type fairValueGap
float top
float bottom
int bias
box topBox
box bottomBox
type trend
int bias
type equalDisplay
line l_ine = na
label l_abel = na
type pivot
float currentLevel
float lastLevel
bool crossed
int barTime = time
int barIndex = bar_index
type orderBlock
float barHigh
float barLow
int barTime
int bias
// @variable current swing pivot high
var pivot swingHigh = pivot.new(na,na,false)
// @variable current swing pivot low
var pivot swingLow = pivot.new(na,na,false)
// @variable current internal pivot high
var pivot internalHigh = pivot.new(na,na,false)
// @variable current internal pivot low
var pivot internalLow = pivot.new(na,na,false)
// @variable current equal high pivot
var pivot equalHigh = pivot.new(na,na,false)
// @variable current equal low pivot
var pivot equalLow = pivot.new(na,na,false)
// @variable swing trend bias
var trend swingTrend = trend.new(0)
// @variable internal trend bias
var trend internalTrend = trend.new(0)
// @variable equal high display
var equalDisplay equalHighDisplay = equalDisplay.new()
// @variable equal low display
var equalDisplay equalLowDisplay = equalDisplay.new()
// @variable storage for fairValueGap UDTs
var array fairValueGaps = array.new()
// @variable storage for parsed highs
var array parsedHighs = array.new()
// @variable storage for parsed lows
var array parsedLows = array.new()
// @variable storage for raw highs
var array highs = array.new()
// @variable storage for raw lows
var array lows = array.new()
// @variable storage for bar time values
var array times = array.new()
// @variable last trailing swing high and low
var trailingExtremes trailing = trailingExtremes.new()
// @variable storage for orderBlock UDTs (swing order blocks)
var array swingOrderBlocks = array.new()
// @variable storage for orderBlock UDTs (internal order blocks)
var array internalOrderBlocks = array.new()
// @variable storage for swing order blocks boxes
var array swingOrderBlocksBoxes = array.new()
// @variable storage for internal order blocks boxes
var array internalOrderBlocksBoxes = array.new()
// @variable color for swing bullish structures
var swingBullishColor = styleInput == MONOCHROME ? MONO_BULLISH : swingBullColorInput
// @variable color for swing bearish structures
var swingBearishColor = styleInput == MONOCHROME ? MONO_BEARISH : swingBearColorInput
// @variable color for bullish fair value gaps
var fairValueGapBullishColor = styleInput == MONOCHROME ? color.new(MONO_BULLISH,70) : fairValueGapsBullColorInput
// @variable color for bearish fair value gaps
var fairValueGapBearishColor = styleInput == MONOCHROME ? color.new(MONO_BEARISH,70) : fairValueGapsBearColorInput
// @variable color for premium zone
var premiumZoneColor = styleInput == MONOCHROME ? MONO_BEARISH : premiumZoneColorInput
// @variable color for discount zone
var discountZoneColor = styleInput == MONOCHROME ? MONO_BULLISH : discountZoneColorInput
// @variable bar index on current script iteration
varip int currentBarIndex = bar_index
// @variable bar index on last script iteration
varip int lastBarIndex = bar_index
// @variable alerts in current bar
alerts currentAlerts = alerts.new()
// @variable time at start of chart
var initialTime = time
// we create the needed boxes for displaying order blocks at the first execution
if barstate.isfirst
if showSwingOrderBlocksInput
for index = 1 to swingOrderBlocksSizeInput
swingOrderBlocksBoxes.push(box.new(na,na,na,na,xloc = xloc.bar_time,extend = extend.right))
if showInternalOrderBlocksInput
for index = 1 to internalOrderBlocksSizeInput
internalOrderBlocksBoxes.push(box.new(na,na,na,na,xloc = xloc.bar_time,extend = extend.right))
// @variable source to use in bearish order blocks mitigation
bearishOrderBlockMitigationSource = orderBlockMitigationInput == CLOSE ? close : high
// @variable source to use in bullish order blocks mitigation
bullishOrderBlockMitigationSource = orderBlockMitigationInput == CLOSE ? close : low
// @variable default volatility measure
atrMeasure = ta.atr(200)
// @variable parsed volatility measure by user settings
volatilityMeasure = orderBlockFilterInput == ATR ? atrMeasure : ta.cum(ta.tr)/bar_index
// @variable true if current bar is a high volatility bar
highVolatilityBar = (high - low) >= (2 * volatilityMeasure)
// @variable parsed high
parsedHigh = highVolatilityBar ? low : high
// @variable parsed low
parsedLow = highVolatilityBar ? high : low
// we store current values into the arrays at each bar
parsedHighs.push(parsedHigh)
parsedLows.push(parsedLow)
highs.push(high)
lows.push(low)
times.push(time)
leg(int size) =>
var leg = 0
newLegHigh = high > ta.highest( size)
newLegLow = low < ta.lowest( size)
if newLegHigh
leg := BEARISH_LEG
else if newLegLow
leg := BULLISH_LEG
leg
startOfNewLeg(int leg) => ta.change(leg) != 0
startOfBearishLeg(int leg) => ta.change(leg) == -1
startOfBullishLeg(int leg) => ta.change(leg) == +1
drawLabel(int labelTime, float labelPrice, string tag, color labelColor, string labelStyle) =>
var label l_abel = na
if modeInput == PRESENT
l_abel.delete()
l_abel := label.new(chart.point.new(labelTime,na,labelPrice),tag,xloc.bar_time,color=color(na),textcolor=labelColor,style = labelStyle,size = size.small)
drawEqualHighLow(pivot p_ivot, float level, int size, bool equalHigh) =>
equalDisplay e_qualDisplay = equalHigh ? equalHighDisplay : equalLowDisplay
string tag = 'EQL'
color equalColor = swingBullishColor
string labelStyle = label.style_label_up
if equalHigh
tag := 'EQH'
equalColor := swingBearishColor
labelStyle := label.style_label_down
if modeInput == PRESENT
line.delete( e_qualDisplay.l_ine)
label.delete( e_qualDisplay.l_abel)
e_qualDisplay.l_ine := line.new(chart.point.new(p_ivot.barTime,na,p_ivot.currentLevel), chart.point.new(time ,na,level), xloc = xloc.bar_time, color = equalColor, style = line.style_dotted)
labelPosition = math.round(0.5*(p_ivot.barIndex + bar_index - size))
e_qualDisplay.l_abel := label.new(chart.point.new(na,labelPosition,level), tag, xloc.bar_index, color = color(na), textcolor = equalColor, style = labelStyle, size = equalHighsLowsSizeInput)
getCurrentStructure(int size,bool equalHighLow = false, bool internal = false) =>
currentLeg = leg(size)
newPivot = startOfNewLeg(currentLeg)
pivotLow = startOfBullishLeg(currentLeg)
pivotHigh = startOfBearishLeg(currentLeg)
if newPivot
if pivotLow
pivot p_ivot = equalHighLow ? equalLow : internal ? internalLow : swingLow
if equalHighLow and math.abs(p_ivot.currentLevel - low ) < equalHighsLowsThresholdInput * atrMeasure
drawEqualHighLow(p_ivot, low , size, false)
p_ivot.lastLevel := p_ivot.currentLevel
p_ivot.currentLevel := low
p_ivot.crossed := false
p_ivot.barTime := time
p_ivot.barIndex := bar_index
if not equalHighLow and not internal
trailing.bottom := p_ivot.currentLevel
trailing.barTime := p_ivot.barTime
trailing.barIndex := p_ivot.barIndex
trailing.lastBottomTime := p_ivot.barTime
if showSwingsInput and not internal and not equalHighLow
drawLabel(time , p_ivot.currentLevel, p_ivot.currentLevel < p_ivot.lastLevel ? 'LL' : 'HL', swingBullishColor, label.style_label_up)
else
pivot p_ivot = equalHighLow ? equalHigh : internal ? internalHigh : swingHigh
if equalHighLow and math.abs(p_ivot.currentLevel - high ) < equalHighsLowsThresholdInput * atrMeasure
drawEqualHighLow(p_ivot,high ,size,true)
p_ivot.lastLevel := p_ivot.currentLevel
p_ivot.currentLevel := high
p_ivot.crossed := false
p_ivot.barTime := time
p_ivot.barIndex := bar_index
if not equalHighLow and not internal
trailing.top := p_ivot.currentLevel
trailing.barTime := p_ivot.barTime
trailing.barIndex := p_ivot.barIndex
trailing.lastTopTime := p_ivot.barTime
if showSwingsInput and not internal and not equalHighLow
drawLabel(time , p_ivot.currentLevel, p_ivot.currentLevel > p_ivot.lastLevel ? 'HH' : 'LH', swingBearishColor, label.style_label_down)
drawStructure(pivot p_ivot, string tag, color structureColor, string lineStyle, string labelStyle, string labelSize) =>
var line l_ine = line.new(na,na,na,na,xloc = xloc.bar_time)
var label l_abel = label.new(na,na)
if modeInput == PRESENT
l_ine.delete()
l_abel.delete()
l_ine := line.new(chart.point.new(p_ivot.barTime,na,p_ivot.currentLevel), chart.point.new(time,na,p_ivot.currentLevel), xloc.bar_time, color=structureColor, style=lineStyle)
l_abel := label.new(chart.point.new(na,math.round(0.5*(p_ivot.barIndex+bar_index)),p_ivot.currentLevel), tag, xloc.bar_index, color=color(na), textcolor=structureColor, style=labelStyle, size = labelSize)
deleteOrderBlocks(bool internal = false) =>
array orderBlocks = internal ? internalOrderBlocks : swingOrderBlocks
for in orderBlocks
bool crossedOderBlock = false
if bearishOrderBlockMitigationSource > eachOrderBlock.barHigh and eachOrderBlock.bias == BEARISH
crossedOderBlock := true
if internal
currentAlerts.internalBearishOrderBlock := true
else
currentAlerts.swingBearishOrderBlock := true
else if bullishOrderBlockMitigationSource < eachOrderBlock.barLow and eachOrderBlock.bias == BULLISH
crossedOderBlock := true
if internal
currentAlerts.internalBullishOrderBlock := true
else
currentAlerts.swingBullishOrderBlock := true
if crossedOderBlock
orderBlocks.remove(index)
storeOrdeBlock(pivot p_ivot,bool internal = false,int bias) =>
if (not internal and showSwingOrderBlocksInput) or (internal and showInternalOrderBlocksInput)
array a_rray = na
int parsedIndex = na
if bias == BEARISH
a_rray := parsedHighs.slice(p_ivot.barIndex,bar_index)
parsedIndex := p_ivot.barIndex + a_rray.indexof(a_rray.max())
else
a_rray := parsedLows.slice(p_ivot.barIndex,bar_index)
parsedIndex := p_ivot.barIndex + a_rray.indexof(a_rray.min())
orderBlock o_rderBlock = orderBlock.new(parsedHighs.get(parsedIndex), parsedLows.get(parsedIndex), times.get(parsedIndex),bias)
array orderBlocks = internal ? internalOrderBlocks : swingOrderBlocks
if orderBlocks.size() >= 100
orderBlocks.pop()
orderBlocks.unshift(o_rderBlock)
drawOrderBlocks(bool internal = false) =>
array orderBlocks = internal ? internalOrderBlocks : swingOrderBlocks
orderBlocksSize = orderBlocks.size()
if orderBlocksSize > 0
maxOrderBlocks = internal ? internalOrderBlocksSizeInput : swingOrderBlocksSizeInput
array parsedOrdeBlocks = orderBlocks.slice(0, math.min(maxOrderBlocks,orderBlocksSize))
array b_oxes = internal ? internalOrderBlocksBoxes : swingOrderBlocksBoxes
for in parsedOrdeBlocks
orderBlockColor = styleInput == MONOCHROME ? (eachOrderBlock.bias == BEARISH ? color.new(MONO_BEARISH,80) : color.new(MONO_BULLISH,80)) : internal ? (eachOrderBlock.bias == BEARISH ? internalBearishOrderBlockColor : internalBullishOrderBlockColor) : (eachOrderBlock.bias == BEARISH ? swingBearishOrderBlockColor : swingBullishOrderBlockColor)
box b_ox = b_oxes.get(index)
b_ox.set_top_left_point( chart.point.new(eachOrderBlock.barTime,na,eachOrderBlock.barHigh))
b_ox.set_bottom_right_point(chart.point.new(last_bar_time,na,eachOrderBlock.barLow))
b_ox.set_border_color( internal ? na : orderBlockColor)
b_ox.set_bgcolor( orderBlockColor)
displayStructure(bool internal = false) =>
var bullishBar = true
var bearishBar = true
if internalFilterConfluenceInput
bullishBar := high - math.max(close, open) > math.min(close, open - low)
bearishBar := high - math.max(close, open) < math.min(close, open - low)
pivot p_ivot = internal ? internalHigh : swingHigh
trend t_rend = internal ? internalTrend : swingTrend
lineStyle = internal ? line.style_dashed : line.style_solid
labelSize = internal ? internalStructureSize : swingStructureSize
extraCondition = internal ? internalHigh.currentLevel != swingHigh.currentLevel and bullishBar : true
bullishColor = styleInput == MONOCHROME ? MONO_BULLISH : internal ? internalBullColorInput : swingBullColorInput
if ta.crossover(close,p_ivot.currentLevel) and not p_ivot.crossed and extraCondition
string tag = t_rend.bias == BEARISH ? CHOCH : BOS
if internal
currentAlerts.internalBullishCHoCH := tag == CHOCH
currentAlerts.internalBullishBOS := tag == BOS
else
currentAlerts.swingBullishCHoCH := tag == CHOCH
currentAlerts.swingBullishBOS := tag == BOS
p_ivot.crossed := true
t_rend.bias := BULLISH
displayCondition = internal ? showInternalsInput and (showInternalBullInput == ALL or (showInternalBullInput == BOS and tag != CHOCH) or (showInternalBullInput == CHOCH and tag == CHOCH)) : showStructureInput and (showSwingBullInput == ALL or (showSwingBullInput == BOS and tag != CHOCH) or (showSwingBullInput == CHOCH and tag == CHOCH))
if displayCondition
drawStructure(p_ivot,tag,bullishColor,lineStyle,label.style_label_down,labelSize)
if (internal and showInternalOrderBlocksInput) or (not internal and showSwingOrderBlocksInput)
storeOrdeBlock(p_ivot,internal,BULLISH)
p_ivot := internal ? internalLow : swingLow
extraCondition := internal ? internalLow.currentLevel != swingLow.currentLevel and bearishBar : true
bearishColor = styleInput == MONOCHROME ? MONO_BEARISH : internal ? internalBearColorInput : swingBearColorInput
if ta.crossunder(close,p_ivot.currentLevel) and not p_ivot.crossed and extraCondition
string tag = t_rend.bias == BULLISH ? CHOCH : BOS
if internal
currentAlerts.internalBearishCHoCH := tag == CHOCH
currentAlerts.internalBearishBOS := tag == BOS
else
currentAlerts.swingBearishCHoCH := tag == CHOCH
currentAlerts.swingBearishBOS := tag == BOS
p_ivot.crossed := true
t_rend.bias := BEARISH
displayCondition = internal ? showInternalsInput and (showInternalBearInput == ALL or (showInternalBearInput == BOS and tag != CHOCH) or (showInternalBearInput == CHOCH and tag == CHOCH)) : showStructureInput and (showSwingBearInput == ALL or (showSwingBearInput == BOS and tag != CHOCH) or (showSwingBearInput == CHOCH and tag == CHOCH))
if displayCondition
drawStructure(p_ivot,tag,bearishColor,lineStyle,label.style_label_up,labelSize)
if (internal and showInternalOrderBlocksInput) or (not internal and showSwingOrderBlocksInput)
storeOrdeBlock(p_ivot,internal,BEARISH)
fairValueGapBox(leftTime,rightTime,topPrice,bottomPrice,boxColor) => box.new(chart.point.new(leftTime,na,topPrice),chart.point.new(rightTime + fairValueGapsExtendInput * (time-time ),na,bottomPrice), xloc=xloc.bar_time, border_color = boxColor, bgcolor = boxColor)
deleteFairValueGaps() =>
for in fairValueGaps
if (low < eachFairValueGap.bottom and eachFairValueGap.bias == BULLISH) or (high > eachFairValueGap.top and eachFairValueGap.bias == BEARISH)
eachFairValueGap.topBox.delete()
eachFairValueGap.bottomBox.delete()
fairValueGaps.remove(index)
// @function draw fair value gaps
// @returns fairValueGap ID
drawFairValueGaps() =>
= request.security(syminfo.tickerid, fairValueGapsTimeframeInput, [close , open , time , high , low , time , high , low ],lookahead = barmerge.lookahead_on)
barDeltaPercent = (lastClose - lastOpen) / (lastOpen * 100)
newTimeframe = timeframe.change(fairValueGapsTimeframeInput)
threshold = fairValueGapsThresholdInput ? ta.cum(math.abs(newTimeframe ? barDeltaPercent : 0)) / bar_index * 2 : 0
bullishFairValueGap = currentLow > last2High and lastClose > last2High and barDeltaPercent > threshold and newTimeframe
bearishFairValueGap = currentHigh < last2Low and lastClose < last2Low and -barDeltaPercent > threshold and newTimeframe
if bullishFairValueGap
currentAlerts.bullishFairValueGap := true
fairValueGaps.unshift(fairValueGap.new(currentLow,last2High,BULLISH,fairValueGapBox(lastTime,currentTime,currentLow,math.avg(currentLow,last2High),fairValueGapBullishColor),fairValueGapBox(lastTime,currentTime,math.avg(currentLow,last2High),last2High,fairValueGapBullishColor)))
if bearishFairValueGap
currentAlerts.bearishFairValueGap := true
fairValueGaps.unshift(fairValueGap.new(currentHigh,last2Low,BEARISH,fairValueGapBox(lastTime,currentTime,currentHigh,math.avg(currentHigh,last2Low),fairValueGapBearishColor),fairValueGapBox(lastTime,currentTime,math.avg(currentHigh,last2Low),last2Low,fairValueGapBearishColor)))
getStyle(string style) =>
switch style
SOLID => line.style_solid
DASHED => line.style_dashed
DOTTED => line.style_dotted
drawLevels(string timeframe, bool sameTimeframe, string style, color levelColor) =>
= request.security(syminfo.tickerid, timeframe, [high , low , time , time],lookahead = barmerge.lookahead_on)
float parsedTop = sameTimeframe ? high : topLevel
float parsedBottom = sameTimeframe ? low : bottomLevel
int parsedLeftTime = sameTimeframe ? time : leftTime
int parsedRightTime = sameTimeframe ? time : rightTime
int parsedTopTime = time
int parsedBottomTime = time
if not sameTimeframe
int leftIndex = times.binary_search_rightmost(parsedLeftTime)
int rightIndex = times.binary_search_rightmost(parsedRightTime)
array timeArray = times.slice(leftIndex,rightIndex)
array topArray = highs.slice(leftIndex,rightIndex)
array bottomArray = lows.slice(leftIndex,rightIndex)
parsedTopTime := timeArray.size() > 0 ? timeArray.get(topArray.indexof(topArray.max())) : initialTime
parsedBottomTime := timeArray.size() > 0 ? timeArray.get(bottomArray.indexof(bottomArray.min())) : initialTime
var line topLine = line.new(na, na, na, na, xloc = xloc.bar_time, color = levelColor, style = getStyle(style))
var line bottomLine = line.new(na, na, na, na, xloc = xloc.bar_time, color = levelColor, style = getStyle(style))
var label topLabel = label.new(na, na, xloc = xloc.bar_time, text = str.format('P{0}H',timeframe), color=color(na), textcolor = levelColor, size = size.small, style = label.style_label_left)
var label bottomLabel = label.new(na, na, xloc = xloc.bar_time, text = str.format('P{0}L',timeframe), color=color(na), textcolor = levelColor, size = size.small, style = label.style_label_left)
topLine.set_first_point( chart.point.new(parsedTopTime,na,parsedTop))
topLine.set_second_point( chart.point.new(last_bar_time + 20 * (time-time ),na,parsedTop))
topLabel.set_point( chart.point.new(last_bar_time + 20 * (time-time ),na,parsedTop))
bottomLine.set_first_point( chart.point.new(parsedBottomTime,na,parsedBottom))
bottomLine.set_second_point(chart.point.new(last_bar_time + 20 * (time-time ),na,parsedBottom))
bottomLabel.set_point( chart.point.new(last_bar_time + 20 * (time-time ),na,parsedBottom))
higherTimeframe(string timeframe) => timeframe.in_seconds() > timeframe.in_seconds(timeframe)
updateTrailingExtremes() =>
trailing.top := math.max(high,trailing.top)
trailing.lastTopTime := trailing.top == high ? time : trailing.lastTopTime
trailing.bottom := math.min(low,trailing.bottom)
trailing.lastBottomTime := trailing.bottom == low ? time : trailing.lastBottomTime
drawHighLowSwings() =>
var line topLine = line.new(na, na, na, na, color = swingBearishColor, xloc = xloc.bar_time)
var line bottomLine = line.new(na, na, na, na, color = swingBullishColor, xloc = xloc.bar_time)
var label topLabel = label.new(na, na, color=color(na), textcolor = swingBearishColor, xloc = xloc.bar_time, style = label.style_label_down, size = size.tiny)
var label bottomLabel = label.new(na, na, color=color(na), textcolor = swingBullishColor, xloc = xloc.bar_time, style = label.style_label_up, size = size.tiny)
rightTimeBar = last_bar_time + 20 * (time - time )
topLine.set_first_point( chart.point.new(trailing.lastTopTime, na, trailing.top))
topLine.set_second_point( chart.point.new(rightTimeBar, na, trailing.top))
topLabel.set_point( chart.point.new(rightTimeBar, na, trailing.top))
topLabel.set_text( swingTrend.bias == BEARISH ? 'Strong High' : 'Weak High')
bottomLine.set_first_point( chart.point.new(trailing.lastBottomTime, na, trailing.bottom))
bottomLine.set_second_point(chart.point.new(rightTimeBar, na, trailing.bottom))
bottomLabel.set_point( chart.point.new(rightTimeBar, na, trailing.bottom))
bottomLabel.set_text( swingTrend.bias == BULLISH ? 'Strong Low' : 'Weak Low')
drawZone(float labelLevel, int labelIndex, float top, float bottom, string tag, color zoneColor, string style) =>
var label l_abel = label.new(na,na,text = tag, color=color(na),textcolor = zoneColor, style = style, size = size.small)
var box b_ox = box.new(na,na,na,na,bgcolor = color.new(zoneColor,80),border_color = color(na), xloc = xloc.bar_time)
b_ox.set_top_left_point( chart.point.new(trailing.barTime,na,top))
b_ox.set_bottom_right_point(chart.point.new(last_bar_time,na,bottom))
l_abel.set_point( chart.point.new(na,labelIndex,labelLevel))
// @function draw premium/discount zones
// @returns void
drawPremiumDiscountZones() =>
drawZone(trailing.top, math.round(0.5*(trailing.barIndex + last_bar_index)), trailing.top, 0.95*trailing.top + 0.05*trailing.bottom, 'Premium', premiumZoneColor, label.style_label_down)
equilibriumLevel = math.avg(trailing.top, trailing.bottom)
drawZone(equilibriumLevel, last_bar_index, 0.525*trailing.top + 0.475*trailing.bottom, 0.525*trailing.bottom + 0.475*trailing.top, 'Equilibrium', equilibriumZoneColorInput, label.style_label_left)
drawZone(trailing.bottom, math.round(0.5*(trailing.barIndex + last_bar_index)), 0.95*trailing.bottom + 0.05*trailing.top, trailing.bottom, 'Discount', discountZoneColor, label.style_label_up)
parsedOpen = showTrendInput ? open : na
candleColor = internalTrend.bias == BULLISH ? swingBullishColor : swingBearishColor
plotcandle(parsedOpen,high,low,close,color = candleColor, wickcolor = candleColor, bordercolor = candleColor)
if showHighLowSwingsInput or showPremiumDiscountZonesInput
updateTrailingExtremes()
if showHighLowSwingsInput
drawHighLowSwings()
if showPremiumDiscountZonesInput
drawPremiumDiscountZones()
if showFairValueGapsInput
deleteFairValueGaps()
getCurrentStructure(swingsLengthInput,false)
getCurrentStructure(5,false,true)
if showEqualHighsLowsInput
getCurrentStructure(equalHighsLowsLengthInput,true)
if showInternalsInput or showInternalOrderBlocksInput or showTrendInput
displayStructure(true)
if showStructureInput or showSwingOrderBlocksInput or showHighLowSwingsInput
displayStructure()
if showInternalOrderBlocksInput
deleteOrderBlocks(true)
if showSwingOrderBlocksInput
deleteOrderBlocks()
if showFairValueGapsInput
drawFairValueGaps()
if barstate.islastconfirmedhistory or barstate.islast
if showInternalOrderBlocksInput
drawOrderBlocks(true)
if showSwingOrderBlocksInput
drawOrderBlocks()
lastBarIndex := currentBarIndex
currentBarIndex := bar_index
newBar = currentBarIndex != lastBarIndex
if barstate.islastconfirmedhistory or (barstate.isrealtime and newBar)
if showDailyLevelsInput and not higherTimeframe('D')
drawLevels('D',timeframe.isdaily,dailyLevelsStyleInput,dailyLevelsColorInput)
if showWeeklyLevelsInput and not higherTimeframe('W')
drawLevels('W',timeframe.isweekly,weeklyLevelsStyleInput,weeklyLevelsColorInput)
if showMonthlyLevelsInput and not higherTimeframe('M')
drawLevels('M',timeframe.ismonthly,monthlyLevelsStyleInput,monthlyLevelsColorInput)
xATR = ta.atr(c)
nLoss = a * xATR
src = h ? request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close, lookahead = barmerge.lookahead_off) : close
xATRTrailingStop = 0.0
iff_1 = src > nz(xATRTrailingStop , 0) ? src - nLoss : src + nLoss
iff_2 = src < nz(xATRTrailingStop , 0) and src < nz(xATRTrailingStop , 0) ? math.min(nz(xATRTrailingStop ), src + nLoss) : iff_1
xATRTrailingStop := src > nz(xATRTrailingStop , 0) and src > nz(xATRTrailingStop , 0) ? math.max(nz(xATRTrailingStop ), src - nLoss) : iff_2
pos = 0
iff_3 = src > nz(xATRTrailingStop , 0) and src < nz(xATRTrailingStop , 0) ? -1 : nz(pos , 0)
pos := src < nz(xATRTrailingStop , 0) and src > nz(xATRTrailingStop , 0) ? 1 : iff_3
xcolor = pos == -1 ? color.red : pos == 1 ? color.green : color.blue
ema = ta.ema(src, 1)
above = ta.crossover(ema, xATRTrailingStop)
below = ta.crossover(xATRTrailingStop, ema)
buy = src > xATRTrailingStop and above
sell = src < xATRTrailingStop and below
barbuy = src > xATRTrailingStop
barsell = src < xATRTrailingStop
//---------------------------------------------------------------------------------------------------------------------}
//ALERTS
//---------------------------------------------------------------------------------------------------------------------{
alertcondition(currentAlerts.internalBullishBOS, 'Internal Bullish BOS', 'Internal Bullish BOS formed')
alertcondition(currentAlerts.internalBullishCHoCH, 'Internal Bullish CHoCH', 'Internal Bullish CHoCH formed')
alertcondition(currentAlerts.internalBearishBOS, 'Internal Bearish BOS', 'Internal Bearish BOS formed')
alertcondition(currentAlerts.internalBearishCHoCH, 'Internal Bearish CHoCH', 'Internal Bearish CHoCH formed')
alertcondition(currentAlerts.swingBullishBOS, 'Bullish BOS', 'Internal Bullish BOS formed')
alertcondition(currentAlerts.swingBullishCHoCH, 'Bullish CHoCH', 'Internal Bullish CHoCH formed')
alertcondition(currentAlerts.swingBearishBOS, 'Bearish BOS', 'Bearish BOS formed')
alertcondition(currentAlerts.swingBearishCHoCH, 'Bearish CHoCH', 'Bearish CHoCH formed')
alertcondition(currentAlerts.internalBullishOrderBlock, 'Bullish Internal OB Breakout', 'Price broke bullish internal OB')
alertcondition(currentAlerts.internalBearishOrderBlock, 'Bearish Internal OB Breakout', 'Price broke bearish internal OB')
alertcondition(currentAlerts.swingBullishOrderBlock, 'Bullish Swing OB Breakout', 'Price broke bullish swing OB')
alertcondition(currentAlerts.swingBearishOrderBlock, 'Bearish Swing OB Breakout', 'Price broke bearish swing OB')
alertcondition(currentAlerts.equalHighs, 'Equal Highs', 'Equal highs detected')
alertcondition(currentAlerts.equalLows, 'Equal Lows', 'Equal lows detected')
alertcondition(currentAlerts.bullishFairValueGap, 'Bullish FVG', 'Bullish FVG formed')
alertcondition(currentAlerts.bearishFairValueGap, 'Bearish FVG', 'Bearish FVG formed')
alertcondition(buy, 'UT Long', 'UT Long')
alertcondition(sell, 'UT Short', 'UT Short')
plotshape(buy, title = 'Buy', text = 'Buy', style = shape.labelup, location = location.belowbar, color = color.new(color.green, 0), textcolor = color.new(color.white, 0), size = size.tiny)
plotshape(sell, title = 'Sell', text = 'Sell', style = shape.labeldown, location = location.abovebar, color = color.new(color.red, 0), textcolor = color.new(color.white, 0), size = size.tiny)
//--------------------------------------------------------------------------------------
// EMA ADDITIONS (Editable)
//--------------------------------------------------------------------------------------
ema5Len = input.int(5, "5 EMA Length", minval = 1)
ema9Len = input.int(9, "9 EMA Length", minval = 1)
ema5 = ta.ema(src, ema5Len)
ema9 = ta.ema(src, ema9Len)
plot(ema5, "EMA 5", color = color.red, linewidth = 2)
plot(ema9, "EMA 9", color = color.blue, linewidth = 2)
barcolor(barbuy ? color.green : na)
barcolor(barsell ? color.red : na)






















