Buy/Sell Indicator with Candles + RSI + MACD + S/RHere's a full Pine Script strategy for TradingView that combines:
Morning Star & Evening Star Doji patterns
RSI
MACD
Support & Resistance (basic logic)
Buy/Sell arrows with entry points
This script is for educational use and can be optimized further depending on your asset/timeframe.
指標和策略
15-Min Option Trend Strategy with AlertsSimple buy and sell strategy using RSI and SUPERTREND with price action. D'Trader
Multi-Timeframe High/Low LinesMulti-Timeframe High/Low Lines
Track and visualize high/low levels from multiple timeframes with automatic interaction detection and alerts.
Features:
Displays horizontal lines for highs and lows from Daily, Weekly, Monthly, Quarterly, and Yearly timeframes
Lines extend to the right until price interacts with them
Automatic interaction detection - lines stop extending when touched
Customizable colors for each timeframe and level type
Configurable line width and style (solid, dashed, dotted)
Built-in alerts for level interactions
Performance optimized for smooth operation
Works with traditional markets (futures, stocks) and crypto
How It Works:
Detects new candles on higher timeframes (Daily, Weekly, Monthly, Quarterly, Yearly)
Creates horizontal lines at the high and low of each new timeframe candle
Lines are drawn from the exact time/bar where the high/low occurred
Lines extend to the right until price touches the level
When a level is touched, the line stops extending and is marked as "hit"
Alerts can be configured to notify when levels are touched
Settings:
Timeframe Settings: Enable/disable individual timeframes
Visual Settings: Line width, style, and maximum number of levels
Colors: Custom colors for each timeframe's highs and lows
Alert Settings: Enable alerts for high/low level touches
Use Cases:
Identify key support and resistance levels from higher timeframes
Track when price interacts with significant levels
Use as part of a multi-timeframe analysis strategy
Set up alerts for level breaks or bounces
Combine with other indicators for entry/exit signals
Compatibility:
Works on all timeframes (1m to monthly)
Compatible with traditional markets (futures, stocks, forex)
Optimized for crypto markets
Handles market gaps and session resets properly
This indicator automatically manages line lifecycle, removing old lines and limiting total count for optimal performance.
SMC XAU/USD Pro✅ Structure filter: Only BUY if the price is above the last bullish BOS, and SELL if it is below the last bearish BOS.
✅ Significant candle body: At least 40% of the range to avoid weak signals.
✅ Boxes limited to 3 per type (old ones automatically cleared).
✅ Visual display of Take Profit and Stop Loss with green and red dashed lines.
✅ Clear BUY/SELL signals with visible labels.
🔥 EMA Ribbon with Dynamic Colors🔥 EMA Ribbon with Dynamic Colors — Indicator Description
📌 Overview
This EMA Ribbon with Dynamic Colors indicator is designed to provide clear visual cues about market trend strength and direction using Exponential Moving Averages (EMAs). It combines a main EMA line with a colorful ribbon of multiple EMAs to help traders quickly identify bullish or bearish momentum zones on the chart.
🔍 How It Works
Main EMA Line (Default 50):
The thick main EMA line changes color dynamically based on its slope:
🟢 Green when the slope is positive (bullish momentum)
🔴 Red when the slope is negative (bearish momentum)
EMA Ribbon:
A series of 5 EMAs with customizable lengths (default 10, 15, 20, 25, 30) are plotted as thinner lines. These create a "ribbon" effect with semi-transparent fills between them, providing a smooth gradient visualization of the trend.
Each ribbon EMA line also changes color based on its slope to reflect momentum strength and direction.
Background Color:
The chart background subtly highlights the overall trend zone by shading green in bullish phases and red in bearish phases, helping you quickly identify market regimes.
Trend Label:
A clear "BULLISH" or "BEARISH" label is displayed above the latest bar to summarize the current trend state based on the main EMA slope.
🎯 Benefits & Use Cases
Trend Identification:
The color-coded ribbon visually confirms if the market is trending strongly or weakening, making it easy to decide when to enter or exit trades.
Momentum Strength:
Slope-based coloring on multiple EMAs helps spot shifts in momentum early.
Visual Appeal:
The smooth ribbon and background highlight improve readability and reduce chart clutter compared to multiple separate EMAs.
Customization:
You can adjust each EMA length individually to tailor the ribbon to different timeframes or instruments.
⚙️ How to Use
Add the indicator to your TradingView chart.
Customize the EMA lengths via inputs to match your trading style.
Use the green/red EMA lines and ribbon to confirm trend direction and strength.
Use the background shading and trend label as additional visual confirmation.
Combine with other indicators or price action for entry and exit decisions.
Larry Williams's Market Structure
Here is a Pine script based on Larry Williams' market structure model.
Note: When processing real-time ticks, heavy calculations can cause script errors. To prevent this, please adjust the script's data range accordingly.
As I'm not an expert in Pine Script, there may be some imperfections. Your understanding is appreciated.
I have great admiration for the wisdom of Larry Williams.
May the trend be with you.
NOAHแน่นอนครับ ด้านล่างคือบทความฉบับภาษาอังกฤษ พร้อมการแนะนำให้ “ขยับกำไรขึ้นมาจุดคุ้มทุน (breakeven)” ทุกครั้งเมื่อเข้าเทรด:
---
## 📘 **NOAH Indicator Guide – Entry Strategy & Risk Management**
### 🔰 Overview
The **NOAH** indicator is a custom tool built for **TradingView** using Pine Script. It combines **multi-timeframe trend analysis** with **RCI reversal signals** to provide traders with high-confidence entry points and automatic **Take Profit (TP)** and **Stop Loss (SL)** levels.
---
## 🧠 Core Concept
### 1. ✅ **Multi-Timeframe Moving Average Trend Detection**
The indicator analyzes trend direction across **seven timeframes**:
* M1, M5, M15, M30, H1, H4, D1
* Uses customizable **Fast** and **Slow Moving Averages** (SMA, EMA, WMA, or RMA)
* If **Fast MA > Slow MA** → Uptrend (Buy)
* If **Fast MA < Slow MA** → Downtrend (Sell)
You can toggle each timeframe ON/OFF for custom filtering.
---
### 2. 📉 **RCI (Rank Correlation Index) Reversal Signal**
The RCI is used to detect overbought/oversold conditions:
* **RCI > 80** and turning downward → Sell Signal
* **RCI < -80** and turning upward → Buy Signal
The indicator uses **short, medium, and long RCI lengths**, with long RCI used for final confirmation.
---
### 3. 📋 **Signal Table Display**
The indicator shows a real-time table at the top-right corner with:
* TF (Timeframe)
* MA Signal:
* ↑ = Buy
* ↓ = Sell
* ⏸ = Neutral
* RCI Signal: same as above
* Live RCI values for short, mid, and long intervals
This lets you quickly evaluate the overall market alignment.
---
## 🎯 Entry Strategy
### 🟢 Buy Entry Conditions:
* MA signals in most (or all) timeframes = "Buy" or disabled (R)
* Long-term RCI gives a **Buy** signal
* Fast MA crosses above Slow MA (crossover) on current TF
📍 **The indicator will display a "BUY" label with pre-calculated SL and TP levels.**
---
### 🔴 Sell Entry Conditions:
* MA in TF1 = "Buy" or "R"
* MA in TF2–TF7 = "Sell" or "R"
* Long-term RCI gives a **Sell** signal
* Fast MA crosses below Slow MA (crossunder) on current TF
📍 **The indicator will display a "SELL" label with SL and TP levels.**
---
## 📌 TP & SL Calculation
* **Stop Loss (SL):**
* Buy: lowest low from the last X candles (customizable)
* Sell: highest high from the last X candles
* **Take Profit (TP):**
* Buy: `Close + (Close - Lowest Low) × RiskReward`
* Sell: `Close - (Highest High - Close) × RiskReward`
🧮 The Risk-Reward ratio is adjustable via settings (`TPRR` input).
---
## 🔐 Risk Management Tip:
**Always move your Stop Loss to breakeven once the price moves favorably.**
This helps protect capital and secure partial profit in case of sudden reversals.
> 📌 Example: If you're in a Buy trade and price moves 50% toward TP, consider adjusting SL to entry price.
---
Let me know if you'd like a PDF version or visual diagram for the strategy!
RV Indicator This Pine Script defines a custom Relative Volatility (RV) Indicator, which measures the ratio of directional price movement to volatility over a specified number of bars. Below is a full explanation of what this script does.
Title:
RV Indicator — Relative Volatility Oscillator
Purpose:
This indicator measures how aggressively price is moving compared to recent volatility, and smooths the result with a signal line. It can be used to gauge momentum shifts and trend strength.
How It Works – Step by Step
1. Measuring Price Momentum (v1)
It calculates the difference between the close and open prices of the last 4 candles.
A weighted average is applied:
The current candle and the one 3 bars ago get weight 1.
The two middle candles (1 and 2 bars ago) get weight 2.
This creates a smoothed momentum measure:
If close > open (bullish), v1 is positive.
If close < open (bearish), v1 is negative.
2. Measuring Volatility (v2)
Similarly, it calculates the high-low range for the last 4 candles.
The same weighting (1, 2, 2, 1) is applied.
This gives a smoothed volatility measure.
3. Combining Momentum and Volatility (RV Ratio)
For the past ti bars (default: 10), it sums up:
All v1 values (momentum sum)
All v2 values (volatility sum)
Then it divides them:
𝑅𝑉= sum of price momentum % sum of volatility
This produces the RV value:
RV > 0: Momentum is bullish (price is generally moving up relative to its volatility).
RV < 0: Momentum is bearish (price is moving down relative to its volatility).
4. Smoothed Signal Line (rvsig)
A smoothed version of the RV is created using a weighted average of the latest 4 RV values.
This acts like a signal line, similar to how MACD uses a signal line.
Crossovers between RV and this signal line can be used to detect shifts in momentum.
5. Visual Output
Orange Line (RV): Shows the raw momentum/volatility ratio.
Blue Line (Signal): A smoother line that follows RV more slowly.
Zero Line: Divides bullish vs. bearish momentum.
How to Use It in Trading
1. Look for Crossovers:
If RV crosses above its signal line → Possible buy signal (momentum turning bullish).
If RV crosses below its signal line → Possible sell signal (momentum turning bearish).
2. Check the Zero Line:
If both RV and Signal are above zero, momentum is bullish.
If both are below zero, momentum is bearish.
3. Filter False Signals:
Combine RV with a trend filter (like a 50 or 200 EMA) to avoid trading against the main trend.
Disclaimer: This script is for informational and educational purposes only. It does not constitute financial advice or a recommendation to buy or sell any asset. All trading decisions are solely your responsibility. Use at your own risk.
30s OR ProjectionsThis script gets the opening range for NQ,ES, and YM. It then created deviations based on this range as targets to take profit from. You may also use the deviations to enter into trades looking for the other side of the range. You have the ability to shade areas of the range.
ES Gap Trading Levels# ES Gap Trading Levels
## Overview
A professional gap trading indicator designed specifically for ES Futures traders. This indicator automatically captures the closing price at 3:59 PM ET (NYSE close) and immediately displays key gap levels for the evening trading session starting at 6:00 PM ET.
## Key Features
### ✅ **Automatic Gap Level Detection**
- Captures ES Futures closing price at 3:59-4:00 PM ET
- Instantly displays gap levels for immediate session planning
- Resets daily for fresh gap analysis
### ✅ **Six Critical Gap Levels**
- **±10 Points** (White lines) - Short-term gap targets
- **±20 Points** (Light Blue lines) - Medium gap targets
- **±30 Points** (Red lines) - Extended gap targets
### ✅ **Professional Display**
- Clean horizontal lines with customizable colors
- Clear labels showing point values (+30, +20, +10, -10, -20, -30)
- Gap levels table showing exact price targets
- Optional closing price reference line
### ✅ **Customizable Settings**
- Adjustable line colors, width, and extension
- Toggle labels and reference table on/off
- Manual closing price override for testing
- Debug mode for troubleshooting
### ✅ **Smart Management**
- Automatic cleanup of previous day's levels
- Lines appear immediately after market close
- Optimized for ES1!, MES1!, and other ES futures contracts
## How It Works
1. **Market Close Capture**: At 3:59 PM ET, the indicator captures the ES closing price
2. **Instant Display**: Gap levels immediately appear on your chart
3. **Evening Session Ready**: Lines are positioned for 6:00 PM ET session start
4. **Daily Reset**: Old levels are automatically cleared each new trading day
## Perfect For:
- Gap trading strategies
- Overnight futures trading
- ES futures scalping
- Session transition analysis
- Risk management levels
## Usage Tips:
- Best used on 1-15 minute ES futures charts
- Ensure chart timezone shows ET times
- Use manual mode for backtesting specific dates
- Combine with volume and momentum indicators
## Settings Guide:
- **Display Settings**: Control lines, labels, and table visibility
- **Colors**: Customize each gap level color scheme
- **Manual Settings**: Override closing price for testing
- **Debug**: View time detection and diagnostic information
*Designed by traders, for traders. Clean, professional, and reliable gap level detection for serious ES futures trading.*
Trend Trading Indicator with Adjustable MA FilterThis indicator tracks MA buy and sell labels, and has adjustable MA types and lengths along with a trend filter and time This indicator tracks MA buy and sell labels, and has adjustable MA types and lengths along with a trend filter and time filter
Reversal Signal avec TICK + RSIThis indicator is a potential reversal indicator for SCALPING, don't use it for swing. It's base on TICK and on an overbrought/oversold condition of the RSI. You can play with the setting, typicaly I like my TICK to be over reacting an 800/-800 and my rsi over 20 and 80, but it give not enough signal. So I set the TICK signal at 651/-651 and the RSI at 25/75. This indicator is made for SP500 and Nasdaq, so SPY/QQQ/SPX/ES/NQ should work well. It's the first version of it, so maybe I'll add so more data to it to increase signal and lower false one. For now I've test it on live market yet(26/7/25).
The RSI is Fast(5 period), I like to use it on the 1 or 5 min chart.
Please not that it only work during 9h30am to 4pm EST.(Because of the TICK)
Feel free to try and even comment. Don't be harsh on me, it's my first try!
(Sorry for my 'english' it's not my first language)
FAUCON
NY Close High/Low - UAE Time📌 Indicator Name:
New York Session Close High/Low – UAE Time
📄 Description:
This indicator automatically marks the high and low of the New York trading session closing candle, based on UAE local time (Asia/Dubai).
🕒 Time Logic:
The New York session closes at 5:00 PM EST, which corresponds to 1:00 AM UAE time (next day).
The indicator captures the 12:00 AM to 1:00 AM UAE time candle, which represents the final hour of the New York session.
✅ Features:
Marks the high and low of the NY close candle.
Updates dynamically each day.
Lines are plotted using UAE local time (Asia/Dubai).
Works on most timeframes (recommended: 1H or higher).
📈 Use Cases:
Identify key liquidity zones at the NY session close.
Use as support/resistance or breakout reference.
Combine with your existing trading strategy for precision entries.
GLOBEX BOX v1.0All credit to the creator and teacher of this strategy, @RS.
The "GOBEX BOX v1.0" indicator draws customizable horizontal rectangles (with optional midlines and labels) around specific opening candles in the EST timezone ("America/New_York").
It highlights:
The 09:30–09:31 EST 1-minute candle high/low for Monday through Friday.
The 18:00–18:05 EST 5-minute candle high/low for Sunday through Thursday.
Various customizable features are in the indicator settings.
Happy trading!
ORB Range Indicator with Fibonacci Targets
This script plots the Opening Range (ORB) high and low based on a configurable time window (5–45 minutes from the U.S. session open at 9:30 AM EST).
Once the ORB window closes, the indicator draws horizontal lines marking:
ORB High and Low
The size of the range in price and %
Fibonacci-based price targets above and below the range (0.382, 0.618, 1.000, 1.618, 2.000)
You can control:
Which Fibonacci levels to display
Whether to show long targets, short targets, or both
All drawings are automatically cleared at the start of each trading day.
Ideal for breakout traders using ORB and Fibonacci extensions for target planning.
DR V966 - Smart Money Concepts// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
// © DR.BASL
//
//@version=5
indicator("DR V966 - Smart Money Concepts", "DR V966 - Smart Money Concepts ",
overlay = true,
max_bars_back = 5000,
max_boxes_count = 500,
max_labels_count = 500,
max_lines_count = 500,
max_polylines_count = 100)
plot(na)
//
MSG = "MARKET STRUCTURE"
VBG = "VOLUMETRIC ORDER BLOCKS"
MST = "Limit market structure calculation to improve memory speed time"
SLT = " Limit swing structure to tot bars back"
IDT = " Start date of the internal structure"
CST = "Color candle based on trend detection system"
OBT = "Display internal buy and sell activity"
OBD = "Show Last number of orderblock"
OBMT = " Use Length to adjust cordinate of the orderblocks Use whole candle body"
_ ='
------------
–––––––––––––––––––––––––– INPUTS –––––––––––––––––––––––––––
------------ '//{
bool windowsis = input.bool(true, "Window", inline="kla", group=MSG)
int mswindow = input.int(5000, "", tooltip=MST,group=MSG, inline="kla", minval=1000)
bool showSwing = input.bool(true, "Swing", inline="scss", group=MSG)
int swingLimit = input.int(100, "", tooltip=SLT, inline="scss", group=MSG, minval=10, maxval=200)
color swingcssup = input.color(#089981, "", inline="scss", group=MSG)
color swingcssdn = input.color(#f23645, "", inline="scss", group=MSG)
bool showMapping = input.bool(false, "Mapping Structure", inline="mapping", group=MSG)
string mappingStyle = input.string("----", "", options= , inline="mapping", group=MSG)
color mappingcss = input.color(color.silver, "", tooltip="Display Mapping Structure", inline="mapping", group=MSG)
bool candlecss = input.bool(false, "Color Candles", tooltip=CST, group=MSG, inline="txt")
string mstext = input.string("Tiny", "", options= ,
inline="txt", group=MSG)
string msmode = input.string("Adjusted Points", "Algorithmic Logic", options=
, inline="node", group=MSG)
int mslen = input.int(5, "", inline="node", group=MSG, minval=2)
bool buildsweep = input.bool(true, "Build Sweep (x)", "Build sweep on market structure", "znc", MSG)
bool msbubble = input.bool(true, "Bubbles", tooltip="Display Circle Bubbles", inline="bubbles", group=MSG)
bool obshow = input.bool(true, "Show Last", tooltip=OBD, group=VBG, inline="obshow")
int oblast = input.int(5, "", group=VBG, inline="obshow", minval=0)
color obupcs = input.color(color.new(#089981, 90), "", inline="obshow", group=VBG)
color obdncs = input.color(color.new(#f23645, 90), "", inline="obshow", group=VBG)
bool obshowactivity = input.bool(true, "Show Buy/Sell Activity", inline="act", group=VBG, tooltip=OBT)
color obactup = input.color(color.new(#089981, 50), "", inline="act", group=VBG)
color obactdn = input.color(color.new(#f23645, 50), "", inline="act", group=VBG)
obshowbb = input.bool(false, "Show Breakers", inline="bb", group=VBG, tooltip="Display Breakers")
color bbup = input.color(color.new(#089981, 100), "", inline="bb", group=VBG)
color bbdn = input.color(color.new(#f23645, 100), "", inline="bb", group=VBG)
obmode = input.string("Length", "Construction", options= , tooltip=OBMT, inline="atr", group=VBG)
len = input.int(5, "", inline="atr", group=VBG, minval=1)
obmiti = input.string("Close", "Mitigation Method", options= ,
tooltip="Mitigation method for when to trigger order blocks", group=VBG)
obtxt = input.string("Normal", "Metric Size", options= ,
tooltip="Order block Metrics text size", inline="txt", group=VBG)
showmetric = input.bool(true, "Show Metrics", group=VBG)
showline = input.bool(true, "Show Mid-Line", group=VBG)
overlap = input.bool(true, "Hide Overlap", group=VBG, inline="ov")
wichlap = input.string("Recent", "", options= , inline="ov", group=VBG)
fvg_enable = input.bool(false, "", inline="1", group="FAIR VALUE GAP", tooltip="Display fair value gap")
what_fvg = input.string("FVG", "", inline="1", group="FAIR VALUE GAP", tooltip="Display fair value gap",
options= )
fvg_num = input.int(5, "Show Last", inline="1a", group="FAIR VALUE GAP", tooltip="Number of fvg to show", minval=0)
fvg_upcss = input.color(color.new(#089981, 80), "", inline="1", group="FAIR VALUE GAP")
fvg_dncss = input.color(color.new(#f23645, 80), "", inline="1", group="FAIR VALUE GAP")
fvgbbup = input.color(color.new(#089981, 100), "", inline="1", group="FAIR VALUE GAP")
fvgbbdn = input.color(color.new(#f23645, 100), "", inline="1", group="FAIR VALUE GAP")
fvg_src = input.string("Close", "Mitigation",
inline="3",
group="FAIR VALUE GAP",
tooltip=" Use the close of the body as trigger Use the extreme point of the body as trigger",
options= )
fvgthresh = input.float(0, "Threshold", tooltip="Filter out non significative FVG", group="FAIR VALUE GAP",
inline="asd", minval=0, maxval=2, step=0.1)
fvgoverlap = input.bool(true, "Hide Overlap", "Hide overlapping FVG", group="FAIR VALUE GAP")
fvgline = input.bool(true, "Show Mid-Line", group="FAIR VALUE GAP")
fvgextend = input.bool(false, "Extend FVG", group="FAIR VALUE GAP")
dispraid = input.bool(false, "Display Raids", inline="raid", group="FAIR VALUE GAP")
// إعدادات تفعيل/تعطيل وتخصيص لكل مستوى فيبوناتشي
show_fib_0 = input.bool(true, "إظهار 0.0" , group="Fibonacci")
show_fib_236 = input.bool(true, "إظهار 0.236" , group="Fibonacci")
show_fib_382 = input.bool(true, "إظهار 0.382" , group="Fibonacci")
show_fib_5 = input.bool(true, "إظهار 0.5" , group="Fibonacci")
show_fib_618 = input.bool(true, "إظهار 0.618" , group="Fibonacci")
show_fib_786 = input.bool(true, "إظهار 0.786" , group="Fibonacci")
show_fib_1 = input.bool(true, "إظهار 1.0" , group="Fibonacci")
show_fib_1272 = input.bool(true, "إظهار 1.272" , group="Fibonacci")
show_fib_1618 = input.bool(true, "إظهار 1.618" , group="Fibonacci")
show_fib_180 = input.bool(true, "إظهار 1.80" , group="Fibonacci")
show_fib_2 = input.bool(true, "إظهار 2.0" , group="Fibonacci")
show_fib_2272 = input.bool(true, "إظهار 2.272" , group="Fibonacci")
show_fib_2618 = input.bool(true, "إظهار 2.618" , group="Fibonacci")
fib_color_0 = input.color(color.white, "لون 0.0" , group="Fibonacci")
fib_color_236 = input.color(color.white, "لون 0.236" , group="Fibonacci")
fib_color_382 = input.color(color.white, "لون 0.382" , group="Fibonacci")
fib_color_5 = input.color(color.white, "لون 0.5" , group="Fibonacci")
fib_color_618 = input.color(color.white, "لون 0.618" , group="Fibonacci")
fib_color_786 = input.color(color.white, "لون 0.786" , group="Fibonacci")
fib_color_1 = input.color(color.white, "لون 1.0" , group="Fibonacci")
fib_color_1272 = input.color(color.white, "لون 1.272" , group="Fibonacci")
fib_color_1618 = input.color(color.white, "لون 1.618" , group="Fibonacci")
fib_color_180 = input.color(color.white, "لون 1.80" , group="Fibonacci")
fib_color_2 = input.color(color.white, "لون 2.0" , group="Fibonacci")
fib_color_2272 = input.color(color.white, "لون 2.272" , group="Fibonacci")
fib_color_2618 = input.color(color.white, "لون 2.618" , group="Fibonacci")
fib_size = input.string("normal", "حجم الخط", options= , group="Fibonacci")
fib_shift = input.int(0, "تحريك خطوط الفيبوناتشي إلى اليمين", minval=0, maxval=100, group="Fibonacci")
//}
_ ='
------------
–––––––––––––––––––––––––– UDT –––––––––––––––––––––––––––
------------ '//{
type hqlzone
box pbx
box ebx
box lbx
label plb
label elb
label lbl
type Zphl
line top
line bottom
label top_label
label bottom_label
bool stopcross
bool sbottomcross
bool itopcross
bool ibottomcross
string txtup
string txtdn
float topy
float bottomy
float topx
float bottomx
float tup
float tdn
int tupx
int tdnx
float itopy
float itopx
float ibottomy
float ibottomx
float uV
float dV
type entered
bool normal = false
bool breaker = false
type store
line ln
label lb
box bx
linefill lf
type structure
int zn
float zz
float bos
float choch
int loc
int temp
int trend
int start
float main
int xloc
bool upsweep
bool dnsweep
string txt = na
type drawms
int x1
int x2
float y
string txt
color css
string style
type ob
bool bull
float top
float btm
float avg
int loc
color css
float vol
int dir
int move
int blPOS
int brPOS
int xlocbl
int xlocbr
bool isbb = false
int bbloc
type FVG
float top = na
float btm = na
int loc = bar_index
bool isbb = false
int bbloc = na
bool israid = false
float raidy = na
int raidloc = na
int raidx2 = na
bool active = false
color raidcs = na
type SFP
float y
int loc
float ancor
type sfpbuildlbl
int x
float y
string style
color css
string txt
type sfpbuildline
int x1
int x2
float y
color css
float ancor
int loc
type equalbuild
int x1
float y1
int x2
float y2
color css
string style
type equalname
int x
float y
string txt
color css
string style
type ehl
float pt
int t
float pb
int b
type sellbuyside
float top
float btm
int loc
color css
string txt
float vol
type timer
bool start = false
int count = 0
//}
_ ='
------------
–––––––––––––––––––––––––– SETUP –––––––––––––––––––––––––––
------------ '//{
var store bin = store.new(
array.new< line >()
, array.new< label >()
, array.new< box >()
, array.new()
)
var entered blobenter = entered.new()
var entered brobenter = entered.new()
var entered blfvgenter = entered.new()
var entered brfvgenter = entered.new()
var entered blarea = entered.new()
var entered brarea = entered.new()
var timer lc = timer.new ()
if barstate.islast
for obj in bin.ln
obj.delete()
for obj in bin.lb
obj.delete()
for obj in bin.bx
obj.delete()
for obj in bin.lf
obj.delete()
bin.ln.clear()
bin.lb.clear()
bin.bx.clear()
bin.lf.clear()
invcol = #ffffff00
float atr = (ta.atr(200) / (5/len))
//}
_ ='
------------
–––––––––––––––––––––––––– UTILITY –––––––––––––––––––––––––––
------------ '//{
method txSz(string s) =>
out = switch s
"Tiny" => size.tiny
"Small" => size.small
"Normal" => size.normal
"Large" => size.large
"Huge" => size.huge
"Auto" => size.auto
out
method lstyle(string style) =>
out = switch style
'⎯⎯⎯⎯' => line.style_solid
'----' => line.style_dashed
'····' => line.style_dotted
ghl() => [high , low , close , open , close, open, high, low, high , low , ta.atr(200)]
method IDMIDX(bool use_max, int loc) =>
min = 99999999.
max = 0.
idx = 0
if use_max
for i = 0 to (bar_index - loc)
max := math.max(high , max)
min := max == high ? low : min
idx := max == high ? i : idx
else
for i = 0 to (bar_index - loc)
min := math.min(low , min)
max := min == low ? high : max
idx := min == low ? i : idx
idx
SFPData() => [high, high , high , low, low , low , close, volume, time, bar_index , time ]
SFPcords() =>
RealTF = barstate.isrealtime ? 0 : 1
= SFPData()
[h , h1 , h2 , l , l1 , l2 , c , v , t , n , t1 ]
method find(structure ms, bool use_max, bool sweep, bool useob) =>
min = 99999999.
max = 0.
idx = 0
if not sweep
if ((bar_index - ms.loc) - 1) > 0
if use_max
for i = 0 to (bar_index - ms.loc) - 1
max := math.max(high , max)
min := max == high ? low : min
idx := max == high ? i : idx
if useob
if high > high
max := high
min := low
idx := idx + 1
else
for i = 0 to (bar_index - ms.loc) - 1
min := math.min(low , min)
max := min == low ? high : max
idx := min == low ? i : idx
if useob
if low < low
max := high
min := low
idx := idx + 1
else
if use_max
for i = 0 to (bar_index - ms.loc)
max := math.max(high , max)
min := max == high ? low : min
idx := max == high ? i : idx
if useob
if high > high
max := high
min := low
idx := idx + 1
else
for i = 0 to (bar_index - ms.loc)
min := math.min(low , min)
max := min == low ? high : max
idx := min == low ? i : idx
if useob
if low < low
max := high
min := low
idx := idx + 1
else
if ((bar_index - ms.xloc) - 1) > 0
if use_max
for i = 0 to (bar_index - ms.xloc) - 1
max := math.max(high , max)
min := max == high ? low : min
idx := max == high ? i : idx
if useob
if high > high
max := high
min := low
idx := idx + 1
else
for i = 0 to (bar_index - ms.xloc) - 1
min := math.min(low , min)
max := min == low ? high : max
idx := min == low ? i : idx
if useob
if low < low
max := high
min := low
idx := idx + 1
else
if use_max
for i = 0 to (bar_index - ms.xloc)
max := math.max(high , max)
min := max == high ? low : min
idx := max == high ? i : idx
if useob
if high > high
max := high
min := low
idx := idx + 1
else
for i = 0 to (bar_index - ms.xloc)
min := math.min(low , min)
max := min == low ? high : max
idx := min == low ? i : idx
if useob
if low < low
max := high
min := low
idx := idx + 1
idx
method fnOB(ob block, bool bull, float cords, int idx) =>
switch bull
true =>
blobenter.normal := false
blobenter.breaker := false
block.unshift(
ob.new(
true
, cords
, low
, math.avg(cords, low )
, time
, obupcs
, volume
, close > open ? 1 : -1
, 1
, 1
, 1
, time
)
)
false =>
brobenter.normal := false
brobenter.breaker := false
block.unshift(
ob.new(
false
, high
, cords
, math.avg(cords, high )
, time
, obdncs
, volume
, close > open ? 1 : -1
, 1
, 1
, 1
, time
)
)
method mitigated(ob block) =>
if barstate.isconfirmed
for in block
if not stuff.isbb
switch stuff.bull
true =>
if obmiti == "Close" ? math.min(close, open) < stuff.btm : obmiti == "Wick" ? low < stuff.btm : obmiti == "Avg" ? low < stuff.avg : na
stuff.isbb := true
stuff.bbloc := time
if not obshowbb
block.remove(i)
false =>
if obmiti == "Close" ? math.max(close, open) > stuff.top : obmiti == "Wick" ? high > stuff.top : obmiti == "Avg" ? high > stuff.avg : na
stuff.isbb := true
stuff.bbloc := time
if not obshowbb
block.remove(i)
else
switch stuff.bull
true =>
if obmiti == "Close" ? math.max(close, open) > stuff.top : obmiti == "Wick" ? high > stuff.top : obmiti == "Avg" ? high > stuff.avg : na
block.remove(i)
false =>
if obmiti == "Close" ? math.min(close, open) < stuff.btm : obmiti == "Wick" ? low < stuff.btm : obmiti == "Avg" ? low < stuff.avg : na
block.remove(i)
overlap(ob bull, ob bear) =>
if bull.size() > 1
for i = bull.size() - 1 to 1
stuff = bull.get(i)
current = bull.get(0)
v = wichlap == "Recent" ? i : 0
switch
stuff.btm > current.btm and stuff.btm < current.top => bull.remove(v)
stuff.top < current.top and stuff.btm > current.btm => bull.remove(v)
stuff.top > current.top and stuff.btm < current.btm => bull.remove(v)
stuff.top < current.top and stuff.top > current.btm => bull.remove(v)
if bear.size() > 1
for i = bear.size() - 1 to 1
stuff = bear.get(i)
current = bear.get(0)
v = wichlap == "Recent" ? i : 0
switch
stuff.btm > current.btm and stuff.btm < current.top => bear.remove(v)
stuff.top < current.top and stuff.btm > current.btm => bear.remove(v)
stuff.top > current.top and stuff.btm < current.btm => bear.remove(v)
stuff.top < current.top and stuff.top > current.btm => bear.remove(v)
if bull.size() > 0 and bear.size() > 0
for i = bull.size() - 1 to 0
stuff = bull.get(i)
current = bear.get(0)
v = wichlap == "Recent" ? 0 : i
switch
stuff.btm > current.btm and stuff.btm < current.top => bull.remove(v)
stuff.top < current.top and stuff.btm > current.btm => bull.remove(v)
stuff.top > current.top and stuff.btm < current.btm => bull.remove(v)
stuff.top < current.top and stuff.top > current.btm => bull.remove(v)
if bull.size() > 0 and bear.size() > 0
for i = bear.size() - 1 to 0
stuff = bear.get(i)
current = bull.get(0)
v = wichlap == "Recent" ? 0 : i
switch
stuff.btm > current.btm and stuff.btm < current.top => bear.remove(v)
stuff.top < current.top and stuff.btm > current.btm => bear.remove(v)
stuff.top > current.top and stuff.btm < current.btm => bear.remove(v)
stuff.top < current.top and stuff.top > current.btm => bear.remove(v)
overlapFVG(FVG blFVG, FVG brFVG) =>
if blFVG.size() > 1
for i = blFVG.size() - 1 to 1
stuff = blFVG.get(i)
current = blFVG.get(0)
switch
stuff.btm > current.btm and stuff.btm < current.top => blFVG.remove(i)
stuff.top < current.top and stuff.btm > current.btm => blFVG.remove(i)
stuff.top > current.top and stuff.btm < current.btm => blFVG.remove(i)
stuff.top < current.top and stuff.top > current.btm => blFVG.remove(i)
if brFVG.size() > 1
for i = brFVG.size() - 1 to 1
stuff = brFVG.get(i)
current = brFVG.get(0)
switch
stuff.btm > current.btm and stuff.btm < current.top => brFVG.remove(i)
stuff.top < current.top and stuff.btm > current.btm => brFVG.remove(i)
stuff.top > current.top and stuff.btm < current.btm => brFVG.remove(i)
stuff.top < current.top and stuff.top > current.btm => brFVG.remove(i)
if blFVG.size() > 0 and brFVG.size() > 0
for i = blFVG.size() - 1 to 0
stuff = blFVG.get(i)
current = brFVG.get(0)
switch
stuff.btm > current.btm and stuff.btm < current.top => blFVG.remove(i)
stuff.top < current.top and stuff.btm > current.btm => blFVG.remove(i)
stuff.top > current.top and stuff.btm < current.btm => blFVG.remove(i)
stuff.top < current.top and stuff.top > current.btm => blFVG.remove(i)
if blFVG.size() > 0 and brFVG.size() > 0
for i = brFVG.size() - 1 to 0
stuff = brFVG.get(i)
current = blFVG.get(0)
switch
stuff.btm > current.btm and stuff.btm < current.top => brFVG.remove(i)
stuff.top < current.top and stuff.btm > current.btm => brFVG.remove(i)
stuff.top > current.top and stuff.btm < current.btm => brFVG.remove(i)
stuff.top < current.top and stuff.top > current.btm => brFVG.remove(i)
method umt(ob metric) =>
switch metric.dir
1 =>
switch metric.move
1 => metric.blPOS := metric.blPOS + 1, metric.move := 2
2 => metric.blPOS := metric.blPOS + 1, metric.move := 3
3 => metric.brPOS := metric.brPOS + 1, metric.move := 1
-1 =>
switch metric.move
1 => metric.brPOS := metric.brPOS + 1, metric.move := 2
2 => metric.brPOS := metric.brPOS + 1, metric.move := 3
3 => metric.blPOS := metric.blPOS + 1, metric.move := 1
if (time - time ) == (time - time )
metric.xlocbl := metric.loc + (time - time ) * metric.blPOS
metric.xlocbr := metric.loc + (time - time ) * metric.brPOS
method display(ob id, ob full, int i) =>
if not id.isbb
bin.bx.unshift(box.new (top = id.top, bottom = id.btm, left = id.loc, right = time , border_color = na , bgcolor = id.css, xloc = xloc.bar_time))
bin.bx.unshift(box.new (top = id.top, bottom = id.btm, left = time , right = time + 1 , border_color = na , bgcolor = id.css, xloc = xloc.bar_time, extend = extend.right))
else
bin.bx.unshift(box.new (top = id.top, bottom = id.btm, left = id.loc , right = id.bbloc , border_color = na , bgcolor = id.css , xloc = xloc.bar_time))
bin.bx.unshift(box.new (top = id.top, bottom = id.btm, left = id.bbloc , right = time , border_color = id.css , bgcolor = id.bull ? bbup : bbdn , xloc = xloc.bar_time, border_width = 2))
bin.bx.unshift(box.new (top = id.top, bottom = id.btm, left = time , right = time + 1 , border_color = id.css , bgcolor = id.bull ? bbup : bbdn , xloc = xloc.bar_time, extend = extend.right))
if obshowactivity
bin.bx.unshift(box.new (top = id.top, bottom = id.avg, left = id.loc , right = id.xlocbl, border_color = na , bgcolor = obactup, xloc = xloc.bar_time))
bin.bx.unshift(box.new (top = id.avg, bottom = id.btm, left = id.loc , right = id.xlocbr, border_color = na , bgcolor = obactdn, xloc = xloc.bar_time))
if showline
bin.ln.unshift(line.new(
x1 = id.loc
, x2 = time
, y1 = id.avg
, y2 = id.avg
, color = color.new(id.css, 0)
, xloc = xloc.bar_time
, style = line.style_dashed
)
)
if showmetric
if i == math.min(oblast - 1, full.size() - 1)
float tV = 0
float dV = array.new()
seq = math.min(oblast - 1, full.size() - 1)
for j = 0 to seq
cV = full.get(j)
tV += cV.vol
if j == seq
for y = 0 to seq
dV.push(
math.floor(
(full.get(y).vol / tV) * 100)
)
ids = full.get(y)
bin.lb.unshift(label.new(
bar_index - 1
, ids.avg
, textcolor = color.new(ids.css, 0)
, style = label.style_label_left
, size = obtxt.txSz()
, color = #ffffff00
, text =
str.tostring(
math.round(full.get(y).vol, 3), format = format.volume) + " (" + str.tostring(dV.get(y)) + "%)"
)
)
method dispFVG(FVG fvg, int i, bool bull) =>
ext = fvgextend ? extend.right : extend.none
if not fvg.isbb
bin.bx.unshift(box .new(top = fvg.top, bottom = fvg.btm, left = fvg.loc , right = time , border_color = na , bgcolor = bull ? fvg_upcss : fvg_dncss , xloc = xloc.bar_time, extend = ext))
if fvgline
bin.ln.unshift(line.new(x1 = fvg.loc, x2 = time , y1 = math.avg(fvg.top, fvg.btm), y2 = math.avg(fvg.top, fvg.btm), xloc = xloc.bar_time, color = color.new(bull ? fvg_upcss : fvg_dncss, 0) , extend = ext))
if dispraid
bin.ln.unshift(line.new(x1 = fvg.raidloc, x2 = fvg.raidx2, y1 = fvg.raidy, y2 = fvg.raidy, xloc = xloc.bar_time, color = fvg.raidcs))
bin.lb.unshift(label.new(x = int(math.avg(fvg.raidloc, fvg.raidx2)), y = fvg.raidy, text = "x", xloc = xloc.bar_time, textcolor = fvg.raidcs, style = bull ? label.style_label_up : label.style_label_down, size = size.small, color = #ffffff00))
else
bin.bx.unshift(box .new(top = fvg.top , bottom = fvg.btm, left = fvg.loc , right = fvg.bbloc , border_color = na , bgcolor = bull ? fvg_upcss : fvg_dncss, xloc = xloc.bar_time))
bin.bx.unshift(box .new(top = fvg.top , bottom = fvg.btm, left = fvg.bbloc , right = time , border_color = bull ? fvg_dncss : fvg_upcss , bgcolor = bull ? fvg_dncss : fvg_upcss, xloc = xloc.bar_time, extend = ext))
if fvgline
bin.ln.unshift(line.new(x1 = fvg.loc , x2 = fvg.bbloc , y1 = math.avg(fvg.top, fvg.btm), y2 = math.avg(fvg.top, fvg.btm), color = color.new(bull ? fvg_upcss : fvg_dncss, 0) , xloc = xloc.bar_time))
bin.ln.unshift(line.new(x1 = fvg.bbloc, x2 = time , y1 = math.avg(fvg.top, fvg.btm), y2 = math.avg(fvg.top, fvg.btm), color = color.new(bull ? fvg_dncss : fvg_upcss, 0) , xloc = xloc.bar_time, extend = ext, style = line.style_dashed))
//}
_ ='
------------
–––––––––––––––––––––––––– FUNCTION –––––––––––––––––––––––––––
------------ '//{
mapping() =>
var float up = na
var float dn = na
var float point = na
var int trend = 0
var int idx = na
var int sum = na
var int project = na
var chart.point charts = array.new()
if na(up)
up := high
idx := bar_index
if na(dn)
dn := low
idx := bar_index
if high > up
if trend == -1
id = IDMIDX(false, idx)
charts.unshift(
chart.point.from_time(
time
, low
)
)
idx := bar_index
point := low
sum := time
up := high
dn := low
project := time
trend := 1
if low < dn
if trend == 1
id = IDMIDX(true, idx)
charts.unshift(
chart.point.from_time(
time
, high
)
)
idx := bar_index
point := high
sum := time
up := high
dn := low
project := time
trend := -1
if barstate.islast
var line ln = na
var polyline pl = na
ln.delete()
pl.delete()
ln := na
pl := na
ln := line.new(
x1 = sum
, x2 = project
, y1 = point
, y2 = trend == 1 ? up : dn
, xloc = xloc.bar_time
, color = color.red
)
pl := polyline.new(
charts
, line_color = mappingcss
, xloc = xloc.bar_time
, line_style = mappingStyle.lstyle()
)
dFVG() =>
= ghl()
var FVG blFVG = array.new()
var FVG brFVG = array.new()
bool upfvg = false
bool dnfvg = false
float blth = l1 + (fvatr * fvgthresh)
float brth = h1 - (fvatr * fvgthresh)
cc = timeframe.change()
switch
what_fvg == "FVG" or what_fvg == "Breakers" =>
if l > h2 and cc and c1 > blth
upfvg := true
if l2 > h and cc and c1 < brth
dnfvg := true
if upfvg
if blFVG.size() > 0
fvg = blFVG.get(0)
if fvg.israid == true and fvg.active == false
fvg.active := true
fvg.raidloc := na
fvg.raidx2 := na
fvg.raidy := na
fvg.raidcs := #ffffff00
blFVG.unshift(
FVG.new(
l
, h2
, time
, false
, na
)
)
if dnfvg
if brFVG.size() > 0
fvg = brFVG.get(0)
if fvg.israid == true and fvg.active == false
fvg = brFVG.get(0)
fvg.active := true
fvg.active := true
fvg.raidloc := na
fvg.raidx2 := na
fvg.raidy := na
fvg.raidcs := #ffffff00
brFVG.unshift(
FVG.new(
l2
, h
, time
, false
, na
)
)
if blFVG.size() > 0
for in blFVG
if not fvg.isbb
if fvg_src == "Close" ? math.min(c, o) < fvg.btm : fvg_src == "Wick" ? l < fvg.btm : fvg_src == "Avg" ? l < math.avg(fvg.top, fvg.btm) : na
fvg.isbb := true
fvg.bbloc := time
if what_fvg == "FVG"
blFVG.remove(i)
else
if (fvg_src == "Close" ? math.max(c, o) > fvg.top : fvg_src == "Wick" ? h > fvg.top : fvg_src == "Avg" ? h > math.avg(fvg.top, fvg.btm) : na) and what_fvg == "Breakers"
blFVG.remove(i)
if brFVG.size() > 0
for in brFVG
if not fvg.isbb
if (fvg_src == "Close" ? math.max(c, o) > fvg.top : fvg_src == "Wick" ? h > fvg.top : fvg_src == "Avg" ? h > math.avg(fvg.top, fvg.btm) : na)
fvg.isbb := true
fvg.bbloc := time
if what_fvg == "FVG"
brFVG.remove(i)
else
if (fvg_src == "Close" ? math.min(c, o) < fvg.btm : fvg_src == "Wick" ? l < fvg.btm : fvg_src == "Avg" ? l < math.avg(fvg.top, fvg.btm) : na) and what_fvg == "Breakers"
brFVG.remove(i)
if fvgoverlap
overlapFVG(blFVG, brFVG)
if dispraid
for in blFVG
if not fvg.israid and not fvg.isbb
if low < fvg.top and close > fvg.top
fvg.israid := true
fvg.raidloc := time
fvg.raidx2 := time
fvg.raidy := low
fvg.raidcs := chart.fg_color
else
if low <= fvg.raidy and fvg.active == false and not fvg.isbb
fvg.active := true
fvg.raidx2 := time
else
if fvg.active == false and not fvg.isbb
fvg.raidx2 := time
for in brFVG
if not fvg.israid and not fvg.isbb
if high > fvg.btm and close < fvg.btm and not fvg.isbb
fvg.israid := true
fvg.raidloc := time
fvg.raidy := high
fvg.raidx2 := time
fvg.raidcs := chart.fg_color
else
if high >= fvg.raidy and fvg.active == false and not fvg.isbb
fvg.active := true
fvg.raidx2 := time
else
if fvg.active == false and not fvg.isbb
fvg.raidx2 := time
if barstate.islast
if blFVG.size() > 0 and fvg_num > 0
for i = 0 to math.min(fvg_num - 1, blFVG.size() - 1)
fvg = blFVG.get(i)
dispFVG(fvg, i, true)
if brFVG.size() > 0 and fvg_num > 0
for i = 0 to math.min(fvg_num - 1, brFVG.size() - 1)
fvg = brFVG.get(i)
dispFVG(fvg, i, false)
structure(color upcss, color dncss, bool draw, bool internal, int limit) =>
var structure ms = structure.new(start = 0)
var ob blob = array.new< ob >()
var ob brob = array.new< ob >()
var drawms bldw = array.new< drawms >()
var drawms brdw = array.new< drawms >()
var sellbuyside sellside = array.new()
var sellbuyside buyside = array.new()
bool crossup = false
bool crossdn = false
var float up = na
var float dn = na
idbull = ms.find(false, false, true)
idbear = ms.find(true , false, true)
btmP = obmode == "Length" ? (high - 1 * atr ) < low ? low : (high - 1 * atr ) : low
topP = obmode == "Length" ? (low + 1 * atr ) > high ? high : (low + 1 * atr ) : high
atr = ta.atr (200)
buy = low + atr
sel = high - atr
ph = ta.pivothigh(high, mslen, mslen)
pl = ta.pivotlow (low , mslen, mslen)
var int phn = array.new< int >(1, na)
var int pln = array.new< int >(1, na)
var float php = array.new(1, na)
var float plp = array.new(1, na)
if internal
blob.clear()
brob.clear()
if ph
phn.unshift(bar_index )
php.unshift(high )
if pl
pln.unshift(bar_index )
plp.unshift(low )
if php.size() > 0
if high > php.get(0)
php.clear()
phn.clear()
if plp.size() > 0
if low < plp.get(0)
plp.clear()
pln.clear()
if na(up)
up := high
if na(dn)
dn := low
if high > up
up := high
dn := low
crossup := true
if low < dn
up := high
dn := low
crossdn := true
if ms.start == 0
ms := structure.new(bar_index, na, high, low , bar_index, bar_index, 0, 1, na, bar_index)
if draw
bldw.unshift(drawms.new(time, time, high , "CHoCH" , upcss, line.style_dashed))
brdw.unshift(drawms.new(time, time, low , "CHoCH" , dncss, line.style_dashed))
ms.upsweep := false
ms.dnsweep := false
if ms.start == 1
switch
low <= ms.choch and close >= ms.choch and buildsweep =>
ms.dnsweep := true
ms.choch := low
ms.xloc := bar_index
if draw
dw = brdw.get(0)
dw.x2 := time
dw.style := line.style_dotted
dw.txt := "x"
brdw.unshift(
drawms.new(
time
, time
, low
, "CHoCH"
, dncss
, line.style_dashed
)
)
high >= ms.bos and close <= ms.bos and buildsweep =>
ms.upsweep := true
ms.bos := high
ms.xloc := bar_index
if draw
dw = bldw.get(0)
dw.x2 := time
dw.style := line.style_dotted
dw.txt := "x"
bldw.unshift(
drawms.new(
time
, time
, high
, "CHoCH"
, upcss
, line.style_dashed
)
)
close <= ms.choch =>
ms.txt := "choch"
lc.start := true
lc.count := 0
blob.fnOB(true, topP, idbull)
ms.trend := -1
ms.choch := ms.bos
ms.bos := na
ms.start := 2
ms.loc := bar_index
ms.main := low
ms.temp := ms.loc
ms.xloc := bar_index
if draw
dw = brdw.get(0)
dw.x2 := time
dw.style := internal ? line.style_dashed : line.style_solid
close >= ms.bos =>
ms.txt := "choch"
lc.start := true
lc.count := 0
brob.fnOB(false, btmP, idbear)
ms.trend := 1
ms.choch := ms.choch
ms.bos := na
ms.start := 2
ms.loc := bar_index
ms.main := high
ms.temp := ms.loc
ms.xloc := bar_index
if draw
dw = bldw.get(0)
dw.x2 := time
dw.style := internal ? line.style_dashed : line.style_solid
if ms.start == 2
switch ms.trend
-1 =>
if low <= ms.main
ms.main := low
ms.temp := bar_index
if bar_index % mslen * 2 == 0
if not na(ms.bos) and msmode == "Adjusted Points" and php.size() > 0
if php.get(0) < ms.choch
// ms.xloc := phn.get(0)
ms.choch := php.get(0)
ms.loc := phn.get(0)
ms.xloc := phn.get(0)
ms.temp := phn.get(0)
if draw
choch = bldw.get(0)
choch.x1 := time
choch.x2 := time
choch.y := php.get(0)
if na(ms.bos)
if crossup and close > open and close > open
ms.bos := ms.main
ms.loc := ms.temp
ms.xloc := ms.loc
if draw
brdw.unshift(
drawms.new(
time
, time
, low
, "BOS"
, dncss
, line.style_dashed
)
)
if not na(ms.bos) and draw
dw = brdw.get(0)
dw.x2 := time
if draw
choch = bldw.get(0)
choch.x2 := time
switch
low <= ms.bos and close >= ms.bos and not na(ms.bos) and buildsweep =>
ms.dnsweep := true
ms.bos := low
if draw
dw = brdw.get(0)
dw.x2 := time
dw.style := line.style_dotted
dw.txt := "x"
brdw.unshift(
drawms.new(
time
, time
, low
, "BOS"
, dncss
, line.style_dashed
)
)
ms.xloc := bar_index
close <= ms.bos and not na(ms.bos) =>
ms.txt := "bos"
ms.zz := ms.bos
ms.zn := bar_index
lc.start := true
lc.count := 0
brob.fnOB(false, btmP, idbear)
id = ms.find(true, false, false)
ms.xloc := bar_index
ms.bos := na
ms.choch := high
ms.loc := bar_index
if draw
dw = brdw.get(0)
dw.x2 := time
dw.style := internal ? line.style_dashed : line.style_solid
choch = bldw.get(0)
choch.x1 := time
choch.x2 := time
choch.y := high
switch
high >= ms.choch and close <= ms.choch and buildsweep =>
ms.upsweep := true
ms.choch := high
ms.xloc := bar_index
if draw
dw = bldw.get(0)
dw.x2 := time
dw.style := line.style_dotted
dw.txt := "x"
bldw.unshift(
drawms.new(
time
, time
, high
, "CHoCH"
, upcss
, line.style_dashed
)
)
close >= ms.choch =>
ms.txt := "choch"
ms.zz := ms.choch
ms.zn := bar_index
lc.start := true
lc.count := 0
blob.fnOB(true, topP, idbull)
id = ms.find(false, false, false)
switch
na(ms.bos) =>
ms.choch := low
if draw
brdw.unshift(
drawms.new(
time
, time
, low
, "BOS"
, dncss
, line.style_dashed
)
)
choch = brdw.get(0)
choch.x1 := time
=> ms.choch := ms.bos//low < low ? low : low
ms.bos := na
ms.main := high
ms.trend := 1
ms.loc := bar_index
ms.xloc := bar_index
ms.temp := ms.loc
if draw
dw = bldw.get(0)
dw.x2 := time
dw.txt := "CHoCH"
dw.style := internal ? line.style_dashed : line.style_solid
choch = brdw.get(0)
choch.x2 := time
choch.y := ms.choch
choch.txt := "CHoCH"
ms.xloc := bar_index
blarea.normal := false
1 =>
if high >= ms.main
ms.main := high
ms.temp := bar_index
if na(ms.bos)
if crossdn and close < open and close < open
ms.bos := ms.main
ms.loc := ms.temp
ms.xloc := ms.loc
if draw
bldw.unshift(
drawms.new(
time
, time
, high
, "BOS"
, upcss
, line.style_dashed
)
)
if bar_index % mslen * 2 == 0
if not na(ms.bos) and msmode == "Adjusted Points" and plp.size() > 0
if plp.get(0) > ms.choch
// ms.xloc := pln.get(0)
ms.choch := plp.get(0)
ms.loc := pln.get(0)
ms.xloc := pln.get(0)
ms.temp := pln.get(0)
// ms.loc := pln.get(0)
if draw
choch = brdw.get(0)
choch.x1 := time
choch.x2 := time
choch.y := plp.get(0)
if not na(ms.bos) and draw
dw = bldw.get(0)
dw.x2 := time
if draw
choch = brdw.get(0)
choch.x2 := time
switch
high >= ms.bos and close <= ms.bos and not na(ms.bos) and buildsweep =>
ms.upsweep := true
ms.bos := high
if draw
dw = bldw.get(0)
dw.x2 := time
dw.style := line.style_dotted
dw.txt := "x"
bldw.unshift(
drawms.new(
time
, time
, high
, "BOS"
, upcss
, line.style_dashed
)
)
ms.xloc := bar_index
close >= ms.bos and not na(ms.bos) =>
ms.txt := "bos"
ms.zz := ms.bos
ms.zn := bar_index
lc.start := true
lc.count := 0
blob.fnOB(true, topP, idbull)
id = ms.find(false, false, false)
ms.xloc := bar_index
ms.bos := na
ms.choch := low
ms.loc := bar_index
if draw
dw = bldw.get(0)
dw.x2 := time
dw.style := internal ? line.style_dashed : line.style_solid
choch = brdw.get(0)
choch.x1 := time
choch.x2 := time
choch.y := low
switch
low <= ms.choch and close >= ms.choch and buildsweep =>
ms.dnsweep := true
ms.choch := low
ms.xloc := bar_index
if draw
dw = brdw.get(0)
dw.x2 := time
dw.style := line.style_dotted
dw.txt := "x"
brdw.unshift(
drawms.new(
time
, time
, low
, "CHoCH"
, dncss
, line.style_dashed
)
)
close <= ms.choch =>
ms.txt := "choch"
ms.zz := ms.choch
ms.zn := bar_index
lc.start := true
lc.count := 0
brob.fnOB(false, btmP, idbear)
id = ms.find(true, false, false)
switch
na(ms.bos) =>
ms.choch := high
if draw
bldw.unshift(
drawms.new(
time
, time
, high
, "BOS"
, upcss
, line.style_dashed
)
)
choch = bldw.get(0)
choch.x1 := time
=> ms.choch := ms.bos//high > high ? high : high
ms.bos := na
ms.main := low
ms.trend := -1
ms.loc := bar_index
ms.temp := ms.loc
if draw
dw = brdw.get(0)
dw.x2 := time
dw.txt := "CHoCH"
dw.style := internal ? line.style_dashed : line.style_solid
choch = bldw.get(0)
choch.y := ms.choch
choch.x2 := time
choch.txt := "CHoCH"
ms.xloc := bar_index
if blob.size() > 0
ob = blob.get(0)
if not ob.isbb
if low < ob.top
if blobenter.normal == false
blobenter.normal := true
else
if high > ob.btm
if blobenter.breaker == false
blobenter.breaker := true
if brob.size() > 0
ob = brob.get(0)
if not ob.isbb
if high > ob.btm
if brobenter.normal == false
brobenter.normal := true
else
if low < ob.top
if brobenter.breaker == false
brobenter.breaker := true
if obshow and oblast > 0
if barstate.isconfirmed
blob.mitigated()
brob.mitigated()
if overlap
overlap(blob, brob)
if blob.size() > 0
for in blob
metric.umt()
if brob.size() > 0
for in brob
metric.umt()
if barstate.islast
if blob.size() > 0
for i = 0 to math.min(oblast - 1, blob.size() - 1)
obs = blob.get(i)
display(obs, blob, i)
if brob.size() > 0
for i = 0 to math.min(oblast - 1, brob.size() - 1)
obs = brob.get(i)
display(obs, brob, i)
if barstate.islast and draw and bldw.size() > 0 and brdw.size() > 0
for i = 0 to bldw.size() - 1
obj = bldw.get(i)
if i <= limit
bin.ln.unshift(
line.new(
x1 = obj.x1
, x2 = obj.x2
, y1 = obj.y
, y2 = obj.y
, color = obj.css
, style = obj.style
, xloc = xloc.bar_time
)
)
bin.lb.unshift(
label.new(
x = int(math.avg(bin.ln.get(0).get_x1(), bin.ln.get(0).get_x2()))
, y = obj.y
, xloc = xloc.bar_time
, color = #ffffff00
, style = label.style_label_down
, textcolor = obj.css
, size = mstext.txSz()
, text = obj.txt
)
)
if msbubble
bin.lb.unshift(
label.new(
x = obj.x1
, y = obj.y
, xloc = xloc.bar_time
, color = color.new(obj.css, 80)
, style = label.style_circle
, size = size.tiny
)
)
for i = 0 to brdw.size() - 1
obj = brdw.get(i)
if i <= limit
bin.ln.unshift(
line.new(
x1 = obj.x1
, x2 = obj.x2
, y1 = obj.y
, y2 = obj.y
, color = obj.css
, style = obj.style
, xloc = xloc.bar_time
)
)
bin.lb.unshift(
label.new(
x = int(math.avg(bin.ln.get(0).get_x1(), bin.ln.get(0).get_x2()))
, y = obj.y
, xloc = xloc.bar_time
, color = #ffffff00
, style = label.style_label_up
, textcolor = obj.css
, size = mstext.txSz()
, text = obj.txt
)
)
if msbubble
bin.lb.unshift(
label.new(
x = obj.x1
, y = obj.y
, xloc = xloc.bar_time
, color = color.new(obj.css, 80)
, style = label.style_circle
, size = size.tiny
)
)
ms
//}
_ ='
------------
–––––––––––––––––––––––––– EXECUTION –––––––––––––––––––––––––––
------------ '//{
structure ms = na
if windowsis
if (bar_index > last_bar_index - mswindow)
ms := structure(swingcssup , swingcssdn , showSwing , false, swingLimit)
if windowsis == false
ms := structure(swingcssup , swingcssdn , showSwing , false, swingLimit)
// if showInternal and inZone
// structure ims = structure(interncssup, interncssdn, showInternal, true , swingLimit)
color css = na
method darkcss(color css, float factor) =>
blue = color.b(css) * (1 - factor)
red = color.r(css) * (1 - factor)
green = color.g(css) * (1 - factor)
color.rgb(red, green, blue, 0)
if windowsis ? (bar_index > last_bar_index - mswindow) : true
css := ms.trend == 1 ? swingcssup : swingcssdn
css := (ms.txt == "bos" ? css : css.darkcss(0.3))
barcolor(candlecss ? css : na)
if fvg_enable
dFVG()
if showMapping
mapping()
var phl = Zphl.new(
na
, na
, label.new(na , na , color = invcol , textcolor = swingcssdn , style = label.style_label_down , size = size.tiny , text = "")
, label.new(na , na , color = invcol , textcolor = swingcssup , style = label.style_label_up , size = size.tiny , text = "")
, true
, true
, true
, true
, ""
, ""
, 0
, 0
, 0
, 0
, high
, low
, 0
, 0
, 0
, 0
, 0
, 0
, na
, na
)
// إعدادات تفعيل/تعطيل وتخصيص لكل مستوى فيبوناتشي
// حساب آخر قمة وقاع محوري
int fib_pivot_len = 5
ph = ta.pivothigh(high, fib_pivot_len, fib_pivot_len)
pl = ta.pivotlow(low, fib_pivot_len, fib_pivot_len)
var float last_high = na
var int last_high_x = na
var float last_low = na
var int last_low_x = na
if not na(ph)
last_high := high
last_high_x := bar_index - fib_pivot_len
if not na(pl)
last_low := low
last_low_x := bar_index - fib_pivot_len
var float fib_top = na
var float fib_bottom = na
var int fib_x1 = na
var int fib_x2 = na
if not na(last_high) and not na(last_low)
if last_high_x > last_low_x
fib_top := last_high
fib_bottom := last_low
fib_x1 := last_low_x
fib_x2 := last_high_x
else
fib_top := last_high
fib_bottom := last_low
fib_x1 := last_high_x
fib_x2 := last_low_x
var line fib_lines_pivot = array.new()
var label fib_labels_pivot = array.new()
if not na(fib_top) and not na(fib_bottom) and not na(fib_x1) and not na(fib_x2)
if barstate.islast
// حذف الخطوط والليبلات القديمة
for l in fib_lines_pivot
l.delete()
fib_lines_pivot.clear()
for lb in fib_labels_pivot
lb.delete()
fib_labels_pivot.clear()
// ...existing code...
fib_vals = array.from(0.0, 0.236, 0.382, 0.5, 0.618, 0.786, 1.0, 1.272, 1.618, 1.80, 2.0, 2.272, 2.618)
fib_shows = array.from(show_fib_0, show_fib_236, show_fib_382, show_fib_5, show_fib_618, show_fib_786, show_fib_1, show_fib_1272, show_fib_1618, show_fib_180, show_fib_2, show_fib_2272, show_fib_2618)
fib_colors = array.from(fib_color_0, fib_color_236, fib_color_382, fib_color_5, fib_color_618, fib_color_786, fib_color_1, fib_color_1272, fib_color_1618, fib_color_180, fib_color_2, fib_color_2272, fib_color_2618)
fib_texts = array.from("0.0", "23.6%", "38.2%", "50.0%", "61.8%", "78.6%", "100%", "127.2%", "161.8%", "180%", "200%", "227.2%", "261.8%")
// عند رسم الخطوط والليبلات:
for i = 0 to array.size(fib_vals) - 1
level_val = array.get(fib_vals, i)
level_show = array.get(fib_shows, i)
level_color = array.get(fib_colors, i)
level_txt = array.get(fib_texts, i)
if level_show
price = fib_bottom + (fib_top - fib_bottom) * level_val
l = line.new(x1=fib_x1, y1=price, x2=fib_x2 + fib_shift, y2=price, color=level_color, width=1, style=line.style_dotted, xloc=xloc.bar_index)
array.push(fib_lines_pivot, l)
lb = label.new(x=fib_x2 + fib_shift, y=price, text=level_txt + " | " + str.tostring(price, format.mintick), color=#ffffff00, textcolor=level_color, size=fib_size, style=label.style_label_left, xloc=xloc.bar_index)
array.push(fib_labels_pivot, lb)
Money Printer 1.0bollinger band candle body closes, while using the 100,200 ema for shorts, longs, take profit at the middle of the bollinger bands
Crypto DanR 1.4.2 PC-Roye Edition📜 Crypto DanR 1.4.2 — PC Roye Edition (Open Source)
This indicator combines Smart Money Concepts (SMC), Liquidity Analysis, and Trend Filtering to provide traders with a high-quality tool for intraday and swing trading on assets like XRP/USDT.
✅ What This Script Does
Crypto DanR 1.4.2 integrates the following advanced features:
Break of Structure (BOS) & Change of Character (CHoCH):
Detects key shifts in market structure
Helps confirm trend direction and reversal points
Fair Value Gaps (FVG):
Displays unmitigated liquidity voids using a style inspired by LuxAlgo
Highlights potential retracement zones where smart money may re-enter
Equal Highs / Equal Lows (EQH/EQL):
Marks liquidity zones that institutions often target before reversals
Order Blocks (OB):
Identifies potential institutional demand/supply zones
Option to filter by wick, body, or mitigation logic
Fibonacci Volatility Bands (based on BigBeluga’s logic):
Detects potential price extremes using Fib extensions on volatility
10 Moving Averages in One (inspired by hiimannshu's script):
Supports 10 custom MAs (SMA, EMA, RMA, HMA, VWMA, etc.) with adjustable source and timeframe
Ideal for trend filtering or dynamic support/resistance
Vector Candles (TradersReality / PVSRA):
Color-coded candles showing real-time volume pressure and trend bias
Visual Trade Plan:
Optional overlay for entry, stop-loss, and take-profit planning
Displays risk-to-reward ratio and potential % gain/loss live
🧠 How It Works
The script uses a price-action-first approach, built around concepts from Smart Money Theory. CHoCH and BOS detect structural shifts, while FVGs and OBs help forecast likely reaction zones. The multiple moving averages act as a trend filter to avoid entering against momentum.
This combination allows traders to:
Enter on mitigations or breakouts
Set stops outside liquidity zones
Manage trades visually with dynamic risk/reward levels
📊 Best Use Cases
15m or 1h scalping (ideal)
Swing trading on 4h
Works well on crypto, FX, and indices
🙏 Credits
TradersReality for PVSRA logic via public library
LuxAlgo for FVG inspiration
hiimannshu for 10-in-1 MA logic
BigBeluga for Fibonacci Bands methodology
All reused logic is significantly modified and part of a broader framework.
📌 Notes
Script is open-source to promote transparency and collaboration
Please do not copy-paste and republish without adding meaningful improvements
Feedback and suggestions welcome!
Time Range Marker By BCB ElevateThe Time Range Marker is a simple yet powerful visual tool for traders who want to focus on specific time intervals within the trading day. This indicator highlights a custom time range on your chart using a background color, helping you visually isolate key trading sessions or event windows such as:
Market open/close hours
News release periods
High-volatility trading zones
Personal strategy testing windows
⚙️ Key Features:
Customizable start and end time (hour & minute)
Works across all intraday timeframes
Adjustable highlight color to match your chart theme
Built using Pine Script v5 for speed and flexibility
🔧 Settings:
Start Hour / Minute – Set the beginning of the time range (in 24-hour format)
End Hour / Minute – Define when the range ends
Highlight Color – Choose the background color for better visibility
🕒 Timezone Note:
The indicator uses UTC time by default to ensure accuracy across markets. If your broker uses a different timezone (like EST, IST, etc.), the script can be adjusted to reflect your local market hours.
✅ How to Use the Time Range Marker Indicator
This indicator is used to visually highlight a specific time window each trading day, such as:
Market open or close sessions (e.g., NYSE, London, Tokyo)
High-impact news release periods
Custom time slots for strategy testing or scalping
🛠️ Installation Steps
Open TradingView and go to any chart.
Click on Pine Editor at the bottom of the screen.
Copy and paste the full Pine Script (shared above) into the editor.
Click the “Add to Chart” ▶️ button.
The indicator will appear on the chart with a highlighted background during the time range you set.
⚙️ How to Customize the Time Range
After adding the indicator:
Click the gear icon ⚙️ next to the indicator’s name on the chart.
Adjust the following settings:
Start Hour / Start Minute: The beginning of your time range (in 24-hour format).
End Hour / End Minute: When the highlight should stop.
Highlight Color: Pick a color and transparency for visual clarity.
Click OK to apply changes.
🕒 Timezone Consideration
By default, the indicator uses UTC (Coordinated Universal Time).
To match your broker’s timezone (e.g., EST, IST, etc.), you'll need to adjust the script by changing:
sessStart = timestamp("Etc/UTC", ...)
sessEnd = timestamp("Etc/UTC", ...)
to your correct timezone, like "Asia/Kolkata" for IST or "America/New_York" for EST.
Let me know your broker or local timezone, and I’ll update it for you.
📈 Tips for Traders
Combine this with volume, price action, or breakout indicators to focus your strategy on high-probability time windows.
Use multiple versions of this script if you want to highlight more than one time range in a day.
Bias Dashboard + All Open Lines (M/W/D/H4/H1/15min)What does the script do?
This script displays a dashboard that shows the current market bias relative to the open prices of multiple timeframes:
Monthly
Weekly
Daily
4H
1H
15min
Additionally, it plots horizontal lines at each of these open levels on the chart.
How it works
Fetch Open Prices:
The script uses request.security() to get the open prices for each timeframe.
Determine Bias:
Compares the current close price to each open:
If close > open, then "Bullish"
If close < open, then "Bearish"
Display Dashboard:
A visual dashboard shows:
The timeframe label
Whether the current price is above (bullish) or below (bearish) that level
Plot Lines:
Colored horizontal lines are drawn on the chart to indicate each timeframe’s open level.
10-Day Avg Upside vs Downside VolumeUpside Volume: The total volume on days when the stock closes higher than the previous day.
Downside Volume: The total volume on days when the stock closes lower than the previous day.
It calculates the 10-day simple moving average of both upside and downside volumes.
An optional ratio line is included to visualize relative buying vs selling pressure.
Short-Indicator + Exit-AlertThis simple yet effective indicator is designed for beginners and provides a clear trading signal when three conditions are met:
- The stock price is below the EMA200, indicating a bearish trend.
- The MACD histogram changes from positive to negative, a signal for momentum reversal from bullish to bearish.
- The Volume Oscillator is positive (above the zero line), suggesting increasing trading activity.
Alert: When all three conditions are fulfilled, an alert is triggered for a potential short entry.
- Take Profit (TP): When the price hits the lower boundary of the Donchian Channel, the trade is exited with a profit.
- Stop Loss (SL): When the price touches the upper boundary of the Donchian Channel, the position is closed to limit losses.