GP MagicCandle and Time Based Breakout Indicator ..... Back test and used for Nifty and Bank nifty Spot Index
Candlestick analysis
QUARTERLY CYCLES - DAY - SESSION - 90M - RICH BVWYThis custom version of the origional script by © HandlesHandle
refines the quarter labeling system. Instead of implying discrete deliveries (A, M, D, X etc.), quarters are labeled Q1–Q4 to reflect fixed time ranges. This ensures clarity: quarters are structural anchors, while AMDX variables define the actual cycle behavior. The indicator highlights cycles, not expected deliveries.
Golden EMA Basic Visuals - MAurum LabsGolden EMA UI is a premium-style trading indicator built for traders who value Clarity, Structure, and Precision.
At its core, the indicator uses a powerful EMA 9 / 21 / 50 frameworks to identify short-term momentum, trend direction, and higher-timeframe bias.
Advanced UI and rule-based BUY/SELL signals are available in the premium version via invite-only access.
Thai Stock Trend Template (Minervini)Standard Criteria for Uptrend Stock Screening (Trend Template)
To ensure efficient security screening and accurate identification of stocks with structural strength (Stage 2 Uptrend), investors should prioritize securities that fully satisfy the following criteria:
1. Long-term Moving Average Alignment: The current security price must be positioned above both the 150-day Simple Moving Average (SMA 150) and the 200-day Simple Moving Average (SMA 200). Furthermore, the SMA 150 must be higher than the SMA 200.
2. Price Stability Duration: The security price must consistently maintain its level above the SMA 200 for a period of no less than one month (though a duration of 4-5 months or more is preferred for trend stability).
3. Short-to-Medium Term Slope and Momentum: The 50-day Simple Moving Average (SMA 50) must be positioned above both the SMA 150 and the SMA 200, respectively. Additionally, the current price must be trading above the SMA 50.
4. Recovery Rate from 52-Week Low: The current price must be at least 30% higher than its 52-week low. (A price increase of 100% to 300% or more is considered a hallmark of a high-performance stock).
5 .Proximity to 52-Week High: The current price must be within 25% of its 52-week high, indicating a high probability of establishing a new high.
6. Relative Strength (RS) Ranking: The security’s Relative Strength score must be at least 70. Scores within the 80 to 90 range (or higher) typically identify clear Market Leaders.
Additional Recommendations: These criteria are designed to identify stocks experiencing systematic accumulation and a clear state of demand exceeding supply. Investors should also incorporate Fundamental Analysis to ensure maximum security in risk management.
🛠️ How to Use in TradingView:
1. Open the TradingView application or website and select your desired Thai stock chart.
2. In the bottom panel, click on the "Pine Editor" tab.
3. Delete any existing code and paste the provided Pine Script.
4. Click "Save" (Title it: Thai Trend Template).
5. Click "Add to Chart".
💡 Visual Indicators:
Three-color Lines: SMA 50 (Blue), SMA 150 (Orange), and SMA 200 (Red).
Light Green Highlight: The background will turn green when the stock meets all Trend Template conditions simultaneously.
"TREND TEMPLATE" Label: This label will appear below the candle on the first day the stock qualifies, signaling the potential start of a major uptrend.
⚠️ Precautions:
RS Ranking: In this Pine Script, the calculation is based on the Raw Relative Strength (stock performance relative to its own past). Since Pine Script cannot pull rankings across the entire market directly like specialized scanning software, this serves as a technical proxy.
Thai Stock Market: It is highly recommended to use the Daily Timeframe only to maintain the accuracy and integrity of the original formula.
-----------------------------------------------------------------------------------------------
เกณฑ์มาตรฐานการคัดกรองหุ้นตามแนวโน้มขาขึ้น (Trend Template)
เพื่อให้การคัดกรองหลักทรัพย์เป็นไปอย่างมีประสิทธิภาพและสามารถระบุหุ้นที่มีความแข็งแกร่งเชิงโครงสร้าง (Stage 2 Uptrend) ได้อย่างแม่นยำ ผู้ลงทุนควรพิจารณาหลักทรัพย์ที่มีคุณสมบัติครบถ้วนตามหลักเกณฑ์ดังต่อไปนี้:
1. การเรียงตัวของเส้นค่าเฉลี่ยระยะยาว: ราคาหลักทรัพย์ปัจจุบันต้องอยู่เหนือเส้นค่าเฉลี่ยเคลื่อนที่ 150 วัน (SMA 150) และเส้นค่าเฉลี่ยเคลื่อนที่ 200 วัน (SMA 200) โดยที่เส้นค่าเฉลี่ย 150 วัน ต้องมีค่าสูงกว่าเส้นค่าเฉลี่ย 200 วัน
2. ระยะเวลาการยืนระยะของราคา: ราคาหลักทรัพย์ต้องสามารถรักษาระดับอยู่เหนือเส้นค่าเฉลี่ยเคลื่อนที่ 200 วัน มาอย่างต่อเนื่องเป็นระยะเวลาไม่น้อยกว่า 1 เดือน (โดยระยะเวลาที่เหมาะสมตามเกณฑ์ความมั่นคงของแนวโน้มคือ 4-5 เดือนขึ้นไป)
3. ความชันและโมเมนตัมระยะสั้นถึงกลาง: เส้นค่าเฉลี่ยเคลื่อนที่ 50 วัน (SMA 50) ต้องอยู่เหนือเส้นค่าเฉลี่ยเคลื่อนที่ 150 วัน และ 200 วัน ตามลำดับ อีกทั้งราคาปัจจุบันของหลักทรัพย์ต้องเคลื่อนไหวอยู่เหนือเส้นค่าเฉลี่ย 50 วัน
4. อัตราการฟื้นตัวจากจุดต่ำสุด: ราคาปัจจุบันของหลักทรัพย์ต้องปรับตัวสูงกว่าจุดต่ำสุดในรอบ 52 สัปดาห์ (1 ปี) อย่างน้อยร้อยละ 30 ขึ้นไป (หากราคาปรับตัวสูงขึ้นได้ร้อยละ 100 ถึง 300 จะถือเป็นสัญญาณของหุ้นที่มีประสิทธิภาพสูง)
5. กรอบการเคลื่อนไหวใกล้จุดสูงสุด: ราคาปัจจุบันต้องเคลื่อนไหวอยู่ในกรอบที่ไม่เกินร้อยละ 25 เมื่อเทียบกับจุดสูงสุดในรอบ 52 สัปดาห์ (1 ปี) เพื่อแสดงถึงสภาวะที่ราคาพร้อมจะสร้างระดับสูงสุดใหม่ (New High)
6. ค่าความแข็งแกร่งสัมพัทธ์ (Relative Strength Ranking): ค่าคะแนนความแข็งแกร่งสัมพัทธ์ของหลักทรัพย์ต้องไม่ต่ำกว่า 70 คะแนน โดยระดับที่บ่งชี้ถึงหุ้นผู้นำตลาด (Market Leader) ที่ชัดเจนควรมีคะแนนอยู่ในช่วง 80 ถึง 90 คะแนนขึ้นไป
ข้อแนะนำเพิ่มเติม : หลักเกณฑ์ดังกล่าวข้างต้นออกแบบมาเพื่อระบุหุ้นที่มีแรงซื้อสะสมอย่างเป็นระบบและอยู่ในสภาวะที่อุปสงค์มากกว่าอุปทานอย่างชัดเจน นักลงทุนควรใช้การวิเคราะห์ปัจจัยพื้นฐาน (Fundamental Analysis) ร่วมด้วยเพื่อความปลอดภัยสูงสุดในการบริหารความเสี่ยง
🛠️ วิธีใช้งานใน TradingView:
1. เปิดโปรแกรม/เว็บไซต์ TradingView แล้วเลือกกราฟหุ้นไทยตัวที่ต้องการ
2. ที่แถบด้านล่าง คลิกที่คำว่า "Pine Editor"
3. ลบโค้ดเก่าออกให้หมด แล้ว Copy โค้ดด้านบนไปวาง
4. กดปุ่ม "Save" (ตั้งชื่อว่า Thai Trend Template)
5. กดปุ่ม "Add to Chart"
💡 สิ่งที่คุณจะเห็น:
เส้น 3 สี: SMA 50 (น้ำเงิน), 150 (ส้ม), 200 (แดง)
แถบสีเขียวอ่อน: พื้นหลังจะเปลี่ยนเป็นสีเขียวเมื่อหุ้นตัวนั้นเข้าเงื่อนไข Trend Template ครบทุกข้อ ณ ขณะนั้น
ป้าย "TREND TEMPLATE": จะปรากฏใต้แท่งเทียนในวันแรกที่หุ้นเริ่มเข้าเกณฑ์ เพื่อบอกจุดเริ่มต้นของรอบขาขึ้น
⚠️ ข้อควรระวัง:
RS Ranking: ใน Pine Script ตัวนี้ ใช้การคำนวณ Performance ของตัวหุ้นเองเทียบกับอดีต (Relative Strength แบบดิบ) เนื่องจากระบบ Pine Script ไม่สามารถดึง Ranking ของหุ้นทั้งตลาดมาเปรียบเทียบกันได้โดยตรงเหมือนโปรแกรมสแกนเฉพาะทาง
ตลาดหุ้นไทย: แนะนำให้ใช้บน Timeframe Day เท่านั้นเพื่อให้แม่นยำตามสูตรต้นตำรับ
Promethus █ OVERVIEW
HPT Master Suite is an all-in-one institutional trading toolkit combining multi-timeframe analysis, Smart Money Concepts (SMC), and volume-based detection systems.
█ FEATURES
MTF DASHBOARD
- Real-time analysis across 9 timeframes (1M to Monthly)
- MA alignment status with trend detection
- RSI and squeeze monitoring
- Macro data row (VIX, DXY, 10Y, OIL)
- 5/20 and 9/21 cross confluence tracking
SMART MONEY CONCEPTS
- Volumetric Order Blocks with engagement detection
- Fair Value Gaps with 50% CE line
- Liquidity sweep detection
- Unicorn Model (FVG + OB overlap)
VOLUME ANALYSIS
- Dynamic Volume Profile (POC, VAH, VAL)
- High/Low Volume Nodes
- Naked POC tracking
- Absorption detection with strength gauge
INSTITUTIONAL TOOLS
- 55 SMA institutional support level
- Significant wick levels
- Session boxes (Asia, London, NYSE, Lunch, PM)
- SMT Divergence detection
SIGNALS
- Buy/Sell signals with adjustable sensitivity
- Golden/Death Cross alerts
- OB engagement alerts
█ USAGE
Enable features as needed - all components are modular and can be toggled independently. Start with the dashboard and add SMC/volume tools based on your trading style.
█ SETTINGS
Most detection parameters use simplified controls (Low/Medium/High) for ease of use while maintaining effectiveness.
█ NOTES
Works best on futures (NQ, ES) and indices. Dashboard updates in real-time across all timeframes.
For TradingView I am not redirecting, and or soliciting any service. If your interesting in learning more and how I trade with a 98% WR in options and above 80% in futures the links to my FREE site's are listed in my profile.
Dong - Auto Volume +VERSmart Volume Spike Detection: Automatically identifies significant trading activity by comparing current volume against its historical average with adjustable sensitivity.
Dynamic Supply & Resistance Zones: Draws extended horizontal boxes from high-volume candles to visualize key institutional interest levels and potential price pivot points.
Viewport-Optimized Performance: Features an intelligent "Visible Range" toggle that focuses processing and display only on the active chart area for a cleaner, faster experience.
Immediate Visual Confirmation: Dynamically colors price bars during volume surges, providing instant visual cues for market conviction without checking a separate sub-window.
Directional Market Analysis: Uses distinct color-coding for bullish and bearish spikes to help traders quickly distinguish between aggressive buying and panic selling.
Smart Resource Management: Includes a customizable limit for active boxes, ensuring the chart remains organized while preserving the most relevant historical levels.
Professional Styling Control: Offers full flexibility over line widths, border styles, and colors to seamlessly integrate with any professional trading template.
Ker 2021 EMA/SMA這個腳本主要是EMA/SMA的基礎
加上可調動範圍
數字可以調動
但是因為我不是coding人員
所以有些欄位編排不正確
但是使用上沒有什麼問題
如果你有coding的能力
可以聯絡我 幫我補正 謝謝
This script is mainly based on EMA/SMA, with adjustable ranges and parameters.
The values can be modified freely.
Since I’m not a programmer, some of the field formatting may not be perfectly structured.
However, it works fine in actual use.
If you have coding experience and would like to help improve or clean up the code, feel free to contact me. Thank you.
ORB 9 AM📊 ORB 9 AM (Opening Range Breakout)
ORB 9 AM is an Opening Range Breakout indicator designed to identify the high and low price range during the morning market opening at 09:00 WIB.
This indicator helps traders:
Identify the initial consolidation zone
Trade valid breakouts after the opening range is formed
Use the opening range as intraday support and resistance
⚙️ How It Works
The indicator captures the High and Low price range at 09:00 WIB
ORB High and ORB Low lines are clearly separated
The range is applied only for that session (no overlapping with other sessions)
After the range is formed, traders wait for a breakout above or below the range
📈 Basic Trading Rules
Buy (Long)
Price breaks and closes above ORB High
Optional confirmation: volume or momentum
Sell (Short)
Price breaks and closes below ORB Low
Optional confirmation: volume or momentum
Stop Loss
Placed on the opposite side of the ORB range
Take Profit
Risk–Reward based (1:2 / 1:3)
Or follow market structure
🕒 Timezone Information
Default timezone: UTC
09:00 WIB = 02:00 UTC
Make sure your chart timezone is correct for accurate levels
🧠 Best Used For
Intraday trading
Scalping and day trading
Crypto, Forex, Indices, and Gold
⚠️ Disclaimer
This indicator does not guarantee profits. Always use proper risk management and additional confirmation before entering a trade.
Sonic R 89 - NY buy LionLee 079 228 1999//@version=5
indicator("Sonic R 89 - NY SL Custom Fixed", overlay=true, max_lines_count=500)
// --- 0. TÙY CHỈNH THÔNG SỐ ---
group_session = "Cài đặt Phiên Giao Dịch (Giờ New York)"
use_session = input.bool(true, "Chỉ giao dịch theo khung giờ", group=group_session)
session_time = input.session("0800-1200", "Khung giờ NY 1", group=group_session)
session_time2 = input.session("1300-1700", "Khung giờ NY 2", group=group_session)
max_trades_per_session = input.int(1, "Số lệnh tối đa/mỗi khung giờ", minval=1, group=group_session)
group_risk = "Quản lý Rủi ro (Dashboard)"
risk_usd = input.float(100.0, "Số tiền rủi ro mỗi lệnh ($)", minval=1.0, group=group_risk)
group_sl_custom = "Cấu hình Stop Loss (SL)"
sl_mode = input.string("Dragon", "Chế độ SL", options= , group=group_sl_custom)
lookback_x = input.int(5, "Số nến (X) cho Swing SL", minval=1, group=group_sl_custom)
group_htf = "Lọc Đa khung thời gian (MTF)"
htf_res = input.timeframe("30", "Chọn khung HTF", group=group_htf)
group_sonic = "Cấu hình Sonic R"
vol_mult = input.float(1.5, "Đột biến Volume", minval=1.0)
max_waves = input.int(4, "Ưu tiên n nhịp đầu", minval=1)
trade_cd = input.int(5, "Khoảng cách lệnh (nến)", minval=1)
group_tp = "Quản lý SL/TP & Dòng kẻ"
rr_tp1 = input.float(1.0, "TP1 (RR)", step=0.1)
rr_tp2 = input.float(2.0, "TP2 (RR)", step=0.1)
rr_tp3 = input.float(3.0, "TP3 (RR)", step=0.1)
rr_tp4 = input.float(4.0, "TP4 (RR)", step=0.1)
line_len = input.int(15, "Chiều dài dòng kẻ", minval=1)
// --- 1. KIỂM TRA PHIÊN & HTF ---
is_in_sess1 = not na(time(timeframe.period, session_time, "America/New_York"))
is_in_sess2 = not na(time(timeframe.period, session_time2, "America/New_York"))
is_in_session = use_session ? (is_in_sess1 or is_in_sess2) : true
var int trades_count = 0
is_new_session = is_in_session and not is_in_session
if is_new_session
trades_count := 0
htf_open = request.security(syminfo.tickerid, htf_res, open, lookahead=barmerge.lookahead_on)
htf_close = request.security(syminfo.tickerid, htf_res, close, lookahead=barmerge.lookahead_on)
is_htf_trend = htf_close >= htf_open ? 1 : -1
// --- 2. TÍNH TOÁN CHỈ BÁO ---
ema89 = ta.ema(close, 89)
ema34H = ta.ema(high, 34)
ema34L = ta.ema(low, 34)
atr = ta.atr(14)
avgVol = ta.sma(volume, 20)
slope89 = (ema89 - ema89 ) / atr
hasSlope = math.abs(slope89) > 0.12
isSqueezed = math.abs(ta.ema(close, 34) - ema89) < (atr * 0.5)
var int waveCount = 0
if not hasSlope
waveCount := 0
newWave = hasSlope and ((low <= ema34H and close > ema34H) or (high >= ema34L and close < ema34L))
if newWave and not newWave
waveCount := waveCount + 1
// --- 3. LOGIC VÀO LỆNH ---
isMarubozu = math.abs(close - open) / (high - low) > 0.8
highVol = volume > avgVol * vol_mult
buyCondition = is_in_session and (trades_count < max_trades_per_session) and waveCount <= max_waves and is_htf_trend == 1 and
(isMarubozu or highVol) and close > ema34H and low >= ema89 and
(slope89 > 0.1 or isSqueezed ) and close > open
sellCondition = is_in_session and (trades_count < max_trades_per_session) and waveCount <= max_waves and is_htf_trend == -1 and
(isMarubozu or highVol) and close < ema34L and high <= ema89 and
(slope89 < -0.1 or isSqueezed ) and close < open
// --- 4. QUẢN LÝ LỆNH ---
var float last_entry = na
var float last_sl = na
var float last_tp1 = na
var float last_tp2 = na
var float last_tp3 = na
var float last_tp4 = na
var string last_type = "NONE"
var int lastBar = 0
trigger_buy = buyCondition and (bar_index - lastBar > trade_cd)
trigger_sell = sellCondition and (bar_index - lastBar > trade_cd)
// --- 5. TÍNH TOÁN SL & LOT SIZE ---
float contract_size = 1.0
if str.contains(syminfo.ticker, "XAU") or str.contains(syminfo.ticker, "GOLD")
contract_size := 100
// Logic tính SL linh hoạt
float swing_low = ta.lowest(low, lookback_x)
float swing_high = ta.highest(high, lookback_x)
float temp_sl_calc = na
if trigger_buy
temp_sl_calc := (sl_mode == "Dragon") ? ema34L : swing_low
if trigger_sell
temp_sl_calc := (sl_mode == "Dragon") ? ema34H : swing_high
float sl_dist_calc = math.abs(close - temp_sl_calc)
float calc_lots = (sl_dist_calc > 0) ? (risk_usd / (sl_dist_calc * contract_size)) : 0
if (trigger_buy or trigger_sell)
trades_count := trades_count + 1
lastBar := bar_index
last_type := trigger_buy ? "BUY" : "SELL"
last_entry := close
last_sl := temp_sl_calc
float riskAmt = math.abs(last_entry - last_sl)
last_tp1 := trigger_buy ? last_entry + (riskAmt * rr_tp1) : last_entry - (riskAmt * rr_tp1)
last_tp2 := trigger_buy ? last_entry + (riskAmt * rr_tp2) : last_entry - (riskAmt * rr_tp2)
last_tp3 := trigger_buy ? last_entry + (riskAmt * rr_tp3) : last_entry - (riskAmt * rr_tp3)
last_tp4 := trigger_buy ? last_entry + (riskAmt * rr_tp4) : last_entry - (riskAmt * rr_tp4)
// Vẽ dòng kẻ
line.new(bar_index, last_entry, bar_index + line_len, last_entry, color=color.new(color.gray, 50), width=2)
line.new(bar_index, last_sl, bar_index + line_len, last_sl, color=color.red, width=2, style=line.style_dashed)
line.new(bar_index, last_tp1, bar_index + line_len, last_tp1, color=color.green, width=1)
line.new(bar_index, last_tp2, bar_index + line_len, last_tp2, color=color.lime, width=1)
line.new(bar_index, last_tp3, bar_index + line_len, last_tp3, color=color.aqua, width=1)
line.new(bar_index, last_tp4, bar_index + line_len, last_tp4, color=color.blue, width=2)
// KÍCH HOẠT ALERT()
string alert_msg = (trigger_buy ? "BUY " : "SELL ") + syminfo.ticker + " at " + str.tostring(close) + " | SL Mode: " + sl_mode + " | Lot: " + str.tostring(calc_lots, "#.##") + " | SL: " + str.tostring(last_sl, format.mintick)
alert(alert_msg, alert.freq_once_per_bar_close)
// --- 6. CẢNH BÁO CỐ ĐỊNH ---
alertcondition(trigger_buy, title="Sonic R BUY Alert", message="Sonic R BUY Signal Detected")
alertcondition(trigger_sell, title="Sonic R SELL Alert", message="Sonic R SELL Signal Detected")
// --- 7. DASHBOARD & PLOT ---
var table sonic_table = table.new(position.top_right, 2, 10, bgcolor=color.new(color.black, 70), border_width=1, border_color=color.gray)
if barstate.islast
table.cell(sonic_table, 0, 0, "NY SESSION", text_color=color.white), table.cell(sonic_table, 1, 0, last_type, text_color=(last_type == "BUY" ? color.lime : color.red))
table.cell(sonic_table, 0, 1, "SL Mode:", text_color=color.white), table.cell(sonic_table, 1, 1, sl_mode, text_color=color.orange)
table.cell(sonic_table, 0, 2, "Trades this Sess:", text_color=color.white), table.cell(sonic_table, 1, 2, str.tostring(trades_count) + "/" + str.tostring(max_trades_per_session), text_color=color.yellow)
table.cell(sonic_table, 0, 3, "LOT SIZE:", text_color=color.orange), table.cell(sonic_table, 1, 3, str.tostring(calc_lots, "#.##"), text_color=color.orange)
table.cell(sonic_table, 0, 4, "Entry:", text_color=color.white), table.cell(sonic_table, 1, 4, str.tostring(last_entry, format.mintick), text_color=color.yellow)
table.cell(sonic_table, 0, 5, "SL:", text_color=color.white), table.cell(sonic_table, 1, 5, str.tostring(last_sl, format.mintick), text_color=color.red)
table.cell(sonic_table, 0, 6, "TP1:", text_color=color.gray), table.cell(sonic_table, 1, 6, str.tostring(last_tp1, format.mintick), text_color=color.green)
table.cell(sonic_table, 0, 7, "TP2:", text_color=color.gray), table.cell(sonic_table, 1, 7, str.tostring(last_tp2, format.mintick), text_color=color.lime)
table.cell(sonic_table, 0, 8, "TP3:", text_color=color.gray), table.cell(sonic_table, 1, 8, str.tostring(last_tp3, format.mintick), text_color=color.aqua)
table.cell(sonic_table, 0, 9, "TP4:", text_color=color.gray), table.cell(sonic_table, 1, 9, str.tostring(last_tp4, format.mintick), text_color=color.blue)
plot(ema89, color=slope89 > 0.1 ? color.lime : slope89 < -0.1 ? color.red : color.gray, linewidth=2)
p_high = plot(ema34H, color=color.new(color.blue, 80))
p_low = plot(ema34L, color=color.new(color.blue, 80))
fill(p_high, p_low, color=color.new(color.blue, 96))
plotshape(trigger_buy, "BUY", shape.triangleup, location.belowbar, color=color.green, size=size.small)
plotshape(trigger_sell, "SELL", shape.triangledown, location.abovebar, color=color.red, size=size.small)
bgcolor(isSqueezed ? color.new(color.yellow, 92) : na)
bgcolor(not is_in_session ? color.new(color.gray, 96) : na)
SWEEP HTF CANDLE - BY LIONLEE - 0792281999// This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
// © CandelaCharts
//@version=6
indicator("CandelaCharts - HTF Sweeps", shorttitle = "CandelaCharts - HTF Sweeps", overlay = true, max_lines_count = 500, max_labels_count = 500, max_boxes_count = 500, max_bars_back = 500, max_polylines_count = 100)
// # ========================================================================= #
// # | Colors |
// # ========================================================================= #
//#region
// # Core -------------------------------------------------------------------- #
colors_white = color.white
colors_black = color.black
colors_purple = color.purple
colors_red = color.red
colors_gray = color.gray
colors_blue = color.blue
colors_orange = color.orange
colors_green = color.green
color_transparent = #ffffff00
//#endregion
// # ========================================================================= #
// # | End |
// # ========================================================================= #
// # ========================================================================= #
// # | Inputs |
// # ========================================================================= #
//#region
// # General ----------------------------------------------------------------- #
general_font = input.string("Monospace", "Text ", options = , inline = "1.0", group = "General")
general_text = input.string("Tiny", "", options = , inline = "1.0", group = "General")
general_brand_show = input.bool(false, "Hide Brand", group = "General")
htf_sweeps_tf_1_show = input.bool(true, "HTF I ", inline = "1.0", group = "Timeframes")
htf_sweeps_tf_1_tf = input.timeframe("15", "", inline = "1.0", group = "Timeframes")
htf_sweeps_tf_1_number = input.int(10, "", inline = "1.0", group = "Timeframes", minval = 1, maxval = 60)
htf_sweeps_tf_1_map = input.bool(false, "M", inline = "1.0", group = "Timeframes", tooltip = "Map this HTF to LTF")
htf_sweeps_tf_2_show = input.bool(true, "HTF II ", inline = "2.0", group = "Timeframes")
htf_sweeps_tf_2_tf = input.timeframe("60", "", inline = "2.0", group = "Timeframes")
htf_sweeps_tf_2_number = input.int(8, "", inline = "2.0", group = "Timeframes", minval = 1, maxval = 60)
htf_sweeps_tf_2_map = input.bool(true, "M", inline = "2.0", group = "Timeframes")
htf_sweeps_tf_3_show = input.bool(true, "HTF III ", inline = "3.0", group = "Timeframes")
htf_sweeps_tf_3_tf = input.timeframe("240", "", inline = "3.0", group = "Timeframes")
htf_sweeps_tf_3_number = input.int(6, "", inline = "3.0", group = "Timeframes", minval = 1, maxval = 60)
htf_sweeps_tf_3_map = input.bool(false, "M", inline = "3.0", group = "Timeframes")
htf_sweeps_tf_4_show = input.bool(true, "HTF IV ", inline = "4.0", group = "Timeframes")
htf_sweeps_tf_4_tf = input.timeframe("1D", "", inline = "4.0", group = "Timeframes")
htf_sweeps_tf_4_number = input.int(4, "", inline = "4.0", group = "Timeframes", minval = 1, maxval = 60)
htf_sweeps_tf_4_map = input.bool(false, "M", inline = "4.0", group = "Timeframes")
htf_sweeps_tf_5_show = input.bool(true, "HTF V ", inline = "5.0", group = "Timeframes")
htf_sweeps_tf_5_tf = input.timeframe("1W", "", inline = "5.0", group = "Timeframes")
htf_sweeps_tf_5_number = input.int(2, "", inline = "5.0", group = "Timeframes", minval = 1, maxval = 60)
htf_sweeps_tf_5_map = input.bool(false, "M", inline = "5.0", group = "Timeframes")
htf_sweeps_tf_6_show = input.bool(false, "HTF VI ", inline = "6.0", group = "Timeframes")
htf_sweeps_tf_6_tf = input.timeframe("1M", "", inline = "6.0", group = "Timeframes")
htf_sweeps_tf_6_number = input.int(1, "", inline = "6.0", group = "Timeframes", minval = 1, maxval = 60)
htf_sweeps_tf_6_map = input.bool(false, "M", inline = "6.0", group = "Timeframes")
htf_sweeps_bull_color = input.color(colors_green, "Coloring ", inline = "1.0", group = "HTF")
htf_sweeps_bear_color = input.color(colors_black, "", inline = "1.0", group = "HTF")
htf_sweeps_wick_border_color = input.color(colors_black, "", inline = "1.0", group = "HTF")
htf_sweeps_offset = input.int(10, "Offset ", minval = 1, inline = "2.0", group = "HTF", tooltip = "The distance from the current chart candles.")
htf_sweeps_space = input.int(1, "Space ", minval = 1, inline = "3.0", maxval = 4, group = "HTF", tooltip = "Space between candles")
htf_sweeps_margin = input.int(10, "Margin ", minval = 1, inline = "4.0", group = "HTF", tooltip = "The distance between HTF group candles.")
htf_sweeps_candle_width = input.string("Small", "Size ", inline = "5.0", group = "HTF", options = , tooltip = "Candle size")
htf_sweeps_label_show = input.bool(true, "Labels ", inline = "6.0", group = "HTF")
htf_sweeps_label_size = input.string("Large", "", inline = "6.0", group = "HTF", options = )
htf_sweeps_label_position = input.string("Top", "", inline = "6.0", group = "HTF", options = , tooltip = " - Size of the label - Position of the label - Text color of the label")
htf_sweeps_label_color = input.color(colors_black, "", inline = "6.0", group = "HTF")
// htf_sweeps_bias_show = input.bool(true, "Bias ", inline = "6.0", group = "HTF")
// htf_sweeps_bias_bull_color = input.color(colors_green, "", inline = "6.0", group = "HTF")
// htf_sweeps_bias_bear_color = input.color(colors_red, "", inline = "6.0", group = "HTF")
// htf_sweeps_time_show = input.bool(true, "Time ", inline = "7.0", group = "HTF")
// htf_sweeps_time_color = input.color(colors_gray, "", inline = "7.0", group = "HTF")
htf_sweeps_ltf_trace_h_l_show = input.bool(true, "H/L Line ", inline = "1.0", group="LTF")
htf_sweeps_ltf_trace_h_l_style = input.string('····', '', options = , inline = "1.0", group="LTF")
htf_sweeps_ltf_trace_h_l_width = input.int(1, '', inline = "1.0", minval = 0, maxval = 4, group="LTF")
htf_sweeps_ltf_trace_h_l_color = input.color(color.new(colors_gray, 50), "", inline = "1.0", group="LTF")
htf_sweeps_ltf_trace_o_c_line_show = input.bool(true, "O/C Line ", inline = "2.0", group = "LTF")
htf_sweeps_ltf_trace_o_c_line_style = input.string('⎯⎯⎯', "", options = , inline = "2.0", group = "LTF")
htf_sweeps_ltf_trace_o_c_line_width = input.int(1, '', inline = "2.0", minval = 0, maxval = 4, group = "LTF")
htf_sweeps_ltf_trace_o_c_line_color = input.color(color.new(colors_gray, 50), "", inline = "2.0", group = "LTF")
htf_sweeps_sweep_show = input.bool(true, "Sweep ", inline = "1.0", group = "Sweep")
htf_sweeps_sweep_ltf_show = input.bool(true, "LTF ", inline = "1.0", group = "Sweep")
htf_sweeps_sweep_htf_show = input.bool(true, "HTF", inline = "1.0", group = "Sweep", tooltip = "Show sweeps. - Show sweeps on LTF. - Show sweeps on HTF.")
htf_sweeps_sweep_line_style = input.string('⎯⎯⎯', " ", options = , inline = "1.1", group = "Sweep")
htf_sweeps_sweep_line_width = input.int(1, '', inline = "1.1", group = "Sweep")
htf_sweeps_sweep_line_color = input.color(colors_black, "", inline = "1.1", group = "Sweep")
htf_sweeps_i_sweep_show = input.bool(false, "I-sweep ", inline = "2.0", group = "Sweep")
htf_sweeps_i_sweep_ltf_show = input.bool(true, "LTF ", inline = "2.0", group = "Sweep")
htf_sweeps_i_sweep_htf_show = input.bool(true, "HTF", inline = "2.0", group = "Sweep", tooltip = "Show invalidated sweeps. - Show invalidated sweeps on LTF. - Show invalidated sweeps on HTF.")
htf_sweeps_i_sweep_line_style = input.string('----', " ", options = , inline = "2.1", group = "Sweep")
htf_sweeps_i_sweep_line_width = input.int(1, '', inline = "2.1", group = "Sweep")
htf_sweeps_i_sweep_line_color = input.color(colors_gray, "", inline = "2.1", group = "Sweep")
htf_sweeps_real_time_sweep_show = input.bool(false, "Real-time", inline = "3.0", group = "Sweep", tooltip = "Control visibility of Real-time Sweeps on LTF and HTF")
// htf_sweeps_dashboard_info_show = input.bool(true, "Panel ", inline = "1.0", group = "Dashboard")
// htf_sweeps_dashboard_info_position = input.string("Bottom Center", "", options = , inline = "1.0", group = "Dashboard", tooltip = "The dashboard will display only the HTF that is mapped to LTF")
htf_sweeps_alerts_sweep_formation = input.bool(false, "Sweep Formation", inline = "1.0", group = "Alerts")
htf_sweeps_alerts_sweep_invalidation = input.bool(false, "Sweep Invalidation", inline = "2.0", group = "Alerts")
//#endregion
// # ========================================================================= #
// # | End |
// # ========================================================================= #
// # ========================================================================= #
// # | UDTs |
// # ========================================================================= #
//#region
type UDT_Store
line bin_ln
box bin_box
label bin_lbl
polyline bin_polyline
type UDT_Sweep
string tf
int x1
float y
int x2
bool bull
// sweep is invalidated
bool invalidated = false
// id of htf candle, that invalidated sweep
int invalidated_on
// if sweep is invalidated on candle that forms a sweep, then sweep will be removed
bool removed = false
// mark sweep as formed after last candle that forms a sweep is closed and sweep was not invalidated
bool formed = false
type UDT_HTF_Candle
int num
int index
string tf
// real coordinates of HTF candle
float o
float c
float h
float l
int o_idx
int c_idx
int h_idx
int l_idx
int ot
int ct
// position of HTF candle on chart
int candle_left
int candle_rigth
float candle_top
float candle_bottom
int wick_x
int shift
bool is_closed
array htf_sweeps
array ltf_sweeps
bool bull
bool bull_sweep
bool bear_sweep
//#endregion
// # ========================================================================= #
// # | End |
// # ========================================================================= #
// # ========================================================================= #
// # | Bin |
// # ========================================================================= #
//#region
var UDT_Store bin = UDT_Store.new(
bin_ln = array.new()
, bin_box = array.new()
, bin_lbl = array.new()
, bin_polyline = array.new()
)
method clean_bin(UDT_Store store) =>
for obj in store.bin_ln
obj.delete()
for obj in store.bin_box
obj.delete()
for obj in store.bin_lbl
obj.delete()
for obj in store.bin_polyline
obj.delete()
store.bin_ln.clear()
store.bin_box.clear()
store.bin_lbl.clear()
store.bin_polyline.clear()
//#endregion
// # ========================================================================= #
// # | End |
// # ========================================================================= #
// # ========================================================================= #
// # | Functions |
// # ========================================================================= #
//#region
method text_size(string size) =>
out = switch size
"Tiny" => size.tiny
"Small" => size.small
"Normal" => size.normal
"Large" => size.large
"Huge" => size.huge
"Auto" => size.auto
out
method line_style(string style) =>
out = switch style
'⎯⎯⎯' => line.style_solid
'----' => line.style_dashed
'····' => line.style_dotted
method font_style(string font) =>
out = switch font
'Default' => font.family_default
'Monospace' => font.family_monospace
method candle_size(string size) =>
out = switch size
'Tiny' => 2
'Small' => 4
'Medium' => 6
'Large' => 8
'Huge' => 10
out
method tf_label(string tf) =>
tfl = tf
if tfl == ''
tfl := timeframe.period
out = switch tfl
'1' => '1m'
'2' => '2m'
'3' => '3m'
'5' => '5m'
'10' => '10m'
'15' => '15m'
'20' => '20m'
'30' => '30m'
'45' => '45m'
'60' => '1H'
'90' => '90m'
'120' => '2H'
'180' => '3H'
'240' => '4H'
'480' => '8H'
'540' => '9H'
'720' => '12H'
=> tfl
out
const string default_tz = "America/New_York"
var string htf_sweeps_tz = default_tz
get_short_dayofweek(int d) =>
switch d
dayofweek.monday => 'MON'
dayofweek.tuesday => 'TUE'
dayofweek.wednesday => 'WED'
dayofweek.thursday => 'THU'
dayofweek.friday => 'FRI'
dayofweek.saturday => 'SAT'
dayofweek.sunday => 'SUN'
=> ''
get_week_of_month(int t) =>
y = year(t)
m = month(t)
d = dayofmonth(t)
// Timestamp of first day of the same month
firstDay = timestamp(y, m, 1, 0, 0)
// Day of month index starting from 0 → (0–30)
dayIndex = d - 1
// Week index starting from 0 → (0–4)
weekIndex = int(dayIndex / 7)
// Week number starting from 1 → (1–5)
str.tostring(weekIndex + 1)
get_short_month(int t) =>
var string months = array.from(
"JAN", "FEB", "MAR", "APR", "MAY", "JUN",
"JUL", "AUG", "SEP", "OCT", "NOV", "DEC")
m = month(t)
m >= 1 and m <= array.size(months) ? array.get(months, m - 1) : ""
method candle_time_label(UDT_HTF_Candle candle) =>
string lbl = ""
if timeframe.in_seconds(candle.tf) >= timeframe.in_seconds("12M")
lbl := str.format_time(candle.ot, "yyyy", htf_sweeps_tz)
else if timeframe.in_seconds(candle.tf) >= timeframe.in_seconds("1M")
lbl := get_short_month(candle.ot)
else if timeframe.in_seconds(candle.tf) >= timeframe.in_seconds("1W")
lbl := get_week_of_month(candle.ot)
else if timeframe.in_seconds(candle.tf) >= timeframe.in_seconds("1D")
// Get date components in the selected timezone
y = year(candle.ot, htf_sweeps_tz)
m = month(candle.ot, htf_sweeps_tz)
d = dayofmonth(candle.ot, htf_sweeps_tz)
// Create timestamp at noon for that date in the selected timezone (using noon to avoid timezone edge cases)
date_ts = timestamp(htf_sweeps_tz, y, m, d, 12, 0, 0)
// Add 1 day to account for timezone offset
date_ts := date_ts + 86400000
// Get day of week for that date
lbl := get_short_dayofweek(dayofweek(date_ts, htf_sweeps_tz))
else
lbl := str.format_time(candle.ot, "HH:mm", htf_sweeps_tz)
lbl
// Returns formatted remaining time until current HTF candle close.
// Format: " HH:MM:SS"
get_htf_remaining_time(int from, string tf, string ses, string tz) =>
ct = time_close(tf, ses, na(tz) ? "" : tz)
if na(ct) or na(from)
""
else
// Remaining time in ms (clamped to 0 so it never goes negative)
remaining_ms = math.max(ct - from, 0)
// Total whole seconds remaining
remaining_sec = int(remaining_ms / 1000)
// Unit constants (seconds)
sec_per_min = 60
sec_per_hour = 60 * sec_per_min
sec_per_day = 24 * sec_per_hour
sec_per_month = 30 * sec_per_day
sec_per_year = 365 * sec_per_day
// Break down into Y / M / D / H / M / S (all ints)
years = int(remaining_sec / sec_per_year)
rem_after_years = remaining_sec % sec_per_year
months = int(rem_after_years / sec_per_month)
rem_after_months = rem_after_years % sec_per_month
days = int(rem_after_months / sec_per_day)
rem_after_days = rem_after_months % sec_per_day
hours = int(rem_after_days / sec_per_hour)
rem_after_hours = rem_after_days % sec_per_hour
minutes = int(rem_after_hours / sec_per_min)
seconds = rem_after_hours % sec_per_min
// Only show non-zero units
year_str = years > 0 ? str.format("{0}Y ", str.tostring(years, "#")) : ""
month_str = months > 0 ? str.format("{0}M ", str.tostring(months, "#")) : ""
day_str = days > 0 ? str.format("{0}D ", str.tostring(days, "#")) : ""
time_str = str.format("{0}:{1}:{2}",
str.tostring(hours, "00"),
str.tostring(minutes, "00"),
str.tostring(seconds, "00"))
year_str + month_str + day_str + time_str
//#endregion
// # ========================================================================= #
// # | End |
// # ========================================================================= #
// # ========================================================================= #
// # | Variables |
// # ========================================================================= #
//#region
var ltf = timeframe.period
var htf_1_candles = array.new()
var htf_2_candles = array.new()
var htf_3_candles = array.new()
var htf_4_candles = array.new()
var htf_5_candles = array.new()
var htf_6_candles = array.new()
var htf_candle_width = candle_size(htf_sweeps_candle_width)
//#endregion
// # ========================================================================= #
// # | End |
// # ========================================================================= #
// # ========================================================================= #
// # | Alert Methods |
// # ========================================================================= #
//#region
method enable_sweep_formed_alert(UDT_Sweep sweep) =>
if not na(sweep) and htf_sweeps_alerts_sweep_formation
if not sweep.invalidated
if sweep.bull
alert(str.format("Bullish HTF Sweep ({0}) formed on {1}. Price level {2, number, currency}", tf_label(sweep.tf), syminfo.ticker, sweep.y))
else
alert(str.format("Bearish HTF Sweep ({0}) formed on {1}. Price level {2, number, currency}", tf_label(sweep.tf), syminfo.ticker, sweep.y))
sweep
method enable_sweep_invalidated_alert(UDT_Sweep sweep) =>
if not na(sweep) and htf_sweeps_alerts_sweep_invalidation
if not sweep.invalidated
if sweep.bull
alert(str.format("Bullish HTF Sweep ({0}) invalidated on {1}. Price level {2, number, currency}", tf_label(sweep.tf), syminfo.ticker, sweep.y))
else
alert(str.format("Bearish HTF Sweep ({0}) invalidated on {1}. Price level {2, number, currency}", tf_label(sweep.tf), syminfo.ticker, sweep.y))
sweep
//#endregion
// # ========================================================================= #
// # | End |
// # ========================================================================= #
// # ========================================================================= #
// # | HTF Sweeps |
// # ========================================================================= #
//#region
method session_begins(string tf, string ses, string tz) =>
ta.change(time(tf, ses, na(tz) ? "" : tz))!= 0
method in_session(string tf, string ses, string tz) =>
t = time(tf, ses, na(tz) ? "" : tz)
ct = time_close(tf, ses, na(tz) ? "" : tz)
not na(t) and not na(ct)
method position_ltf_sweeps(array htf_candles) =>
count = htf_candles.size()
if count == 1
candle = htf_candles.get(0)
for in candle.ltf_sweeps
sweep.x2 := candle.c_idx
if count >= 2
candle = htf_candles.get(1)
next_candle = htf_candles.get(0)
for in candle.ltf_sweeps
sweep.x2 := next_candle.c_idx
htf_candles
method position_htf_sweeps(array htf_candles, int buffer) =>
count = htf_candles.size()
if count > 1
c_last = htf_candles.get(0)
for in htf_candles
for in candle.htf_sweeps
sweep.x2 := c_last.candle_rigth + buffer
sweep.x1 := candle.wick_x
htf_candles
method invalidate_sweep(UDT_Sweep sweep, UDT_HTF_Candle c2) =>
c2_bull = c2.bull
// if body of next candle cross sweep
invalidated = not na(sweep.y) and (sweep.bull ? (c2_bull ? sweep.y < c2.c : sweep.y < c2.o) : (c2_bull ? sweep.y > c2.o : sweep.y > c2.c))
invalidated
method invalidate_sweeps(array htf_candles) =>
count = htf_candles.size()
if count > 1
for i = count - 1 to 1
c1 = htf_candles.get(i)
for in c1.ltf_sweeps
if not sweep.removed and na(sweep.invalidated_on)
for k = i - 1 to 0
c2 = htf_candles.get(k)
htf_sweep = c1.htf_sweeps.get(j)
invalidated = sweep.invalidate_sweep(c2)
// invalidation by candle of sweep
if sweep.x2 <= c2.c_idx and sweep.x2 > c2.o_idx
if not c2.is_closed
if not sweep.invalidated and htf_sweeps_real_time_sweep_show
sweep.enable_sweep_invalidated_alert()
sweep.invalidated := invalidated
htf_sweep.invalidated := sweep.invalidated
else
if invalidated and na(sweep.invalidated_on)
sweep.invalidated_on := invalidated ? c2.o_idx : na
htf_sweep.invalidated_on := sweep.invalidated_on
break
else if na(sweep.invalidated_on)
// invalidation by the next candle
if not c2.is_closed
if not sweep.invalidated and htf_sweeps_real_time_sweep_show
sweep.enable_sweep_invalidated_alert()
sweep.invalidated := invalidated
htf_sweep.invalidated := sweep.invalidated
else
if invalidated
if not sweep.invalidated
sweep.enable_sweep_invalidated_alert()
sweep.invalidated := invalidated
sweep.invalidated_on := invalidated ? c2.o_idx : na
htf_sweep.invalidated := sweep.invalidated
htf_sweep.invalidated_on := sweep.invalidated_on
break
// filter removed sweeps
c2 = htf_candles.get(i - 1)
if not sweep.formed and not sweep.removed
if c2.is_closed
htf_sweep = c1.htf_sweeps.get(j)
if sweep.invalidated and not na(sweep.invalidated_on)
// if sweep is invalidated on candle that forms a sweep, then sweep will be removed
if not sweep.formed
sweep.removed := true
htf_sweep.removed := true
else
// mark sweep as formed after last candle that forms a sweep is closed and sweep was not invalidated
if not sweep.formed
sweep.formed := true
htf_sweep.formed := true
htf_candles
detect_sweep(UDT_HTF_Candle c1, UDT_HTF_Candle c2) =>
c1_bull = c1.bull
c2_bull = c2.bull
bull_sweep_in_range = c2_bull ? (c1_bull ? (c2.c < c1.h) : (c2.c < c1.h)) : (c1_bull ? (c2.o < c1.h) : (c2.o < c1.h))
is_bull_sweep = c2.h > c1.h and bull_sweep_in_range
bear_sweep_in_range = c2_bull ? (c1_bull ? (c2.o > c1.l) : (c2.o > c1.l)) : (c1_bull ? (c2.c > c1.l) : (c2.c > c1.l))
is_bear_sweep = c2.l < c1.l and bear_sweep_in_range
if is_bull_sweep
if not c1.bull_sweep
htf_sweep = UDT_Sweep.new(x1=c1.h_idx, x2=c2.c_idx, y=c1.h, bull=true, tf=c1.tf)
ltf_sweep = UDT_Sweep.new(x1=c1.h_idx, x2=c2.c_idx, y=c1.h, bull=true, tf=c1.tf)
c1.htf_sweeps.push(htf_sweep)
c1.ltf_sweeps.push(ltf_sweep)
c1.bull_sweep := true
ltf_sweep.enable_sweep_formed_alert()
else if is_bear_sweep
if not c1.bear_sweep
htf_sweep = UDT_Sweep.new(x1=c1.l_idx, x2=c2.c_idx, y=c1.l, bull=false, tf=c1.tf)
ltf_sweep = UDT_Sweep.new(x1=c1.l_idx, x2=c2.c_idx, y=c1.l, bull=false, tf=c1.tf)
c1.htf_sweeps.push(htf_sweep)
c1.ltf_sweeps.push(ltf_sweep)
c1.bear_sweep := true
ltf_sweep.enable_sweep_formed_alert()
method detect_sweeps(array htf_candles) =>
count = htf_candles.size()
if count > 1
size = math.min(4, count - 1)
for i = size to 1
c1 = htf_candles.get(i)
c2 = htf_candles.get(i - 1)
if not c2.is_closed and c1.htf_sweeps.size() <= 2
detect_sweep(c1, c2)
htf_candles.position_ltf_sweeps()
htf_candles.invalidate_sweeps()
htf_candles
method draw_sweep(UDT_Sweep sweep, bool ltf) =>
if sweep.invalidated
if htf_sweeps_i_sweep_show
if ltf and htf_sweeps_i_sweep_ltf_show or not ltf and htf_sweeps_i_sweep_htf_show
if htf_sweeps_real_time_sweep_show ? true : not sweep.removed and not na(sweep.invalidated_on)
bin.bin_ln.push(line.new(x1=sweep.x1, y1=sweep.y, x2=sweep.x2, y2=sweep.y, xloc = xloc.bar_index, color = htf_sweeps_i_sweep_line_color, style = line_style(htf_sweeps_i_sweep_line_style), width = htf_sweeps_i_sweep_line_width))
else
if htf_sweeps_sweep_show
if ltf and htf_sweeps_sweep_ltf_show or not ltf and htf_sweeps_sweep_htf_show
bin.bin_ln.push(line.new(x1=sweep.x1, y1=sweep.y, x2=sweep.x2, y2=sweep.y, xloc = xloc.bar_index, color = htf_sweeps_sweep_line_color, style = line_style(htf_sweeps_sweep_line_style), width = htf_sweeps_sweep_line_width))
sweep
is_bullish_candle(float c, float o, float h, float l) =>
if c == o
math.abs(o - h) < math.abs(o - l)
else
c > o
method add_htf_candle(array htf_candles, UDT_HTF_Candle candle, int total_candles_number)=>
if not na(candle)
if htf_candles.size() >= total_candles_number
htf_candles.pop()
htf_candles.unshift(candle)
htf_candles
method detect_htf_candle(array htf_candles, string tf, string ltf) =>
UDT_HTF_Candle htf_candle = na
if session_begins(tf, "", na) or htf_candles.size()==0
UDT_HTF_Candle candle = UDT_HTF_Candle.new(tf = tf, htf_sweeps = array.new(), ltf_sweeps = array.new())
candle.o := open
candle.c := close
candle.h := high
candle.l := low
candle.o_idx := bar_index
candle.c_idx := bar_index
candle.h_idx := bar_index
candle.l_idx := bar_index
candle.ot := time
candle.bull := is_bullish_candle(candle.c, candle.o, candle.h, candle.l)
if htf_candles.size() > 0
last_candle = htf_candles.get(0)
last_candle.is_closed := true
last_candle.ct := time
htf_candle := candle
else if in_session(tf, "", na) and htf_candles.size()>0
candle = htf_candles.first()
candle.c := close
candle.c_idx := bar_index + 1
candle.ct := time
if high > candle.h
candle.h := high
candle.h_idx := bar_index
if low < candle.l
candle.l := low
candle.l_idx := bar_index
candle.bull := is_bullish_candle(candle.c, candle.o, candle.h, candle.l)
htf_candle
get_htf_candle_shift(int candle_index, int offset, int buffer, int width, int candles_amount)=>
offset + (width + buffer) * (candles_amount - candle_index - 1)
method position_htf_candle(UDT_HTF_Candle candle, int candle_index, int offset, int buffer, int width, int candles_amount) =>
candle.shift := get_htf_candle_shift(candle_index, offset, buffer, width, candles_amount)
candle.candle_left := last_bar_index + candle.shift
candle.candle_rigth := candle.candle_left + width
candle.candle_top := math.max(candle.o, candle.c)
candle.candle_bottom := math.min(candle.o, candle.c)
candle.wick_x := candle.candle_left + width/2
candle
method position_htf_candles(array htf_candles, int shift) =>
candles_amount = htf_candles.size()
for in htf_candles
candle.position_htf_candle(index, shift, htf_sweeps_space, htf_candle_width, candles_amount)
method draw_htf_candle(UDT_HTF_Candle candle) =>
candle_color = candle.bull ? htf_sweeps_bull_color : htf_sweeps_bear_color
bin.bin_box.push(box.new(left=candle.candle_left, top=candle.candle_top, right=candle.candle_rigth, bottom=candle.candle_bottom, border_color = htf_sweeps_wick_border_color, border_width = 1, bgcolor = candle_color))
bin.bin_ln.push(line.new(x1=candle.wick_x, y1=candle.h, x2=candle.wick_x, y2=candle.candle_top, color = htf_sweeps_wick_border_color))
bin.bin_ln.push(line.new(x1=candle.wick_x, y1=candle.candle_bottom, x2=candle.wick_x, y2=candle.l, color = htf_sweeps_wick_border_color))
candle
method draw_htf_label(array htf_candles, string tf) =>
float y_top = na
float y_bottom = na
int x_min = na
int x_max = na
for in htf_candles
switch htf_sweeps_label_position
"Both" =>
y_top := na(y_top) ? candle.h : math.max(y_top, candle.h)
y_bottom := na(y_bottom) ? candle.l : math.min(y_bottom, candle.l)
"Top" =>
y_top := na(y_top) ? candle.h : math.max(y_top, candle.h)
"Bottom" =>
y_bottom := na(y_bottom) ? candle.l : math.min(y_bottom, candle.l)
x_min := na(x_min) ? candle.wick_x : math.min(x_min, candle.wick_x)
x_max := na(x_max) ? candle.wick_x : math.max(x_max, candle.wick_x)
// time label for HTF candle
txt = candle.candle_time_label()
bin.bin_lbl.push(label.new(x = candle.wick_x, y = candle.l, text = txt, tooltip = str.format("HTF candle open {0}", str.format_time(candle.ot, "yyyy-MM-dd HH:mm Z", htf_sweeps_tz)), xloc=xloc.bar_index, color=color_transparent, style = label.style_label_up, textcolor = htf_sweeps_label_color, size=text_size("Tiny"), text_font_family=font_style(general_font)))
x = math.round(math.avg(x_min, x_max))
txt = tf_label(tf)
remaining_ms = get_htf_remaining_time(timenow, tf, "", na)
if not na(y_top)
bin.bin_lbl.push(label.new(x = x, y = y_top, text = txt, tooltip = str.format("HTF {0}", txt), xloc=xloc.bar_index, color=color_transparent, style=label.style_label_down, textcolor=htf_sweeps_label_color, size=text_size(htf_sweeps_label_size), text_font_family=font_style(general_font)))
bin.bin_lbl.push(label.new(x = x, y = y_top, text = remaining_ms, tooltip = str.format("Time remaining until active HTF candle close {0}", remaining_ms), xloc=xloc.bar_index, color=color_transparent, style=label.style_label_down, textcolor=htf_sweeps_label_color, size=text_size("Tiny"), text_font_family=font_style(general_font)))
if not na(y_bottom)
bin.bin_lbl.push(label.new(x = x, y = y_bottom, text = txt, tooltip = str.format("HTF {0}", txt), xloc=xloc.bar_index, color=color_transparent, style=label.style_label_up, textcolor=htf_sweeps_label_color, size=text_size(htf_sweeps_label_size), text_font_family=font_style(general_font)))
// if htf_sweeps_bias_show and htf_candles.size() > 1
// c1 = htf_candles.get(0)
// c2 = htf_candles.get(1)
// bullish = c1.h > c2.h and c1.l > c2.l
// bearish = c1.h < c2.h and c1.l < c2.l
// bin.bin_lbl.push(label.new(x = x, y = na(y_top) ? y_bottom : y_top, text = " ", xloc=xloc.bar_index, color = bullish ? htf_sweeps_bias_bull_color : htf_sweeps_bias_bear_color, style = bullish ? label.style_arrowup : label.style_arrowdown, size = size.normal))
htf_candles
method draw_ltf_open_close_line(UDT_HTF_Candle candle) =>
y1 = math.min(candle.o, candle.c)
y2 = math.max(candle.c, candle.o)
bin.bin_ln.push(line.new(x1=candle.ot, y1=y1, x2=candle.ot, y2=y2, xloc = xloc.bar_time, extend = extend.both, color = htf_sweeps_ltf_trace_o_c_line_color, style = line_style(htf_sweeps_ltf_trace_o_c_line_style), width = htf_sweeps_ltf_trace_o_c_line_width))
candle
method draw_ltf_high_line(UDT_HTF_Candle candle) =>
bin.bin_ln.push(line.new(x1=candle.ot, y1=candle.h, x2=candle.ct, y2=candle.h, xloc = xloc.bar_time, extend = extend.none, color = htf_sweeps_ltf_trace_h_l_color, style = line_style(htf_sweeps_ltf_trace_h_l_style), width = htf_sweeps_ltf_trace_h_l_width))
candle
method draw_ltf_low_line(UDT_HTF_Candle candle) =>
bin.bin_ln.push(line.new(x1=candle.ot, y1=candle.l, x2=candle.ct, y2=candle.l, xloc = xloc.bar_time, extend = extend.none, color = htf_sweeps_ltf_trace_h_l_color, style = line_style(htf_sweeps_ltf_trace_h_l_style), width = htf_sweeps_ltf_trace_h_l_width))
candle
method plot_ltf(array htf_candles) =>
for in htf_candles
if htf_sweeps_ltf_trace_o_c_line_show
candle.draw_ltf_open_close_line()
if htf_sweeps_ltf_trace_h_l_show
candle.draw_ltf_high_line()
candle.draw_ltf_low_line()
for in candle.ltf_sweeps
ltf_sweep.draw_sweep(true)
htf_candles
method plot_htf(array htf_candles, string tf, bool ltf_map) =>
htf_candles.position_htf_sweeps(htf_sweeps_space)
for in htf_candles
candle.draw_htf_candle()
for in candle.htf_sweeps
htf_sweep.draw_sweep(false)
if htf_sweeps_label_show
htf_candles.draw_htf_label(tf)
if ltf_map
htf_candles.plot_ltf()
htf_candles
//#endregion
// # ========================================================================= #
// # | End |
// # ========================================================================= #
// # ========================================================================= #
// # | Plotting |
// # ========================================================================= #
//#region
bin.clean_bin()
var tf_1_show = htf_sweeps_tf_1_show and timeframe.in_seconds(timeframe.period) < timeframe.in_seconds(htf_sweeps_tf_1_tf)
var tf_2_show = htf_sweeps_tf_2_show and timeframe.in_seconds(timeframe.period) < timeframe.in_seconds(htf_sweeps_tf_2_tf)
var tf_3_show = htf_sweeps_tf_3_show and timeframe.in_seconds(timeframe.period) < timeframe.in_seconds(htf_sweeps_tf_3_tf)
var tf_4_show = htf_sweeps_tf_4_show and timeframe.in_seconds(timeframe.period) < timeframe.in_seconds(htf_sweeps_tf_4_tf)
var tf_5_show = htf_sweeps_tf_5_show and timeframe.in_seconds(timeframe.period) < timeframe.in_seconds(htf_sweeps_tf_5_tf)
var tf_6_show = htf_sweeps_tf_6_show and timeframe.in_seconds(timeframe.period) < timeframe.in_seconds(htf_sweeps_tf_6_tf)
if tf_1_show
htf_1_candle = htf_1_candles.detect_htf_candle(htf_sweeps_tf_1_tf, ltf)
htf_1_candles.add_htf_candle(htf_1_candle, htf_sweeps_tf_1_number)
htf_1_candles.detect_sweeps()
if tf_2_show
htf_2_candle = htf_2_candles.detect_htf_candle(htf_sweeps_tf_2_tf, ltf)
htf_2_candles.add_htf_candle(htf_2_candle, htf_sweeps_tf_2_number)
htf_2_candles.detect_sweeps()
if tf_3_show
htf_3_candle = htf_3_candles.detect_htf_candle(htf_sweeps_tf_3_tf, ltf)
htf_3_candles.add_htf_candle(htf_3_candle, htf_sweeps_tf_3_number)
htf_3_candles.detect_sweeps()
if tf_4_show
htf_4_candle = htf_4_candles.detect_htf_candle(htf_sweeps_tf_4_tf, ltf)
htf_4_candles.add_htf_candle(htf_4_candle, htf_sweeps_tf_4_number)
htf_4_candles.detect_sweeps()
if tf_5_show
htf_5_candle = htf_5_candles.detect_htf_candle(htf_sweeps_tf_5_tf, ltf)
htf_5_candles.add_htf_candle(htf_5_candle, htf_sweeps_tf_5_number)
htf_5_candles.detect_sweeps()
if tf_6_show
htf_6_candle = htf_6_candles.detect_htf_candle(htf_sweeps_tf_6_tf, ltf)
htf_6_candles.add_htf_candle(htf_6_candle, htf_sweeps_tf_6_number)
htf_6_candles.detect_sweeps()
if barstate.islast
offset = htf_sweeps_offset
if tf_1_show
htf_1_candles.position_htf_candles(offset)
htf_1_candles.plot_htf(htf_sweeps_tf_1_tf, htf_sweeps_tf_1_map)
offset += get_htf_candle_shift(0, htf_sweeps_margin, htf_sweeps_space, htf_candle_width, htf_sweeps_tf_1_number)
if tf_2_show
htf_2_candles.position_htf_candles(offset)
htf_2_candles.plot_htf(htf_sweeps_tf_2_tf, htf_sweeps_tf_2_map)
offset += get_htf_candle_shift(0, htf_sweeps_margin, htf_sweeps_space, htf_candle_width, htf_sweeps_tf_2_number)
if tf_3_show
htf_3_candles.position_htf_candles(offset)
htf_3_candles.plot_htf(htf_sweeps_tf_3_tf, htf_sweeps_tf_3_map)
offset += get_htf_candle_shift(0, htf_sweeps_margin, htf_sweeps_space, htf_candle_width, htf_sweeps_tf_3_number)
if tf_4_show
htf_4_candles.position_htf_candles(offset)
htf_4_candles.plot_htf(htf_sweeps_tf_4_tf, htf_sweeps_tf_4_map)
offset += get_htf_candle_shift(0, htf_sweeps_margin, htf_sweeps_space, htf_candle_width, htf_sweeps_tf_4_number)
if tf_5_show
htf_5_candles.position_htf_candles(offset)
htf_5_candles.plot_htf(htf_sweeps_tf_5_tf, htf_sweeps_tf_5_map)
offset += get_htf_candle_shift(0, htf_sweeps_margin, htf_sweeps_space, htf_candle_width, htf_sweeps_tf_5_number)
if tf_6_show
htf_6_candles.position_htf_candles(offset)
htf_6_candles.plot_htf(htf_sweeps_tf_6_tf, htf_sweeps_tf_6_map)
//#endregion
// # ========================================================================= #
// # | End |
// # ========================================================================= #
// # ========================================================================= #
// # | Brand |
// # ========================================================================= #
//#region
if barstate.isfirst and general_brand_show == false
var table brand = table.new(position.bottom_right, 1, 1, bgcolor = chart.bg_color)
table.cell(brand, 0, 0, "© CandelaCharts", text_color = colors_gray, text_halign = text.align_center, text_size = text_size(general_text), text_font_family = font_style(general_font))
//#endregion
// # ========================================================================= #
// # | End |
// # ========================================================================= #
GAYBEAR SWING Clean v6 mobile-safeHow to Use Sniper Swing — Clean v6 (Mobile-Safe)
Purpose
Sniper Swing — Clean v6 is a trend-aligned swing indicator designed to help traders identify high-probability entries and exits while minimizing noise. It works best in trending or gently rotating markets and is optimized for mobile charting.
A. Chart Setup
Recommended:
Timeframes: 5m–1h for active trading, 4h–Daily for swing trading
Instruments: Liquid equities, indices, and major ETFs
The indicator plots:
SMA 9 (entry trigger)
EMA 20 (trend and momentum)
Optional SMA 50 (higher-timeframe bias)
B. Buy (Long) Signal — How to Act
A BUY label appears when price reclaims short-term structure.
How to trade it:
Wait for price to cross above the SMA 9
Confirm EMA 20 is rising (and above SMA 50 if enabled)
Optional: Confirm price is closing above EMA 20
Enter on:
The close of the signal candle, or
A minor pullback that holds above SMA 9
Best context:
Higher lows
EMA 20 sloping upward
RSI not overbought
C. Sell / Short Signal — How to Act
The indicator offers two sell modes:
1) CrossUnder SMA 9 (Fast Exit)
Use in strong trends or fast markets
Exit longs or enter shorts when price loses SMA 9
2) AccuSell (Structure-Based)
Use in choppy or topping markets
Requires:
Loss of SMA 9 plus
Structural weakness (lower highs/lows, RSI < 50, or EMA 20 turning down)
How to trade it:
Exit longs when sell label appears
Aggressive traders may enter short positions
Conservative traders wait for follow-through
D. RSI Arrows — Context Only
OB arrows warn of potential exhaustion
OS arrows suggest relief or bounce zones
RSI does not trigger trades — it informs patience and risk
E. Position Coloring & State
Green candles = long bias
Purple candles = short bias
Background tint reinforces short exposure
Coloring persists until the opposite signal prints
This helps visually manage trades without staring at labels.
F. Risk Management (User-Defined)
The indicator does not manage stops or targets.
Common approaches:
Stop below recent swing low (longs)
Stop above recent swing high (shorts)
Scale partials near RSI OB/OS zones
G. When Not to Use It
Extremely low-volume chop
News-driven spikes
Range-bound micro consolidations
2. Explain It Like You’re 10 👶📈
Imagine the chart is a road, and the price is a car.
🟢 Green = Go
When the car drives above the yellow line, that means it’s probably going up.
The indicator says:
“Okay, the car looks like it wants to go forward. You can hop in.”
That’s a BUY.
🟣 Purple = Uh-Oh
When the car falls below the yellow line, it might start going down.
The indicator says:
“Careful… the car is slowing down or turning around.”
That’s a SELL.
🔵 Blue Line = Wind Direction
The blue line shows which way the wind is blowing.
If the wind blows up → going up is easier
If the wind blows down → going down is easier
You want to go with the wind, not fight it.
🔺 Red & Green Arrows = Too Fast / Too Slow
Red arrow = “The car is going too fast, might need a break”
Green arrow = “The car is tired, might bounce”
They don’t tell you to go or stop — they just say “pay attention.”
🎨 Colors Help You Remember
Green bars = you’re riding up
Purple bars = you’re riding down
Gray = nothing exciting happening
🚨 Important Rule
This tool doesn’t drive the car for you.
It just says:
“Now might be a good time.”
You still decide when to get in and when to get out
LSDE Zones PRO v2 | Enhanced SMCLSDE Zones PRO v2 | Enhanced SMC
Professional Smart Money Concepts (SMC) toolkit designed for institutional-level price action trading with automated zone management and real-time market structure analysis.
LSDE Zones PRO v2 addresses a critical challenge faced by price action traders: simultaneously tracking multiple institutional concepts (liquidity, market structure, order flow zones) while filtering high-probability setups in real-time. Rather than using these SMC elements in isolation, this indicator integrates them into a cohesive framework that reveals institutional footprints and trade entry zones.
Core Integration & Unique Implementation
Liquidity Sweep Detection with Anti-Spam Logic:
Unlike basic liquidity plotters, this system tracks equal highs/lows within a dynamic lookback period and detects actual sweeps using wick-to-body ratio analysis (default 30% threshold). The anti-spam cooldown (minimum 3-bar spacing) prevents false positives during choppy markets. When price sweeps liquidity then reverses with conviction, it signals institutional stop-hunts—a key SMC principle often missed by manual analysis.
Multi-Confirmation Market Structure (MSS & BOS):
Market structure detection uses a confirmation bar system (default 2 bars) to avoid premature signals. MSS (structure shift) requires sustained breaks with optional volume validation (1.5x average), while BOS (continuation) uses a 5-bar cooldown to prevent label spam. This dual-layer confirmation reduces false breaks common in standard pivot-based systems.
Volume-Filtered Fair Value Gaps (FVG):
FVGs are detected using 3-candle gap analysis with mandatory volume confirmation (1.2x average) and body percentage filters (>50% body-to-range ratio). The auto-mitigation feature tracks when price fills gaps, converting them to invalidated zones (gray). Maximum active FVG limit (user-defined, default 20) ensures chart clarity. This filtering separates institutional imbalances from noise—critical since not all gaps are tradeable.
Enhanced Order Blocks with Breaker Logic:
Order blocks detect the last opposing candle before strong directional moves (1.5x body size increase, >60% body percentage, high volume). When an OB is broken, it automatically converts to a Breaker Block—a reversal zone where institutional orders flip. This dynamic transformation (OB → Breaker) isn't available in standard OB indicators and provides counter-trend entry opportunities.
Displacement Detection:
Identifies explosive candle moves (2x average range, >70% body, high volume) that signal institutional positioning. These "displacement candles" often precede FVG creation and order block formation—providing early warnings of trend shifts.
Dynamic Premium/Discount Zones:
Unlike static Fibonacci tools, this system updates ranges every candle based on swing highs/lows within a lookback period (default 100 bars). Zones reset per session/daily/weekly (user-selectable) and automatically expand when new highs/lows form. The 25%/50%/75% levels act as institutional value areas—premium zones for sells, discount for buys.
Session-Aware Architecture:
Tracks London/NY/Asian sessions with automatic high/low marking and session labels. Combined with PDH/PDL (Previous Day High/Low) levels, this creates a time-based context layer. Institutional activity patterns differ by session—London for liquidity sweeps, NY for breakouts—making session filtering essential for SMC accuracy.
Comprehensive Statistics Dashboard:
Real-time table displays active trend, current zone (premium/discount/equilibrium), session status, active FVG/OB count, and volume conditions. This at-a-glance analysis prevents information overload while maintaining full situational awareness.
Why This Combination Matters
SMC trading requires tracking 5+ concepts simultaneously (liquidity, structure, zones, volume, sessions). Manual analysis leads to missed setups or analysis paralysis. This indicator synthesizes these elements into actionable signals—liquidity sweeps near discount OBs in high-volume sessions become high-probability reversal setups. The auto-mitigation and breaker conversion reduce monitoring overhead, letting traders focus on execution.
Usage: Optimized for 1-15 minute charts on forex, indices, and crypto. All features toggleable for strategy customization.
Disclaimer: This is an analytical and educational tool; all trading involves risk and should be based on individual analysis.
ST Order Block EngineAdvanced order block detection based on displacement and structural validation.
Asia/London 2026 HI/LO Trading Strategy Application
Asia Range: Often serves as the "accumulation" phase. Look for New York to sweep the Asia High/Low before a trend reversal.
London High/Low: These often form the "High or Low of the Day" (HOD/LOD). Using these rays helps you stay on the right side of the daily bias.
Defect Warrior Premium: Non-Engulf Signal + MTF Bias + Plan & DaOverview
Defect Warrior Premium is a closed-source indicator that generates confirmed buy/sell signals on a selected signal timeframe (default: H1) and provides an integrated trade plan (Entry/SL/TP) plus a monthly points dashboard.
It is designed to reduce noisy signals by combining a proprietary “non-engulf” candle condition with multi-timeframe bias, adaptive VIDYA bands, and supply/demand proximity.
Core Concept (How it works)
This script builds a signal only when all layers align:
Defect Candle Condition (Signal TF)
Candle body ratio must be within a defined range.
Candle must be non-engulfing vs the previous candle (the body does not fully cover the previous body range).
Direction is based on candle close vs open (bull/bear).
Market Bias Filters (Optional)
MTF EMA bias: price vs EMA on higher timeframes (HTF1/HTF2).
VIDYA bias: adaptive VIDYA trend state (price relative to VIDYA) with dynamic band width (ATR/Stdev).
Supply/Demand Zone Proximity (Optional)
Demand/Supply zones are derived from pivot structure on the signal timeframe.
Entry is allowed only when price is near the relevant zone using a proximity buffer (Points or ATR-multiple).
Confirmed & De-duplicated Signals
Signals can be restricted to signal-timeframe bar close (non-repainting execution style).
Includes protection against repeated alerts when Signal TF ≠ chart TF (one signal per new Signal TF bar).
Trade Plan (Entry / SL / TP)
When a signal triggers, the script can plot a plan with:
Entry: Close or Mid-Body
Stop-loss modes: Candle-based / Zone-based / ATR-multiple / Fixed points / Fixed %
Take-profit targets: TP1/TP2/TP3 using configurable risk-reward (R:R) multipliers
Visual plan lines and a compact plan card label (Entry/SL/TP + R:R)
Dashboard (Monthly, Points-based, Net PnL)
The OrcaTrade Dashboard tracks monthly performance in points:
A trade is counted only after price touches the Entry.
A “Win” is counted only when price touches TP1 after Entry has been touched.
Net PnL is calculated in points and deducts SL hits (wins are not reduced by SL logic).
Point conversion is configurable (Point Value).
Alerts & Automation
Built-in alert conditions for confirmed BUY/SELL.
Optional JSON alert output for automation workflows (e.g., webhooks / scripts).
How to use
Apply on any chart timeframe. Set Signal TF (default H1).
Keep the chart clean and use the plan labels/lines to understand Entry/SL/TP.
Enable/disable filters (Zones, EMA bias, VIDYA bias) depending on your market and risk preference.
Notes & Limitations
This is an analytical tool, not financial advice.
Signals are based on candle/structure confirmation; fast news spikes may cause slippage-like behavior on back-analysis.
Zone proximity is pivot-based and depends on historical swing structure.
Thuan_Bot_Scap_V6_Standard_LogicRieng Tu khong chia se ra ngoai
do toi viet qua ngan hay sao ma nó ko cho public
BreakoutRhythmFXBreakoutRhythmFX (BRFX)
=========================
## 📊 Capture the Rhythm of the Market
**BreakoutRhythmFX (BRFX)** is a sophisticated volatility-based trading system designed to dominate **Opening Range Breakouts**. Unlike standard ORB indicators, BRFX integrates a **Quality Grade Algorithm**, **Multi-Session Logic**, and a **Dynamic Balance Point** to filter out false breakouts and identify high-probability momentum moves.
Whether you are trading **XAUUSD (Gold), Indices (US30/NAS100), or Forex**, BRFX helps you visualize the market's daily "rhythm" by defining key volatility boxes and projecting Fibonacci-based targets.
---
## 🌟 Key Features
### 1. 🧠 Algorithmic Quality Grading (The 6-Star System)
Stop taking blind breakouts. Every signal is automatically analyzed and graded from **0 to 6 Stars** based on six confluence factors. The higher the grade, the stronger the probability.
* **MA Alignment:** Is price trending above/below the Session Moving Average?
* **DBP Alignment:** Is price on the correct side of the Dynamic Balance Point?
* **Volume Surge:** Is there a sudden influx of volume (>1.2x average)?
* **Range Stability:** Is the Opening Range tight enough (ATR check) to allow expansion?
* **Candle Strength:** Is the breakout candle a solid body or just a wick?
* **RSI Confluence:** Momentum confirmation (avoiding overbought/oversold traps).
### 2. 🕒 Multi-Session Architecture
Trade multiple sessions in a single day without changing settings.
* **Primary Custom Session:** (e.g., London Open).
* **Secondary & Tertiary Sessions:** (e.g., NY Open, Tokyo Open).
* **Priority Logic:** Intelligent handling of overlapping sessions to minimize chart clutter.
### 3. 🎯 Fibonacci Expansion Targets
Automatically projects Take Profit levels based on the width of the Opening Range.
* **TP 1-5:** Uses Fibonacci expansions (1.618, 2.618, etc.) to predict exhaustion points.
* **Dynamic RR:** Displays Risk-to-Reward ratios for every target.
### 4. ⚖️ Dynamic Balance Point (DBP)
A higher-timeframe trend filter that keeps you on the right side of the market.
* **Modes:** Scalping, Day Trading, Swing, or Manual.
* **Logic:** Acts as a "Line in the Sand". If Price > DBP, focus on Buy Breakouts.
### 5. 🛡️ Strategic Stop Levels
Includes calculation for "Stop-to-Buy" and "Stop-to-Sell" zones, providing logical invalidation points for your trades or areas for reversal entries.
### 6. 📉 Statistical Intelligence Panel
A dashboard that tells you the bias of the day at a glance.
* **Volatility Stats:** Are we in a compression or expansion phase?
* **Directional Hit Rate:** Historical tracking of breakout directions.
* **Range Analysis:** Measures the Opening Range in Pips/Points.
---
## 🛠️ How to Trade with BRFX
1. **Wait for the Box:** Allow the Opening Range (e.g., first 1 hour) to form.
2. **Check the Grade:** When a **▲ Breakout Signal** appears, look at the star rating.
* **1-3 Stars:** Risky / Contra-trend. Use caution.
* **4-6 Stars:** High Probability / Confluence. "Grade A" Setup.
3. **Confirm with DBP:** Ideally, a Buy Breakout should be above the Gray/Green DBP line.
4. **Execute & Target:** Entering at the breakout, target TP1 or TP2. If Momentum is strong (Volume Surge), trail to TP3.
---
## ⚙️ Configuration
* **Customization:** Fully customizable colors, line styles, and session times.
* **Timezones:** Supports UTC offsets to match your server time.
* **Asset Optimized:** Includes specific Pip calculation adjustments for Gold (XAU) vs JPY vs Standard Forex.
---
**Disclaimer:**
*This indicator is for educational purposes only. Past performance (Quality Grades/Stats) does not guarantee future results. Always use proper risk management.*
IBPDA Time Markers Daily OnlyThis indicator plots IBPDA (Interbank Price Delivery Algorithm) time markers based on true bar counts, not calendar days.
Unlike many time-cycle tools that rely on calendar arithmetic, this script calculates 20 / 40 / 60 daily candles, ensuring accuracy across:
market holidays
shortened sessions
exchange-specific trading calendars
It is intentionally restricted to the Daily timeframe, where each bar represents one completed trading session.
🔍 What This Indicator Does
Draws vertical lines at:
−20 / −40 / −60 bars (exact historical daily candles)
+20 / +40 / +60 bars (future projections for planning)
Uses bar index–based logic, not calendar dates
Prevents misuse by enforcing Daily timeframe only
Draws lines once per chart load to avoid clutter and object limits
⚙️ Key Design Choices (Important)
Past markers are exact
Past levels use time , which means “n completed daily sessions ago” — no approximation.
Future markers are projected
Since future bars do not exist yet, forward levels are projected using a configurable day-step. These are meant for time-window awareness, not precision forecasting.
No repainting
All levels are fixed once drawn.
🧠 How to Use (Best Practice)
IBPDA time levels are time magnets, not trade signals.
They work best when combined with:
Higher-timeframe PD arrays (weekly/monthly highs & lows)
Fair Value Gaps (FVGs)
Liquidity pools
Market structure shifts
Watch for price expansion, liquidity events, or displacement occurring near these time markers.
🛑 Limitations (By Design)
Daily timeframe only
Future levels are projections (exchange calendars cannot be predicted perfectly)
This script does not generate buy/sell signals
🎯 Intended Audience
This indicator is designed for:
ICT / SMC traders
Index futures traders (NQ, ES, YM, etc.)
Swing traders and position traders
Traders who respect time as a variable, not just price
🧩 Notes
Best used as a contextual framework, not a standalone strategy
Clean, lightweight, and safe for long-term chart usage
Built with strict Pine Script v5 compatibility and publishing standards
Titan Command: Macro-Quant Sniper EngineTITAN COMMAND: Macro-Quant Sniper Engine
==========================================
## ⚔️ Institutional Intelligence for the Retail Trader
**Titan Command** is not just an indicator; it is a comprehensive **Algorithmic Trading Operating System** designed to bridge the gap between retail technical analysis and institutional global macro strategies.
Built on the philosophy that *"Price is the slave of Macroeconomics"*, this engine fuses real-time economic data (Yields, DXY, VIX) with advanced quantitative statistics (Z-Scores, Bayesian Probability) to deliver high-precision execution on lower timeframes (specifically optimized for **XAUUSD M5**).
---
## 🧠 The 4-Pillar Architecture
This script operates like a virtual "Hedge Fund Team" inside your chart, consisting of four distinct logic engines that run simultaneously:
### 1. 🌐 The Macro Analyst (Regime Filter)
It doesn't just look at the chart. It "steps out" to analyze the global money flow in real-time.
* **Data Fusion:** Monitors **US10Y** (Bond Yields), **DXY** (Dollar Strength), **VIX** (Fear Index), and **SPX** (Risk Sentiment).
* **Logic:** Detects "Risk-On" vs "Risk-Off" regimes. If Global Macro dictates that Gold should fall (e.g., Yields spiking), the system blocks Buy signals to prevent "Bull Traps".
### 2. 🧮 The Quant Engine (Statistical Core)
Opinions are replaced by math.
* **Z-Score Normalization:** Normalizes price and volume data to detect statistical anomalies (>2 Sigma events).
* **Bayesian Probability:** Calculates a real-time **Confidence Score (0-100%)** based on available evidence. Only setups with high statistical probability trigger a signal.
### 3. 🛡️ The Risk Manager (Capital Protection)
Your safety net against market chaos.
* **Volatility Targeting:** Automatically calculates position size recommendations based on current market volatility (ATR).
* *Calm Market:* Normal Risk.
* *Chaos/News:* Reduces risk to ~0.5% automatically.
* **Smart Take Profit:** Projects dynamic targets based on volatility and quantitative price projection models.
### 4. 🎯 The Sniper (Execution & Timing)
The trigger puller. Once Macro and Quant give the "All Clear", this engine hunts for millisecond-perfect entries.
* **VPA 2.0 (Volume Price Analysis):** Distinguishes between **Ignition** (True Moves) and **Churn** (Manipulation).
* **Advanced Divergence Engine:** Detects both **Regular** (Reversal) and **Hidden** (Continuation) divergences with a "Smart Memory" window to sync with entry signals.
---
## 📖 Visual Legend (How to Trade)
The chart is annotated with "Institutional Footprints" to guide your decisions:
### 🚦 Signal Triggers
* 🚀 **IGNITION / BUY**: A high-confidence trend start. Supported by "Ignition Volume" and Macro confirmation.
* *Action:* **ENTRY BUY**.
* ⚡ **DIV+ SELL**: A confirmed reversal short. Supported by structural weakness and bearish divergence.
* *Action:* **ENTRY SELL**.
### 🔍 Market Structure (Divergence)
* 💎 **BULLISH DIV (Diamond):** Price making lower lows while momentum rises. Represents "Value/Discount".
* *Context:* Watch for Buy setups.
* 💣 **BEARISH DIV (Bomb):** Price making higher highs while momentum fades. Represents "Danger/Top".
* *Context:* Tighten stops on Longs, prepare to Short.
### 📊 Volume Events
* 💥 **CLIMAX:** Massive volume with little price progress. Sign of exhaustion.
* *Action:* **TAKE PROFIT**.
* 🌀 **CHURN:** Confusing volume activity (High Effort / Low Result).
* *Action:* **WAIT & SEE**.
---
## ⚙️ Key Features
* **Dynamic Dashboard:** Displays Macro Status, Confidence Score, Rec. Risk, and key levels.
* **Session Filters:** Enhances signals during London/NY "Kill Zones".
* **Risk Regimes:** Background color adapts to visualize market sentiment (Green=Risk-On, Red=Risk-Off).
## ⚠️ Disclaimer
*This tool is for educational and analytical purposes only. Trading financial markets involves significant risk. The "Confidence Score" is a statistical probability derived from past data, not a guarantee of future performance. Always use proper risk management.*
RICH SCANNER PRO this scanner for rich club only not for everyone.
Rich Scanner is an intelligent market scanning and analysis system, designed to help traders identify the highest-probability trading opportunities with speed and precision.
It relies on advanced analytical algorithms that automatically filter the market to deliver clear, data-driven signals — with no randomness or guesswork.
🚀 What does Rich Scanner offer?
🔍 Real-time market scanning to detect strong opportunities
🎯 Precise entry and exit signals with built-in risk filtering
⏱️ Support for multiple timeframes and different trading styles
📊 Suitable for Scalping, Intraday, and Swing Trading
🧠 Reduced noise and confusion, turning analysis into clear decisions
💎 Why Rich Scanner?
Because it doesn’t just display data — it transforms data into executable opportunities, giving you a clearer market perspective and helping you trade with confidence and discipline.
Rich Scanner — Trade Smarter, Decide Clearer, Achieve Stronger Results. 📈✨
Apollo Volume Candles [ArdiNSC]Apollo Volume Candles
Volume tells the truth. This indicator puts that truth directly on your candles.
───────────────────────────────
The Problem
Standard candles treat all moves equally. A breakout on 3x average volume looks identical to one on 0.3x volume. But they're not the same — one has conviction, the other is noise.
───────────────────────────────
The Solution
Apollo Volume Candles colors your candles by relative volume intensity:
Bright candles = High volume (real participation)
Normal candles = Average volume
Faded candles = Low volume (weak conviction)
One glance tells you whether a move matters.
───────────────────────────────
Key Features
Volume-Weighted Candle Coloring
Candles automatically adjust opacity based on relative volume. No extra indicators cluttering your chart — the information is embedded in the price action itself.
Exhaustion Detection
When consecutive bars print climactic volume (3x+ average), a small marker appears warning of potential exhaustion. These clusters often occur at blow-off tops and capitulation bottoms.
Relative Volume Dashboard
Clean panel showing current and previous bar volume ratios, status classification, and active signals.
Additional Markers (Optional)
- Confirmed breakout detection with volume + structure filters
- Single climactic volume bar flags
- Volume dry-up zones (compression before expansion)
All optional markers are off by default for a clean chart.
───────────────────────────────
Volume Classifications
≥ 3.0x average → Climactic → Bright + potential exhaustion
≥ 1.5x average → High → Bright
0.4x - 1.5x → Normal → Standard opacity
< 0.4x average → Low → Faded
───────────────────────────────
Practical Use
Filtering breakouts — A bright candle breaking resistance has real participation behind it. A faded candle breaking the same level is suspect.
Spotting reversals — Consecutive climactic volume bars after an extended move often mark exhaustion — the final push before reversal.
Reading consolidation — Faded candles during ranges show decreasing participation. When volume returns, direction is chosen.
───────────────────────────────
Settings
- Adjustable volume lookback and thresholds
- Multiple averaging methods (SMA/EMA/RMA)
- Toggle individual markers
- Customizable colors
- Movable dashboard
───────────────────────────────
Note
Requires volume data. Works best on liquid markets with consistent volume reporting.
───────────────────────────────
Part of the Apollo Trading indicator suite.
Asian Range & ICT KillzonesThis indicator was created to support my own trading by making ICT kill zones easy to identify at a glance, while clearly highlighting the Asian range highs and lows when price transitions into those kill zones for potential trade opportunities. It is designed purely as a visual aid and trading tool. I am not responsible for any errors, malfunctions, or inaccuracies within the indicator, nor for any financial decisions, losses, or outcomes resulting from its use. Use at your own risk.
Cheers, Elias G.






















