XenoSmooth Predictive Candles - Advanced Heikin Ashi CandlesXenoSmooth Predictive Candles
Summary in one paragraph
A synthetic candle engine for crypto, FX, equities, and futures on intraday to swing timeframes. It reduces noise and flip delay so structure is easier to read. The core novelty is a predictive open with inertia plus slope lead fused with a zero lag body filter and an overshoot based wick model normalized by the real range and capped by ATR. Add it to a clean chart, hide regular candles if desired, and tune lengths. Shapes can move while the bar is open and settle on close. For conservative workflows read on bar close.
Scope and intent
• Markets. Major FX pairs, index futures, large cap equities, liquid crypto
• Timeframes. One minute to daily
• Purpose. Faster and smoother visual structure than Heikin Ashi while keeping causality and realistic wicks
Originality and usefulness
• Unique concept. Predictive open with inertia and slope lead plus selectable zero lag body filter and ATR capped wick overshoot in percent of real range
• Failure mode addressed. Late flips in chop and unreal long wicks from raw extremes
• Testability. Every control is an input. Users can toggle body method, lengths, clipping, and percent modeling
• Portable yardstick. ATR based wick cap and percent of bar range scale across symbols
Method overview in plain language
Build a robust base price from O, H, L, and extra weight on Close. Smooth it with a chosen filter to produce the synthetic close. Drive a predictive open that follows the synthetic close with tunable inertia and a small lead from the last bar slope. Model wicks as the portion of the real extremes that extends beyond the synthetic body, smooth that overshoot, normalize by the bar range if selected, then cap by ATR to avoid tail spikes. Clamp synthetic values to the real high and low if enabled.
Base measures
• Range basis. True Range for the ATR cap and High minus Low for percent normalization
• Return basis. Not used
Components
• Body Base Blend. Weighted O H L with a close bias to stabilize the base
• Zero Lag Body Filter. ZLEMA or Super Smoother or WMA to set the synthetic close
• Predictive Open. Inertial follow of the synthetic close plus a slope lead term
• Wick Overshoot Model. Smoothed extension beyond the body, optional percent of real range, ATR cap
• Clamp Option. Keeps synthetic open and close inside the real bar range
Fusion rule
• Synthetic close equals filtered base
• Synthetic open equals previous open plus inertia times distance to synthetic close plus slope lead
• Wicks equal smoothed overshoot above and below the body, optionally percent of range then converted back to price and capped by ATR
Inputs with guidance
Setup
• Signal timeframe. Uses the chart timeframe
• Invert direction. Not applicable
• Session windows. Not applicable
Logic
• Body length. Core smoothing length for the synthetic close. Typical 6 to 14. Higher gives smoother and slower. Lower gives faster flips
• Body method. ZLEMA or Super Smoother or WMA. ZLEMA is fastest. Super Smoother is calmest
• Close weight in base. 0 to 1. Higher gives stronger emphasis on close and less noise
• Open inertia. 0 to 1. Higher makes the open follow the close more tightly
• Lead gain. 0 to 1. Higher adds more phase lead. Keep modest to avoid overshoot
• Clamp body to real range. On keeps synthetic body inside high and low
• Wick smooth length. Typical 4 to 10. Higher reduces jitter
• Overshoot as percent. On stabilizes wicks across regimes
• ATR length. Typical 10 to 20 for the cap
• Max wick equals ATR times. 0 disables. 1.0 to 2.0 contains extreme tails
Filters
• Efficiency or trend filter. Not used
• Micro versus macro range relation. Not used
• Location filter. Not used
Realism and responsible publication
• No performance claims
• Intrabar motion reminder. Shapes can move while a bar forms and settle on close
• Strategies must use standard candles for signals and orders
Honest limitations and failure modes
• High impact releases and thin liquidity can distort wicks and produce gaps that any smoother cannot predict
• Very quiet regimes can reduce contrast. Consider longer body length
• Session time on the chart controls the definition of each bar
Chart patterns
Improved ICT MultiTF A+ IndicatorThis indicator provides ICT-style multi time frame fair value gaps with a 4-hour moving average bias. It prioritizes 15-minute gaps and falls back to 5-minute and 1-minute gaps when none are present. It also includes alert conditions for long and short signals based on session filters and bias.
Anthony CVD SMTCVD SMT indicator helps visualize the relationship between price swings and Cumulative Volume Delta (CVD) swings to identify potential momentum divergences.
Overview
This script compares recent swing highs and lows in price against corresponding swings in the CVD to highlight where price action and volume flow may differ.
It draws lines between swing points and optionally displays simple text labels for context.
Features
Adjustable swing length for sensitivity control
Optional custom lower-timeframe aggregation for CVD calculation
User-defined bullish and bearish line colors and line width
Option to enable or disable text labels
Automatic daily reset to maintain chart performance
How to Interpret
When price and CVD form different swing structures, the indicator highlights the divergence visually.
It is intended as a contextual analysis tool and should be used together with your broader technical or volume-based analysis.
This script does not generate buy or sell signals and is designed solely for chart visualization and study purposes.
AK Indicator"Trade the momentum within the boundary, and be prepared for the breakout when the boundary fails." WE ARE WORKING ON THE INDICATOR IT'S A BETA VERSION. HAPPY TRADING.
Mother & Baby — Nifty 5m (Bull/Bear)The Mother & Baby — Nifty 5m (Bull/Bear) indicator automatically detects two-bar inside-bar patterns, where the second (child) candle is completely within the previous (mother) candle. It highlights potential bullish or bearish setups using boxes, labels, and alerts. Includes optional ATR filtering, high/low guide lines, and customizable visuals for clear pattern recognition. Designed for educational and analytical use only — not financial advice.
🧠 Quantum Regime Shift Detector v4.0 — Enhanced Edition🧠 Quantum Regime Shift Detector v4.0 — Enhanced Edition
Overview:
A cutting-edge, AI-weighted market-regime detector that dynamically tracks volatility, trend, and momentum to pinpoint transitions 🟥, stability 🟩, and uncertainty 🟨 in real time.
📊 Dashboard Interpretation
🟩 Stable: Low volatility — range or accumulation phase → great for steady entries or breakouts.
🟥 Transition: High volatility — regime shift → trend changes / explosive moves likely.
🟨 Uncertain: Neutral zone → patience and tight risk control advised.
💡 Key Features
⚙️ Probability Gauge → quantifies shift likelihood (> 70 % = high confidence)
📈 Flow Bias → shows bullish / bearish directional pressure
🔄 Divergence Alerts → Bull / Bear signals anticipate reversals
🧭 S/R Zones → adaptive pivot-based support & resistance
⏫ MTF Analysis → confirm alignment with higher timeframes
🎯 Trading Applications
✅ Enter during 🟩 stable regimes with confirmed bias direction.
⚠️ Trim or hedge when 🟥 transition appears.
🔃 Use divergence alerts for reversal timing and confirmation.
🧩 Customization
🔧 Tune Feature Weights (volatility / trend / momentum)
🧮 Enable Auto Thresholds for adaptive sensitivity
⏱️ Set Confirmation Bars to filter noise
🌐 Toggle MTF Mode for multi-timeframe synergy
📘 Best Practice:
Use on liquid assets (≥ 15 min TF). Combine with price action, VWAP, and volume profiling for the clearest market DNA signals.
✨ Character count: ≈ 1,470 (TradingView limit safe)
3s vs 10s Up/Down//@version=5
indicator("3s vs 10s Up/Down", overlay=true, scale=scale.none)
three_sec_diff = close - request.security(syminfo.tickerid, "3S", close )
ten_sec_diff = close - request.security(syminfo.tickerid, "10S", close )
faster_up = three_sec_diff > ten_sec_diff
faster_down = three_sec_diff < ten_sec_diff
col = faster_up ? color.green : faster_down ? color.red : color.gray
// Plot a shape at the top of each bar
plotshape(series=true, location=location.top, color=col, style=shape.circle, size=size.large, title="Speed Tick Light")
// Optional: only display on the last bar for dashboard style light
show_light = barstate.islast
plotshape(series=show_light, location=location.top, color=col, style=shape.circle, size=size.huge, title="Current Tick Light")
ahmdeew scalping indicator custom scalping indicator for gold (XAUUSD) using MACD and RSI confirmations.
🧠 Quantum Regime Shift Detector v3.0 — Institutional Edition🧠 Quantum Regime Shift Detector v3.0 — Institutional Overview
📊 What It Does
The Quantum Regime Shift Detector identifies when the market transitions between different volatility and behavioral states.
It classifies every moment as one of three regimes:
Regime Description Visual
Stable Low-volatility, predictable environment ideal for trend-following 🟢 Green
Transition High-volatility, chaotic regime shifts or market rotations 🔴 Red
Uncertain Mid-zone where signals conflict or structure is reforming 🟡 Yellow
⚙️ How It Works
1️⃣ Five-Factor Market Feature Engine
Feature Description
Volatility Short-term standard deviation of price — captures movement intensity
Trend Strength Distance between fast and slow EMAs — shows directional persistence
Momentum Rate of price change — detects acceleration or exhaustion
Volume Change Relative volume spikes or droughts — measures participation shifts
Volatility Clustering ATR vs long-term ATR average — flags clustering of volatility bursts
2️⃣ Weighted AI-Style Shift Score
All five features are blended into a single smoothed composite using customizable weights
(default 30 % Volatility / 30 % Trend / 25 % Momentum / 15 % Volume / 20 % Clustering).
Think of it as a mini-neural-network attention layer that highlights whichever factor dominates.
3️⃣ Adaptive Percentile Thresholds
Analyzes the last 200 bars to build rolling percentiles:
📈 Above 75th percentile → Transition
📉 Below 25th percentile → Stable
⚖️ Between → Uncertain
This self-adjusts to volatility shifts across any timeframe or asset.
4️⃣ Visual System
Element Meaning
Aqua Line Quantum Shift Score (main signal)
Red / Green Lines Dynamic thresholds
Blue Fill Uncertain zone
Purple Line Regime probability (0–1 scale)
Histogram Current regime (high/low bars)
Background Tint Directional bias — green for bullish, red for bearish
🚨 Alerts & Integrations
Trigger Purpose
Bull Regime Shift Transition + bullish bias → “🚀 Bullish regime expansion detected.”
Bear Regime Shift Transition + bearish bias → “⚠️ Bearish volatility regime forming.”
Stable Zone Entry Calm phase → “✅ Market entering stable phase.”
AI Bridge Hooks Webhook alerts → POST /regime?state=transition / stable for Python or Alice integration
💡 Practical Use Cases
Objective Application
Position Sizing Reduce exposure during red transition zones
Strategy Selection Trend-follow in green stable zones; mean-revert in red transitions
Risk Management Tighten stops or hedge when volatility expands
Entry Timing Prefer entries during stabilization after transitions
🧩 Key Strength
A multi-dimensional, self-learning market classifier that adapts across assets and timeframes, giving you a quantitative edge by revealing when to change your playbook — before the market does.
JKL HTF SD Zones
Best-fit categories
Support & Resistance (if available; plots S/D boxes)
Candlestick analysis (wait-for-confirm pin/engulf logic)
Chart patterns (box/retest structure)
If “Support & Resistance” isn’t listed, use:
Bands and Channels (closest structural fit), plus
Candlestick analysis and Chart patterns.
Educational only — not financial advice.
JKL HTF S/D Zones JKL HTF S/D Zones
A small tool offered by grace—a reminder that wisdom is given, not earned. May you use it wisely and humbly, and let its fruit lift others up.
Purpose: render HTF Supply/Demand, decision boxes, and clean retest edges.
Use: mark the box edge; wait for retest + confirming candle + volume; manage RR ≥ 1.5R.
Reminder: Anchors decide • Flow aligns • RR protects.
Not financial advice. Practice discipline, walk in truth, and pass the good on.
“To God be the glory—for His steadfast love.”
Disclaimer:
Educational only — not financial advice. Use at your own risk.
No guarantees. Trade responsibly; test before live.
For study, not signals. You are responsible for outcomes.
David
فلتر فوليوم// This work is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
// creativecommons.org
// © BigBeluga
//@version=6
indicator("فلتر فوليوم", max_labels_count = 500, max_lines_count = 500)
// INPUTS ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
int length = input.int(20, minval=1, title="Filter Length")
bool disp_lvl = input.bool(true, "Levels")
color up_color = input.color(color.rgb(8, 245, 59), "", inline = "color")
color dn_color = input.color(color.rgb(243, 2, 2), "", inline = "color")
var buy_line = line(na)
var sell_line = line(na)
// }
// CALCULATIONS――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
float sma1 = ta.sma(close, 25)
float sma_n1 = ((close - sma1) - ta.sma(close - sma1, 25)) / ta.stdev(close - sma1, 25)
float area = ta.sma(high-low, 100)
// Two-pole smooth filter function
f_two_pole_filter(source, length) =>
var float smooth1 = na
var float smooth2 = na
alpha = 2.0 / (length + 1)
if na(smooth1)
smooth1 := source
else
smooth1 := (1 - alpha) * smooth1 + alpha * source
if na(smooth2)
smooth2 := smooth1
else
smooth2 := (1 - alpha) * smooth2 + alpha * smooth1
// Oscillator
two_p = f_two_pole_filter(sma_n1, length)
two_pp = two_p
// Colors
color buy_col1 = color.from_gradient(two_p, -1, 0.5, up_color, na)
color buy_col2 = color.from_gradient(two_p, -1, 0.5, color.new(up_color, 50), na)
color sell_col1 = color.from_gradient(two_p, -0.5, 1, na, dn_color)
color sell_col2 = color.from_gradient(two_p, -0.5, 1, na, color.new(dn_color, 50))
color color = two_p > two_pp
? color.from_gradient(two_p, -1,1, up_color, color.new(up_color, 0))
: color.from_gradient(two_p, -1,1,color.new(dn_color, 0), dn_color)
// Signals
bool buy = ta.crossover(two_p, two_pp) and two_p < 0 and barstate.isconfirmed
bool sell = ta.crossunder(two_p, two_pp) and two_p > 0 and barstate.isconfirmed
// }
// PLOT ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
if buy //and two_p < -0.5
sell_line := line(na)
if disp_lvl
buy_line := line.new(
bar_index-1
, low - area
, bar_index
, low - area
, force_overlay = true
, color = buy_col1
, style = line.style_dashed
)
label.new(bar_index-1, low - area
, color = buy_col1, style = label.style_label_up, force_overlay = true, size = size.tiny)
if ta.crossunder(low, buy_line.get_y1()) and barstate.isconfirmed
label.new(
bar_index-1
, buy_line.get_y1()
, color = color.new(up_color, 100)
, style = label.style_label_center
, force_overlay = true
, size = size.large
, text = "✖"
, textcolor = up_color
)
buy_line := line(na)
if sell //and two_p > 0.5
buy_line := line(na)
if disp_lvl
sell_line := line.new(
bar_index-1
, high + area
, bar_index
, high + area
, force_overlay = true
, color = sell_col1
, style = line.style_dashed
)
label.new(bar_index-1, high + area
, color = sell_col1, style = label.style_label_down, force_overlay = true, size = size.tiny)
if ta.crossover(high, sell_line.get_y1()) and barstate.isconfirmed
label.new(
bar_index-1
, sell_line.get_y1()
, color = color.new(dn_color, 100)
, style = label.style_label_center
, force_overlay = true
, size = size.large
, text = "✖"
, textcolor = dn_color
)
sell_line := line(na)
switch
not na(buy_line) => buy_line. set_x2(bar_index)
not na(sell_line) => sell_line.set_x2(bar_index)
plotshape(buy ? two_p : na, "كول", shape.circle, location.absolute, buy_col2, -1, size = size.small)
plotshape(buy ? two_p : na, "كول", shape.circle, location.absolute, buy_col1, -1, size = size.tiny)
plotshape(sell ? two_p : na, "بوت", shape.circle, location.absolute, sell_col2, -1, size = size.small)
plotshape(sell ? two_p : na, "بوت", shape.circle, location.absolute, sell_col1, -1, size = size.tiny)
p11 = plot(1, color = color.new(chart.fg_color, 80))
plot(0.5, color = color.new(chart.fg_color, 50))
p00 = plot(0, color = color.new(bar_index % 2 == 0 ? chart.fg_color : na, 0))
plot(-0.5, color = color.new(chart.fg_color, 50))
p_1 = plot(-1, color = color.new(chart.fg_color, 80))
fill(p11, p00, 2, -1, color.new(chart.fg_color, 80), na)
fill(p_1, p00, 1, -2, na, color.new(chart.fg_color, 80))
p1 = plot(two_p, color = color, linewidth = 1)
p2 = plot(two_pp, display = display.none)
fill(p1, p2, two_p, two_pp, color, na)
// }
//@version=6
// indicator("Technical Ratings", "Technicals", precision = 2)
import TradingView/TechnicalRating/3 as rating
res = input.timeframe("", "Indicator Timeframe")
ratingSignal = input.string("All", "Rating is based on", options = )
GRP1 = "Show MTF"
useMtf1 = input(false, "", inline = "mtf1", group = GRP1)
mtf1 = input.timeframe("60", "", inline = "mtf1", group = GRP1, active = useMtf1)
useMtf2 = input(false, "", inline = "mtf2", group = GRP1)
mtf2 = input.timeframe("240", "", inline = "mtf2", group = GRP1, active = useMtf2)
useMtf3 = input(true, "", inline = "mtf3", group = GRP1)
mtf3 = input.timeframe("1D", "", inline = "mtf3", group = GRP1, active = useMtf3)
useMtf4 = input(true, "", inline = "mtf4", group = GRP1)
mtf4 = input.timeframe("1W", "", inline = "mtf4", group = GRP1, active = useMtf4)
useMtf5 = input(true, "", inline = "mtf5", group = GRP1)
mtf5 = input.timeframe("1M", "", inline = "mtf5", group = GRP1, active = useMtf5)
GRP2 = "Color Settings"
colBuy = input(#5b9cf6, "Buy ", inline = "كول Colors", group = GRP2)
colStrongBuy = input(#2962ff, "", inline = "كول Colors", group = GRP2)
colNeutral = input(#a8adbc, "Neutral ", inline = "تذبذب", group = GRP2)
colSell = input(#ef9a9a, "Sell ", inline = "بوت Colors", group = GRP2)
colStrongSell = input(#f44336, "", inline = "بوت Colors", group = GRP2)
tableTitleColor = input(#295b79, "Headers", inline = "تذبذب", group = GRP2)
StrongBound = 0.5
WeakBound = 0.1
getSignal(ratingTotal, ratingOther, ratingMA) =>
if ratingSignal == "MAs"
ratingMA
else if ratingSignal == "Oscillators"
ratingOther
else
ratingTotal
= request.security(syminfo.tickerid, res, rating.calcRatingAll())
= request.security(syminfo.tickerid, mtf1, rating.calcRatingAll())
= request.security(syminfo.tickerid, mtf2, rating.calcRatingAll())
= request.security(syminfo.tickerid, mtf3, rating.calcRatingAll())
= request.security(syminfo.tickerid, mtf4, rating.calcRatingAll())
= request.security(syminfo.tickerid, mtf5, rating.calcRatingAll())
tradeSignal = getSignal(ratingTotalCurrent, ratingOtherCurrent, ratingMACurrent)
calcRatingStatus(value) =>
if na(value)
"-"
else if -StrongBound > value
"Strong بوت"
else if value < -WeakBound
"Sell "
else if value > StrongBound
"Strong كول "
else if value > WeakBound
"كول "
else
"تذبذب"
allRatingsArray = array.from("All", calcRatingStatus(ratingTotalCurrent), calcRatingStatus(ratingTotal_mtf1), calcRatingStatus(ratingTotal_mtf2),
calcRatingStatus(ratingTotal_mtf3), calcRatingStatus(ratingTotal_mtf4), calcRatingStatus(ratingTotal_mtf5))
oscRatingsArray = array.from("Osc", calcRatingStatus(ratingOtherCurrent), calcRatingStatus(ratingOther_mtf1), calcRatingStatus(ratingOther_mtf2),
calcRatingStatus(ratingOther_mtf3), calcRatingStatus(ratingOther_mtf4), calcRatingStatus(ratingOther_mtf5))
maRatingsArray = array.from("MAs", calcRatingStatus(ratingMACurrent), calcRatingStatus(ratingMA_mtf1), calcRatingStatus(ratingMA_mtf2),
calcRatingStatus(ratingMA_mtf3), calcRatingStatus(ratingMA_mtf4), calcRatingStatus(ratingMA_mtf5))
currentRes = res==""?timeframe.period:res
allResArray = array.from("TF", currentRes, mtf1, mtf2, mtf3, mtf4, mtf5)
usedMtfArray = array.from(true, true, useMtf1, useMtf2, useMtf3, useMtf4, useMtf5)
removeUnused(duplicatedIndex) =>
if array.size(duplicatedIndex) > 0
int size = array.size(duplicatedIndex)-1
for j=0 to size
int currentDupIndex = array.shift(duplicatedIndex)
array.remove(allResArray, currentDupIndex-j)
array.remove(usedMtfArray, currentDupIndex-j)
array.remove(allRatingsArray, currentDupIndex-j)
array.remove(oscRatingsArray, currentDupIndex-j)
array.remove(maRatingsArray, currentDupIndex-j)
eraseDuplicatedAndDisabledTf() =>
int duplicatedIndex = array.new_int()
for m=1 to array.size(allResArray)-1
bool isCurrentMtfDisabled = array.get(usedMtfArray, m) == false
if isCurrentMtfDisabled
array.push(duplicatedIndex, m)
removeUnused(duplicatedIndex)
for m=1 to array.size(allResArray)-1
int firstSearchElemIndex = array.indexof(allResArray, array.get(allResArray, m))
int lastSearchElemIndex = array.lastindexof(allResArray, array.get(allResArray, m))
if firstSearchElemIndex == lastSearchElemIndex or array.indexof(duplicatedIndex, lastSearchElemIndex) != -1
continue
string searchElem = array.get(allResArray, firstSearchElemIndex)
for i=firstSearchElemIndex+1 to lastSearchElemIndex
string currentElem = array.get(allResArray, i)
if searchElem == currentElem
array.push(duplicatedIndex, i)
removeUnused(duplicatedIndex)
poscond = tradeSignal > WeakBound
negcond = tradeSignal < -WeakBound
posseries = poscond ? tradeSignal : 0
negseries = negcond ? tradeSignal : 0
count_rising(plot) =>
v_plot = plot > 0 ? plot : -plot
var count = 0
if v_plot == 0
count := 0
else if v_plot >= v_plot
count := math.min(5, count + 1)
else if v_plot < v_plot
count := math.max(1, count - 1)
count
poscount = count_rising(posseries)
negcount = count_rising(negseries)
_pc = poscond ? poscount : negcond ? negcount : 0
colorTransp(col, transp) =>
red = color.r(col)
green = color.g(col)
blue = color.b(col)
color.rgb(red, green, blue, transp)
hline(1, color=colorTransp(colBuy, 50), linestyle=hline.style_solid)
hline(0.5, color=colorTransp(colBuy, 50), linestyle=hline.style_dashed)
hline(-1, color=colorTransp(colSell, 50), linestyle=hline.style_solid)
hline(-0.5, color=colorTransp(colSell, 50), linestyle=hline.style_dashed)
f_cellBgColor(_signal) =>
_returnColor = tableTitleColor
if _signal == "بوت "
_returnColor := colSell
else if _signal == "Strong بوت"
_returnColor := colStrongSell
else if _signal == "كول "
_returnColor := colBuy
else if _signal == "Strong كول "
_returnColor := colStrongBuy
else if _signal == "تذبذب" or _signal == "-"
_returnColor := colNeutral
_returnColor
f_cellAlign(_cellTitle) =>
_align = text.align_left
if _cellTitle == "MAs" or _cellTitle == "Osc" or _cellTitle == "All" or _cellTitle == "-"
_align := text.align_center
_align
f_addCell(_table, _column, _row, _cellTitle) =>
table.cell(_table, _column, _row, _cellTitle, text_color=color.white, text_halign=f_cellAlign(_cellTitle), bgcolor=f_cellBgColor(_cellTitle), text_size=size.small)
f_drawInfo() =>
var t1 = table.new(position.middle_right, 4, array.size(allRatingsArray), frame_width=2, frame_color=color.white, border_width=1, border_color=color.white)
eraseDuplicatedAndDisabledTf()
timeframesCount = array.size(allResArray)
if timeframesCount < 3
for i=0 to timeframesCount-1
f_addCell(t1, i, 1, array.get(maRatingsArray, i))
f_addCell(t1, i, 2, array.get(oscRatingsArray, i))
f_addCell(t1, i, 3, array.get(allRatingsArray, i))
else
for i=0 to timeframesCount-1
f_addCell(t1, 0, i, array.get(allResArray, i))
if ratingSignal == "All"
f_addCell(t1, 1, i, array.get(maRatingsArray, i))
f_addCell(t1, 2, i, array.get(oscRatingsArray, i))
f_addCell(t1, 3, i, array.get(allRatingsArray, i))
if ratingSignal == "Oscillators"
f_addCell(t1, 1, i, array.get(oscRatingsArray, i))
if ratingSignal == "MAs"
f_addCell(t1, 1, i, array.get(maRatingsArray, i))
col_buy = color.from_gradient(tradeSignal, 0.0, 0.2, colNeutral, colStrongBuy)
col_sell = color.from_gradient(tradeSignal, -0.2, 0.0, colStrongSell, colNeutral)
col_gradient = color.from_gradient(tradeSignal, -0.2, 0.2, col_sell, col_buy)
if barstate.islast
f_drawInfo()
plot(tradeSignal, title="Rating", linewidth = 1, style = plot.style_columns, color = color.new(col_gradient, 50 - _pc * 10))
_cond1 = ta.crossunder(tradeSignal, -WeakBound)
alertcondition(_cond1, "بوت", "Ratings changed to بوت")
_cond2 = ta.crossover(tradeSignal, WeakBound)
alertcondition(_cond2, "كول", "Ratings changed to كول")
_cond3 = ta.crossunder(tradeSignal, -StrongBound)
alertcondition(_cond3, "Strong بوت", "Ratings changed to Strong بوت")
_cond4 = ta.crossover(tradeSignal, StrongBound)
alertcondition(_cond4, "Strong كول", "Ratings changed to Strong كول")
vip//@version=5
indicator(" fmfm1 ", overlay=true, max_labels_count=500, max_lines_count=500, max_boxes_count=500)
// ==============================
// | الإعدادات الأساسية
// ==============================
atrPeriod = input.int(10, "ATR Period", minval=1, group="Supertrend")
factor = input.float(3.0, "Supertrend Multiplier", minval=0.1, step=0.1, group="Supertrend")
rsiLength = input.int(14, "RSI Length", minval=2, group="RSI")
macdFast = input.int(12, "MACD Fast Length", minval=1, group="MACD")
macdSlow = input.int(26, "MACD Slow Length", minval=1, group="MACD")
macdSig = input.int(9, "MACD Signal Length", minval=1, group="MACD")
emaLen1 = input.int(20, "EMA 20 Length", group="EMA")
emaLen2 = input.int(50, "EMA 50 Length", group="EMA")
tablePos = input.string("top_right", "Table Position",
options= , group="Display")
// إعدادات الصناديق
showBoxes = input.bool(true, "إظهار صناديق الإشارات", group="صناديق الإشارات")
boxTransparency = input.int(70, "شفافية الصندوق", minval=0, maxval=100, group="صناديق الإشارات")
boxHeight = input.float(0.15, "ارتفاع الصندوق %", minval=0.05, maxval=1.0, step=0.05, group="صناديق الإشارات")
// فلتر الشركات
enableFilter = input.bool(false, "تفعيل فلتر الشركات", group="فلتر الشركات")
symbol1 = input.string("", "الشركة 1", group="فلتر الشركات")
symbol2 = input.string("", "الشركة 2", group="فلتر الشركات")
symbol3 = input.string("", "الشركة 3", group="فلتر الشركات")
symbol4 = input.string("", "الشركة 4", group="فلتر الشركات")
symbol5 = input.string("", "الشركة 5", group="فلتر الشركات")
symbol6 = input.string("", "الشركة 6", group="فلتر الشركات")
// التنبيهات
enableAlerts = input.bool(true, "تفعيل التنبيهات", group="التنبيهات")
alertOnCall = input.bool(true, "تنبيه عند CALL", group="التنبيهات")
alertOnPut = input.bool(true, "تنبيه عند PUT", group="التنبيهات")
// إعدادات مناطق العرض والطلب
zigzagLen = input.int(9, 'ZigZag Length', group = 'Order Block Settings')
numberObShow = input.int(1, 'عدد مناطق العرض والطلب المعروضة', group = 'Order Block Settings', minval = 1, maxval = 10)
bearishOrderblockColor = input.color(color.new(#dc1515, 18), title = 'لون منطقة العرض', group = 'Order Block Settings')
bullishOrderblockColor = input.color(color.new(#58bd0f, 10), title = 'لون منطقة الطلب', group = 'Order Block Settings')
// إعدادات نسبة القوة
showStrengthLabels = input.bool(true, 'عرض نسبة القوة', group = 'Strength Settings')
strengthThreshold = input.int(60, 'حد التنبيه', group = 'Strength Settings', minval = 50, maxval = 90)
enableStrengthAlert = input.bool(true, 'تفعيل تنبيهات القوة', group = 'Strength Settings')
// ==============================
// | حسابات Supertrend و المؤشرات
// ==============================
atrValue = ta.atr(atrPeriod)
hl2Value = (high + low) / 2
upperBand = hl2Value - factor * atrValue
lowerBand = hl2Value + factor * atrValue
var float trendLine = na
trendLine := close > nz(trendLine , hl2Value) ? math.max(upperBand, nz(trendLine , upperBand)) : math.min(lowerBand, nz(trendLine , lowerBand))
bull = close > trendLine
bear = close < trendLine
buySignal = ta.crossover(close, trendLine)
sellSignal = ta.crossunder(close, trendLine)
ema20 = ta.ema(close, emaLen1)
ema50 = ta.ema(close, emaLen2)
emaBull = ema20 > ema50
emaBear = ema20 < ema50
rsi = ta.rsi(close, rsiLength)
rsiBull = rsi > 50
rsiBear = rsi < 50
macd = ta.ema(close, macdFast) - ta.ema(close, macdSlow)
signal = ta.ema(macd, macdSig)
macdBull = macd > signal
macdBear = macd < signal
vwapValue = ta.vwap(close)
vwapBull = close > vwapValue
vwapBear = close < vwapValue
// الإشارات النهائية
allBull = (bull and rsiBull and macdBull and emaBull and vwapBull)
allBear = (bear and rsiBear and macdBear and emaBear and vwapBear)
finalSignal = allBull ? "CALL " : allBear ? "PUT " :" NEUTRAL"
finalBg = allBull ? color.new(color.green, 0) : allBear ? color.new(color.red, 0) : color.new(color.orange, 0)
// حفظ الحالة السابقة للإشارات
var bool wasCall = false
var bool wasPut = false
// اكتشاف إشارة CALL جديدة
newCallSignal = allBull and not wasCall
// اكتشاف إشارة PUT جديدة
newPutSignal = allBear and not wasPut
// تحديث الحالة
wasCall := allBull
wasPut := allBear
// ==============================
// | Labels للإشارات الجديدة - تم تعطيلها
// ==============================
// تم إزالة Labels CALL/PUT من فوق وتحت الشموع
// ==============================
// | التنبيهات
// ==============================
if enableAlerts
if alertOnCall and newCallSignal
alert("🔔 إشارة CALL على " + syminfo.ticker + " | السعر: " + str.tostring(close, format.mintick), alert.freq_once_per_bar)
if alertOnPut and newPutSignal
alert("🔔 إشارة PUT على " + syminfo.ticker + " | السعر: " + str.tostring(close, format.mintick), alert.freq_once_per_bar)
// ==============================
// | لوحة المعلومات
// ==============================
var table dash = table.new(position=tablePos, columns=2, rows=9, border_width=1)
if barstate.islast
table.cell(dash, 0, 0, "Ind", text_color=color.white, bgcolor=color.blue, text_size=size.tiny)
table.cell(dash, 1, 0, "Sig", text_color=color.white, bgcolor=color.blue, text_size=size.tiny)
table.cell(dash, 0, 1, "Sup", text_color=color.white, bgcolor=color.black, text_size=size.tiny)
table.cell(dash, 1, 1, buySignal ? "BUY" : sellSignal ? "SELL" : bull ? "UP" : "DN",
text_color=color.white,
bgcolor= buySignal ? color.new(color.green, 0) : sellSignal ? color.new(color.red, 0) : bull ? color.new(color.green, 0) : color.new(color.red, 0),
text_size=size.tiny)
table.cell(dash, 0, 2, "EMA", text_color=color.white, bgcolor=color.black, text_size=size.tiny)
table.cell(dash, 1, 2, emaBull ? "UP" : "DN", text_color=color.white,
bgcolor=emaBull ? color.new(color.green, 0) : color.new(color.red, 0), text_size=size.tiny)
table.cell(dash, 0, 3, "RSI", text_color=color.white, bgcolor=color.black, text_size=size.tiny)
table.cell(dash, 1, 3, rsiBull ? "UP" : "DN", text_color=color.white,
bgcolor=rsiBull ? color.new(color.green, 0) : color.new(color.red, 0), text_size=size.tiny)
table.cell(dash, 0, 4, "MACD", text_color=color.white, bgcolor=color.black, text_size=size.tiny)
table.cell(dash, 1, 4, macdBull ? "UP" : "DN", text_color=color.white,
bgcolor=macdBull ? color.new(color.green, 0) : color.new(color.red, 0), text_size=size.tiny)
table.cell(dash, 0, 5, "VWAP", text_color=color.white, bgcolor=color.black, text_size=size.tiny)
table.cell(dash, 1, 5, vwapBull ? "UP" : "DN", text_color=color.white,
bgcolor=vwapBull ? color.new(color.green, 0) : color.new(color.red, 0), text_size=size.tiny)
table.cell(dash, 0, 6, "دخول", text_color=color.yellow, bgcolor=color.black, text_size=size.tiny)
table.cell(dash, 1, 6, finalSignal, text_color=color.white, bgcolor=finalBg, text_size=size.tiny)
table.cell(dash, 0, 7, "Price", text_color=color.white, bgcolor=color.black, text_size=size.tiny)
table.cell(dash, 1, 7, str.tostring(close, format.mintick), text_color=color.white, bgcolor=color.gray, text_size=size.tiny)
// ==============================
// | رسم المؤشرات
// ==============================
plot(trendLine, "Supertrend", color=bull ? color.green : color.red, linewidth=2)
plot(ema20, "EMA 20", color=color.blue, linewidth=1)
// ==============================
// | مناطق العرض والطلب
// ==============================
// أنواع البيانات
type orderblock
float value
int barStart
int barEnd
box block
bool broken
label supplyLabel
label demandLabel
// المصفوفات
var array bullishOrderblock = array.new()
var array bearishOrderblock = array.new()
var array highValIndex = array.new()
var array lowValIndex = array.new()
var array highVal = array.new_float()
var array lowVal = array.new_float()
// المتغيرات
var bool drawUp = false
var bool drawDown = false
var string lastState = na
var bool to_up = false
var bool to_down = false
var int trendZZ = 1
atrOB = ta.atr(14)
// حساب الاتجاه
to_up := high >= ta.highest(high, zigzagLen)
to_down := low <= ta.lowest(low, zigzagLen)
trendZZ := trendZZ == 1 and to_down ? -1 : trendZZ == -1 and to_up ? 1 : trendZZ
// تحديد تغيير الاتجاه للأعلى
if ta.change(trendZZ) != 0 and trendZZ == 1
array.push(highValIndex, time )
array.push(highVal, high )
if array.size(lowVal) > 1
drawUp := false
// تحديد تغيير الاتجاه للأسفل
if ta.change(trendZZ) != 0 and trendZZ == -1
array.push(lowValIndex, time )
array.push(lowVal, low )
if array.size(highVal) > 1
drawDown := false
// دالة حساب نسبة القوة
calculateStrengthRatio() =>
float supplyStrength = 0.0
float demandStrength = 0.0
int supplyTouches = 0
for i = 1 to 20
if i < bar_index
if close < open
supplyTouches += 1
int demandTouches = 0
for i = 1 to 20
if i < bar_index
if close > open
demandTouches += 1
float avgVolume = ta.sma(volume, 20)
float volumeRatio = volume / avgVolume
float rsiValue = ta.rsi(close, 14)
if rsiValue > 50
demandStrength := rsiValue
supplyStrength := 100 - rsiValue
else
supplyStrength := 100 - rsiValue
demandStrength := rsiValue
// إنشاء منطقة عرض (Bearish Order Block)
if array.size(lowVal) > 1 and drawDown == false
if close < array.get(lowVal, array.size(lowVal) - 1)
drawDown := true
lastState := 'down'
orderblock newOrderblock = orderblock.new()
float max = 0
int bar = na
for i = (time - array.get(lowValIndex, array.size(lowValIndex) - 1) - (time - time )) / (time - time ) to 0 by 1
if high > max
max := high
bar := time
newOrderblock.barStart := bar
newOrderblock.barEnd := time
newOrderblock.broken := false
newOrderblock.value := max
newOrderblock.block := box.new(
left = newOrderblock.barStart,
top = newOrderblock.value,
right = newOrderblock.barEnd,
bottom = newOrderblock.value - atrOB * 0.30,
xloc = xloc.bar_time,
bgcolor = bearishOrderblockColor,
border_width = 1,
border_color = color.new(#cd1212, 0))
= calculateStrengthRatio()
newOrderblock.supplyLabel := na
newOrderblock.demandLabel := na
if showStrengthLabels
newOrderblock.supplyLabel := label.new(
x = time,
y = newOrderblock.value + atrOB * 0.5,
text = "عرض: " + str.tostring(supplyStr, "#") + "%",
xloc = xloc.bar_time,
yloc = yloc.price,
color = supplyStr >= strengthThreshold ? color.new(color.red, 0) : color.new(color.orange, 0),
textcolor = color.white,
style = label.style_label_down,
size = size.tiny)
newOrderblock.demandLabel := label.new(
x = time,
y = newOrderblock.value - atrOB * 0.5,
text = "طلب: " + str.tostring(demandStr, "#") + "%",
xloc = xloc.bar_time,
yloc = yloc.price,
color = color.new(color.gray, 30),
textcolor = color.white,
style = label.style_label_up,
size = size.tiny)
if enableStrengthAlert and supplyStr >= strengthThreshold
alert("تنبيه: قوة العرض " + str.tostring(supplyStr, "#") + "% - تجاوزت " + str.tostring(strengthThreshold) + "%", alert.freq_once_per_bar)
array.push(bearishOrderblock, newOrderblock)
if array.size(bearishOrderblock) > 20
oldBlock = array.shift(bearishOrderblock)
if not na(oldBlock.supplyLabel)
label.delete(oldBlock.supplyLabel)
if not na(oldBlock.demandLabel)
label.delete(oldBlock.demandLabel)
// إنشاء منطقة طلب (Bullish Order Block)
if array.size(highVal) > 1 and drawUp == false
if close > array.get(highVal, array.size(highVal) - 1)
drawUp := true
lastState := 'up'
orderblock newOrderblock = orderblock.new()
float min = 999999999
int bar = na
for i = (time - array.get(highValIndex, array.size(highValIndex) - 1) - (time - time )) / (time - time ) to 0 by 1
if low < min
min := low
bar := time
newOrderblock.barStart := bar
newOrderblock.barEnd := time
newOrderblock.broken := false
newOrderblock.value := min
newOrderblock.block := box.new(
left = newOrderblock.barStart,
top = newOrderblock.value + atrOB * 0.12,
right = newOrderblock.barEnd,
bottom = newOrderblock.value,
xloc = xloc.bar_time,
bgcolor = bullishOrderblockColor,
border_width = 1,
border_color = color.new(#52ae10, 0))
= calculateStrengthRatio()
newOrderblock.supplyLabel := na
newOrderblock.demandLabel := na
if showStrengthLabels
newOrderblock.demandLabel := label.new(
x = time,
y = newOrderblock.value - atrOB * 0.5,
text = "طلب: " + str.tostring(demandStr, "#") + "%",
xloc = xloc.bar_time,
yloc = yloc.price,
color = demandStr >= strengthThreshold ? color.new(color.green, 0) : color.new(color.blue, 0),
textcolor = color.white,
style = label.style_label_up,
size = size.tiny)
if enableStrengthAlert and demandStr >= strengthThreshold
alert("تنبيه: قوة الطلب " + str.tostring(demandStr, "#") + "% - تجاوزت " + str.tostring(strengthThreshold) + "%", alert.freq_once_per_bar)
array.push(bullishOrderblock, newOrderblock)
if array.size(bullishOrderblock) > 20
oldBlock = array.shift(bullishOrderblock)
if not na(oldBlock.supplyLabel)
label.delete(oldBlock.supplyLabel)
if not na(oldBlock.demandLabel)
label.delete(oldBlock.demandLabel)
// متغيرات العداد
var int activeBullishCount = 0
var int activeBearishCount = 0
// تحديث مناطق الطلب
if array.size(bullishOrderblock) > 0
orderblock testOrderblock = na
int counter = 0
activeBullishCount := 0
for i = array.size(bullishOrderblock) - 1 to 0 by 1
testOrderblock := array.get(bullishOrderblock, i)
if counter < numberObShow
testOrderblock.block.set_right(time)
= calculateStrengthRatio()
if showStrengthLabels
if not na(testOrderblock.demandLabel)
label.set_x(testOrderblock.demandLabel, time)
label.set_text(testOrderblock.demandLabel, "طلب: " + str.tostring(demandStr, "#") + "%")
label.set_color(testOrderblock.demandLabel, demandStr >= strengthThreshold ? color.new(color.green, 0) : color.new(color.blue, 0))
if not na(testOrderblock.supplyLabel)
label.set_x(testOrderblock.supplyLabel, time)
label.set_text(testOrderblock.supplyLabel, "عرض: " + str.tostring(supplyStr, "#") + "%")
if close < testOrderblock.value
testOrderblock.block.delete()
if not na(testOrderblock.demandLabel)
label.delete(testOrderblock.demandLabel)
if not na(testOrderblock.supplyLabel)
label.delete(testOrderblock.supplyLabel)
array.remove(bullishOrderblock, i)
else
activeBullishCount += 1
counter := counter + 1
else
testOrderblock.block.set_right(testOrderblock.barStart)
if not na(testOrderblock.demandLabel)
label.delete(testOrderblock.demandLabel)
if not na(testOrderblock.supplyLabel)
label.delete(testOrderblock.supplyLabel)
// تحديث مناطق العرض
if array.size(bearishOrderblock) > 0
orderblock testOrderblock = na
int counter = 0
activeBearishCount := 0
for i = array.size(bearishOrderblock) - 1 to 0 by 1
testOrderblock := array.get(bearishOrderblock, i)
if counter < numberObShow
testOrderblock.block.set_right(time)
= calculateStrengthRatio()
if showStrengthLabels
if not na(testOrderblock.supplyLabel)
label.set_x(testOrderblock.supplyLabel, time)
label.set_text(testOrderblock.supplyLabel, "عرض: " + str.tostring(supplyStr, "#") + "%")
label.set_color(testOrderblock.supplyLabel, supplyStr >= strengthThreshold ? color.new(color.red, 0) : color.new(color.orange, 0))
if not na(testOrderblock.demandLabel)
label.set_x(testOrderblock.demandLabel, time)
label.set_text(testOrderblock.demandLabel, "طلب: " + str.tostring(demandStr, "#") + "%")
if close > testOrderblock.value
testOrderblock.block.delete()
if not na(testOrderblock.supplyLabel)
label.delete(testOrderblock.supplyLabel)
if not na(testOrderblock.demandLabel)
label.delete(testOrderblock.demandLabel)
array.remove(bearishOrderblock, i)
else
activeBearishCount += 1
counter := counter + 1
else
testOrderblock.block.set_right(testOrderblock.barStart)
if not na(testOrderblock.supplyLabel)
label.delete(testOrderblock.supplyLabel)
if not na(testOrderblock.demandLabel)
label.delete(testOrderblock.demandLabel)
// ================= SETTINGS =================
paint_bars = input.bool(false, "Paint bars?", group="Bars Settings")
catch_flat = input.bool(false, "Try to catch flat?", group="Bars Settings")
uptrend_colour = input.color(color.rgb(13,247,20), "Uptrend colour", group="Bars Settings")
downtrend_colour = input.color(color.rgb(250,10,10), "Downtrend colour", group="Bars Settings")
neutraltrend_colour = input.color(color.rgb(245,252,252), "Neutral colour", group="Bars Settings")
// ================= TABLE SETTINGS =================
show_header = input(false, "Show header?", group="Table Settings")
show_ema_value = input(false, "Show EMA value?", group="Table Settings")
dashboard_position = input.string("Middle right", "Position", options= , group="Table Settings")
text_color = input.color(color.white, "Text colour", group="Table Settings")
table_color = input.color(color.rgb(240,249,250), "Border colour", group="Table Settings")
uptrend_indicator = input.string("🟢", "Uptrend indicator", group="Table Settings")
downtrend_indicator = input.string("🔴", "Downtrend indicator", group="Table Settings")
neutraltrend_indicator = input.string("🟡", "Neutral indicator", group="Table Settings")
header_bg_color = input.color(color.rgb(18,18,18,75), "Header background", group="Table Settings")
uptrend_bg_color = input.color(color.new(color.green,90), "Up BG", group="Table Settings")
downtrend_bg_color = input.color(color.new(color.red,90), "Down BG", group="Table Settings")
neutraltrend_bg_color = input.color(color.new(color.yellow,90), "Neutral BG", group="Table Settings")
// ================= EMA SETTINGS =================
trend_identification_approach = input.string("Direction of a single EMA", "Trend approach", options= , group="EMA Settings")
ema1_length = input.int(50, "EMA length", minval=1, maxval=800, group="EMA Settings")
ema2_length = input.int(200, "Additional EMA length", minval=20, maxval=800, group="EMA Settings")
// ================= TIMEFRAMES =================
show_3m = input(true, "Show 3m", group="Timeframe Settings")
show_5m = input(true, "Show 5m", group="Timeframe Settings")
show_15m = input(true, "Show 15m", group="Timeframe Settings")
show_1h = input(true, "Show 1h", group="Timeframe Settings")
show_4h = input(true, "Show 4h", group="Timeframe Settings")
// ================= TABLE CREATION =================
var table_position = switch dashboard_position
"Top left" => position.top_left
"Top right" => position.top_right
"Bottom left" => position.bottom_left
"Bottom right" => position.bottom_right
"Top center" => position.top_center
"Bottom center" => position.bottom_center
"Middle right" => position.middle_right
=> position.middle_right
// جدول صغير جدًا جدًا
var t = table.new(position=table_position, columns=3, rows=20, frame_color=table_color, frame_width=0, border_color=table_color, border_width=0)
// ================= FUNCTIONS =================
calc_smma(src, len) =>
var float smma = na
smma := na(smma) ? ta.sma(src, len) : (smma * (len - 1) + src) / len
smma
calc_zlema(src, len) =>
ema1 = ta.ema(src, len)
ema2 = ta.ema(ema1, len)
ema1 + (ema1 - ema2)
check_impulse() =>
hi = calc_smma(high, 34)
lo = calc_smma(low, 34)
mi = calc_zlema(hlc3, 34)
md = (mi > hi ? mi - hi : mi < lo ? mi - lo : 0)
sb = ta.sma(md, 9)
sh = md - sb
sh != 0
get_trend_status() =>
impulse = catch_flat ? check_impulse() : true
ema1_current = ta.ema(close, ema1_length)
ema1_prev = ema1_current
ema2_current = ta.ema(close, ema2_length)
ema2_prev = ema2_current
if trend_identification_approach == "Direction of a single EMA"
bg = not impulse ? neutraltrend_bg_color : ema1_current > ema1_prev ? uptrend_bg_color : ema1_current < ema1_prev ? downtrend_bg_color : neutraltrend_bg_color
ind = not impulse ? neutraltrend_indicator : ema1_current > ema1_prev ? uptrend_indicator : ema1_current < ema1_prev ? downtrend_indicator : neutraltrend_indicator
else
bg = not impulse ? neutraltrend_bg_color : ema1_current > ema2_current ? uptrend_bg_color : ema1_current < ema2_current ? downtrend_bg_color : neutraltrend_bg_color
ind = not impulse ? neutraltrend_indicator : ema1_current > ema2_current ? uptrend_indicator : ema1_current < ema2_current ? downtrend_indicator : neutraltrend_indicator
// ================= TREND REQUESTS =================
= request.security(syminfo.tickerid, "3", get_trend_status())
= request.security(syminfo.tickerid, "5", get_trend_status())
= request.security(syminfo.tickerid, "15", get_trend_status())
= request.security(syminfo.tickerid, "60", get_trend_status())
= request.security(syminfo.tickerid, "240", get_trend_status())
// ================= SMALL TABLE =================
if barstate.islast
tiny = size.tiny
if show_header
table.cell(t, 0, 0, "TF", text_color=text_color, text_size=tiny, bgcolor=header_bg_color)
table.cell(t, 1, 0, "Trend", text_color=text_color, text_size=tiny, bgcolor=header_bg_color)
if show_ema_value
table.cell(t, 2, 0, "EMA", text_color=text_color, text_size=tiny, bgcolor=header_bg_color)
if show_3m
table.cell(t, 0, 1, "3m", text_color=text_color, text_size=tiny, bgcolor=bg_3m)
table.cell(t, 1, 1, ind_3m, text_color=text_color, text_size=tiny, bgcolor=bg_3m)
if show_5m
table.cell(t, 0, 2, "5m", text_color=text_color, text_size=tiny, bgcolor=bg_5m)
table.cell(t, 1, 2, ind_5m, text_color=text_color, text_size=tiny, bgcolor=bg_5m)
if show_15m
table.cell(t, 0, 3, "15m", text_color=text_color, text_size=tiny, bgcolor=bg_15m)
table.cell(t, 1, 3, ind_15m, text_color=text_color, text_size=tiny, bgcolor=bg_15m)
if show_1h
table.cell(t, 0, 4, "1h", text_color=text_color, text_size=tiny, bgcolor=bg_1h)
table.cell(t, 1, 4, ind_1h, text_color=text_color, text_size=tiny, bgcolor=bg_1h)
if show_4h
table.cell(t, 0, 5, "4h", text_color=text_color, text_size=tiny, bgcolor=bg_4h)
table.cell(t, 1, 5, ind_4h, text_color=text_color, text_size=tiny, bgcolor=bg_4h)
// --- إعدادات الإدخال ---
string GRP_SETTINGS = "الإعدادات"
var bool showTable = input.bool(true, "إظهار جدول التحليل", group=GRP_SETTINGS)
var int lookbackPeriod = input.int(5, "فترة التحليل (أشرطة)", minval=5, maxval=100, group=GRP_SETTINGS)
var int maxBarsDisplay = input.int(5, "أقصى عدد أشرطة مرئية", minval=5, maxval=20, group=GRP_SETTINGS)
var color buyColor = input.color(color.new(#00C853, 0), "لون الشراء", group=GRP_SETTINGS)
var color sellColor = input.color(color.new(#FF1744, 0), "لون البيع", group=GRP_SETTINGS)
var string tablePosition = input.string("Top-Right", "موضع الجدول", options= , group=GRP_SETTINGS)
// --- متغيرات الحالة ---
var float volumes = array.new_float(0)
var float buyVolumes = array.new_float(0)
var float sellVolumes = array.new_float(0)
var float netFlows = array.new_float(0)
var float priceChanges = array.new_float(0)
var float highs = array.new_float(0)
var float lows = array.new_float(0)
var float opens = array.new_float(0)
var float closes = array.new_float(0)
var table trendTable = na
// --- دالة بناء الشريط البصري ---
f_buildBar(int filled, int total) =>
string result = ""
for i = 1 to total
result += i <= filled ? "█" : "░"
result
// --- جمع البيانات ---
if barstate.isconfirmed
float h = high
float l = low
float o = open
float c = close
float v = volume
float prevClose = nz(close , c)
float priceChange = c - prevClose
float priceRange = math.max(h - l, syminfo.mintick)
float buyV = v * (c - l) / priceRange
float sellV = v * (h - c) / priceRange
float netFlow = buyV - sellV
if array.size(volumes) >= lookbackPeriod
array.shift(volumes)
array.shift(buyVolumes)
array.shift(sellVolumes)
array.shift(netFlows)
array.shift(priceChanges)
array.shift(highs)
array.shift(lows)
array.shift(opens)
array.shift(closes)
array.push(volumes, v)
array.push(buyVolumes, buyV)
array.push(sellVolumes, sellV)
array.push(netFlows, netFlow)
array.push(priceChanges, priceChange)
array.push(highs, h)
array.push(lows, l)
array.push(opens, o)
array.push(closes, c)
// --- منطق الجدول ---
if showTable and array.size(volumes) >= lookbackPeriod
// === 1. الاتجاه ===
float totalVol = array.sum(volumes)
float totalBuyVol = array.sum(buyVolumes)
float totalSellVol = array.sum(sellVolumes)
float buyPerc = totalVol > 0 ? (totalBuyVol / totalVol) * 100 : 0
float sellPerc = totalVol > 0 ? (totalSellVol / totalVol) * 100 : 0
float diffPerc = buyPerc - sellPerc
string diffText = str.tostring(math.abs(diffPerc), "#.##") + "%"
int filledBars = int(math.round((math.abs(diffPerc) / 100) * maxBarsDisplay))
string visualBar = f_buildBar(filledBars, maxBarsDisplay)
color barColor = totalBuyVol > totalSellVol ? buyColor : sellColor
// === 2. الديناميكية ===
float meanFlow = array.avg(netFlows)
float stdFlow = array.stdev(netFlows)
float skew = 0.0
if stdFlow > 1e-10
for i = 0 to array.size(netFlows) - 1
float z = (array.get(netFlows, i) - meanFlow) / stdFlow
skew += math.pow(z, 3)
skew /= array.size(netFlows)
float skew_norm = math.max(-1, math.min(1, skew / 2))
float pBuy = totalBuyVol / totalVol
float pSell = totalSellVol / totalVol
pBuy := math.max(pBuy, 1e-10)
pSell := math.max(pSell, 1e-10)
float entropy = -(pBuy * math.log(pBuy) + pSell * math.log(pSell))
float normEntropy = entropy / math.log(2)
float entropy_score = 1 - normEntropy
float sumX = array.sum(priceChanges)
float sumY = array.sum(netFlows)
float sumXY = 0.0, sumX2 = 0.0, sumY2 = 0.0
int n = array.size(priceChanges)
for i = 0 to n - 1
float x = array.get(priceChanges, i)
float y = array.get(netFlows, i)
sumXY += x * y
sumX2 += x * x
sumY2 += y * y
float numerator = n * sumXY - sumX * sumY
float denominator = math.sqrt((n * sumX2 - sumX * sumX) * (n * sumY2 - sumY * sumY))
float corr = denominator != 0 ? numerator / denominator : 0.0
float signal = math.abs(totalBuyVol - totalSellVol)
float noise = totalVol - signal
float snr = signal / (noise + 1e-10)
float snr_norm = math.min(1, snr / 3)
float dynamicScore = (skew_norm + entropy_score + corr + snr_norm) / 4
float finalPerc = (dynamicScore + 1) * 50
int filledDynamicBars = int(math.round(finalPerc / 100 * maxBarsDisplay))
string dynamicBar = f_buildBar(filledDynamicBars, maxBarsDisplay)
color dynamicColor = finalPerc > 50 ? buyColor : sellColor
// === 3. السلوك ===
float controlSum = 0.0
float reactionSum = 0.0
float closeDomSum = 0.0
int upBars = 0
int totalBars = array.size(closes)
for i = 0 to totalBars - 1
float h_i = array.get(highs, i)
float l_i = array.get(lows, i)
float o_i = array.get(opens, i)
float c_i = array.get(closes, i)
float v_i = array.get(volumes, i)
float range_i = math.max(h_i - l_i, syminfo.mintick)
controlSum += (c_i - l_i) / range_i
reactionSum += v_i / range_i
closeDomSum += math.abs(c_i - o_i) / range_i
if c_i > o_i
upBars += 1
float controlScore = controlSum / float(totalBars)
float volumeBiasScore = float(upBars) / float(totalBars)
float reactionAvg = reactionSum / float(totalBars)
float reactionScore = reactionAvg / math.max(ta.highest(reactionAvg, math.max(lookbackPeriod * 2, 10)), 1e-10)
reactionScore := math.min(1.0, reactionScore)
float closeDominanceScore = closeDomSum / float(totalBars)
float behaviorScore = (controlScore + volumeBiasScore + reactionScore + closeDominanceScore) / 4.0
float behaviorPerc = math.min(100.0, math.max(0.0, behaviorScore * 100.0))
int filledBehaviorBars = int(math.round(behaviorPerc / 100.0 * maxBarsDisplay))
string behaviorBar = f_buildBar(filledBehaviorBars, maxBarsDisplay)
color behaviorColor = behaviorPerc > 50 ? buyColor : sellColor
// === إنشاء الجدول (2 عمود، 4 صفوف) ===
if na(trendTable)
if tablePosition == "Top-Right"
trendTable := table.new(position.top_right, 2, 4, bgcolor=color.new(#121212, 90), border_color=color.gray, border_width=1)
else if tablePosition == "Top-Left"
trendTable := table.new(position.top_left, 2, 4, bgcolor=color.new(#121212, 90), border_color=color.gray, border_width=1)
else if tablePosition == "Bottom-Right"
trendTable := table.new(position.bottom_right, 2, 4, bgcolor=color.new(#121212, 90), border_color=color.gray, border_width=1)
else
trendTable := table.new(position.bottom_left, 2, 4, bgcolor=color.new(#121212, 90), border_color=color.gray, border_width=1)
// === الصف 1: الاتجاه ===
table.cell(trendTable, 0, 1, "الاتجاه", text_color=color.white, bgcolor=color.new(color.gray, 90))
table.cell(trendTable, 1, 1, diffText + " | " + visualBar, text_color=barColor, bgcolor=color.new(barColor, 80))
// === الصف 2: الديناميكية ===
table.cell(trendTable, 0, 2, "الديناميكية", text_color=color.white, bgcolor=color.new(color.gray, 90))
table.cell(trendTable, 1, 2, str.tostring(finalPerc, "#.##") + "% | " + dynamicBar, text_color=dynamicColor, bgcolor=color.new(dynamicColor, 80))
// === الصف 3: السلوك ===
table.cell(trendTable, 0, 3, "السلوك", text_color=color.white, bgcolor=color.new(color.gray, 90))
table.cell(trendTable, 1, 3, str.tostring(behaviorPerc, "#.##") + "% | " + behaviorBar, text_color=behaviorColor, bgcolor=color.new(behaviorColor, 80))
FPeriod = input(35, title='Fibo Period')
plotF1618 = input(title='Plot 1.618 Level?', defval=true)
Fhigh = ta.highest(FPeriod)
Flow = ta.lowest(FPeriod)
FH = ta.highestbars(high, FPeriod)
FL = ta.lowestbars(low, FPeriod)
downfibo = FH < FL
// تصغير حجم الإشارات مع الحفاظ على النص
plotshape(Flow, style=shape.labelup, location=location.absolute, size=size.tiny,
color=color.new(#000000, 40), textcolor=color.new(#c7c9d0, 0), show_last=1, text="🟢", offset=FL)
plotshape(Fhigh, style=shape.labeldown, location=location.absolute, size=size.tiny,
color=color.new(#000000, 30), textcolor=color.new(#e3e5e8, 0), show_last=1, text="🔴", offset=FH)
// === Inputs ===
trendLineLength = input.int(10, 'Trend Line Detection Sensitivity', minval=10)
upTlColor = input.color(color.new(color.teal, 15), title='Trend Line Colors', inline='tl')
downTlColor = input.color(color.new(color.red, 15), title=' ', inline='tl')
showTrendLines = input.bool(true, 'Show Trend Lines')
// === Helper Functions ===
extendTrendline(lineId, startIndex, startValue, endIndex, endValue) =>
slope = (endValue - startValue) / (endIndex - startIndex)
newEndIndex = bar_index
newEndValue = startValue + slope * (newEndIndex - startIndex)
line.set_x2(lineId, newEndIndex)
line.set_y2(lineId, newEndValue)
getSlope(startIndex, startValue, endIndex, endValue) =>
(endValue - startValue) / (endIndex - startIndex)
// === Trendlines Calculation ===
var line newBearishTrendline = na
var line newBullishTrendline = na
if showTrendLines
phTrend = ta.pivothigh(high, trendLineLength, trendLineLength)
plTrend = ta.pivotlow(low, trendLineLength, trendLineLength)
bullishTrendLineStart = ta.valuewhen(not na(plTrend), bar_index , 1)
bullishTrendLineEnd = ta.valuewhen(not na(plTrend), bar_index , 0)
bearishTrendLineStart = ta.valuewhen(not na(phTrend), bar_index , 1)
bearishTrendLineEnd = ta.valuewhen(not na(phTrend), bar_index , 0)
bullishTrendLineStartVal = ta.valuewhen(not na(plTrend), low , 1)
bullishTrendLineEndVal = ta.valuewhen(not na(plTrend), low , 0)
bearishTrendLineStartVal = ta.valuewhen(not na(phTrend), high , 1)
bearishTrendLineEndVal = ta.valuewhen(not na(phTrend), high , 0)
line.delete(newBearishTrendline)
line.delete(newBullishTrendline)
slopeBearish = getSlope(bearishTrendLineStart, bearishTrendLineStartVal, bearishTrendLineEnd, bearishTrendLineEndVal)
slopeBullish = getSlope(bullishTrendLineStart, bullishTrendLineStartVal, bullishTrendLineEnd, bullishTrendLineEndVal)
if slopeBearish < 0
newBearishTrendline := line.new(x1=bearishTrendLineStart, y1=bearishTrendLineStartVal, x2=bar_index, y2=bearishTrendLineEndVal, xloc=xloc.bar_index, color=downTlColor, width=2)
if slopeBullish > 0
newBullishTrendline := line.new(x1=bullishTrendLineStart, y1=bullishTrendLineStartVal, x2=bar_index, y2=bullishTrendLineEndVal, xloc=xloc.bar_index, color=upTlColor, width=2)
if not na(newBearishTrendline)
extendTrendline(newBearishTrendline, bearishTrendLineStart, bearishTrendLineStartVal, bearishTrendLineEnd, bearishTrendLineEndVal)
if not na(newBullishTrendline)
extendTrendline(newBullishTrendline, bullishTrendLineStart, bullishTrendLineStartVal, bullishTrendLineEnd, bullishTrendLineEndVal)
// ========== إعدادات FVG ==========
showFVG = input.bool(defval = true, title = "Show Fair Value Gaps", group = "FVG")
contract = input.bool(defval = false, title = "Contract Violated FVG", group = "FVG")
closeOnly = input.bool(defval = false, title = "Show Closest Up/Down FVG Only", group = "FVG")
fvgcol = input.color(defval = #f2da07, title = "FVG Color", group = "FVG")
fvgtra = input.int(defval = 30, minval = 0, maxval = 100, title = "FVG Transparency", group = "FVG")
// ========== دالة FVG ==========
fvg(direction) =>
var fvgMat = matrix.new(5)
var fvgDrawings = array.new()
fvgMat.add_col(0, array.from(math.sign(close - open), close, high, low, time))
if fvgMat.columns() > 3
fvgMat.remove_col(fvgMat.columns() - 1)
if fvgMat.row(0).sum() == direction
getDir = math.sign(direction)
= switch getDir
-1 =>
=>
col = switch closeOnly
true => #00000000
=> color.new(fvgcol, fvgtra)
fvgDrawings.push(
box.new(int(fvgMat.get(4, 1)), y, last_bar_time, y1, xloc = xloc.bar_time,
border_color = col, bgcolor = col)
)
fvgDrawings
// ========== تنفيذ FVG ==========
if showFVG
fvgDn = fvg(-3)
fvgUp = fvg(3)
// معالجة FVG الهابط
if fvgDn.size() > 0
for i = fvgDn.size() - 1 to 0
getfvg = fvgDn.get(i)
if high >= getfvg.get_top()
getfvg.delete()
fvgDn.remove(i)
else if contract
if high > getfvg.get_bottom()
getfvg.set_bottom(high)
// معالجة FVG الصاعد
if fvgUp.size() > 0
for i = fvgUp.size() - 1 to 0
getfvg = fvgUp.get(i)
if low <= getfvg.get_bottom()
getfvg.delete()
fvgUp.remove(i)
else if contract
if low < getfvg.get_top()
getfvg.set_top(low)
// إظهار أقرب FVG فقط
if closeOnly and barstate.islast
minDist = matrix.new(1, 2, 20e20)
if fvgDn.size() > 0
for i = fvgDn.size() - 1 to 0
getBottom = fvgDn.get(i).get_bottom()
minDist.set(0, 1, math.min(minDist.get(0, 1), math.abs(close - getBottom)))
if math.abs(close - getBottom) == minDist.get(0, 1)
minDist.set(0, 0, i)
fvgDn.get(i).set_right(fvgDn.get(i).get_left())
fvgDn.get(int(minDist.get(0, 0))).set_bgcolor(color.new(fvgcol, fvgtra))
fvgDn.get(int(minDist.get(0, 0))).set_border_color(color.new(fvgcol, fvgtra))
fvgDn.get(int(minDist.get(0, 0))).set_right(last_bar_time)
minDist.set(0, 0, 0)
minDist.set(0, 1, 20e20)
if fvgUp.size() > 0
for i = fvgUp.size() - 1 to 0
getTop = fvgUp.get(i).get_top()
minDist.set(0, 1, math.min(minDist.get(0, 1), math.abs(close - getTop)))
if math.abs(close - getTop) == minDist.get(0, 1)
minDist.set(0, 0, i)
fvgUp.get(i).set_right(fvgUp.get(i).get_left())
fvgUp.get(int(minDist.get(0, 0))).set_bgcolor(color.new(fvgcol, fvgtra))
fvgUp.get(int(minDist.get(0, 0))).set_border_color(color.new(fvgcol, fvgtra))
fvgUp.get(int(minDist.get(0, 0))).set_right(last_bar_time)
//----------------------------------------
// Key Levels - 4H Only
//----------------------------------------
Show_4H_Levels = input.bool(defval=true, title='عرض مستويات 4H', group='Key Levels')
Color_Resistance = input.color(title='لون المقاومة', defval=color.green, group='Key Levels', inline='colors')
Color_Support = input.color(title='لون الدعم', defval=color.red, group='Key Levels', inline='colors')
Style_4H_Levels = input.string('Dotted', 'نمط الخطوط', , group="Key Levels")
Text_4H_Levels = input.bool(defval=false, title='نص مختصر', group='Key Levels')
labelsize = input.string(defval='Medium', title='حجم النص', options= , group = "Key Levels")
// تعديل مستويات الدعم والمقاومة
Resistance_Offset = input.float(defval=0.0, title='تعديل المقاومة (نقاط)', step=0.01, group='تعديل المستويات', tooltip='رفع (+) أو خفض (-) مستوى المقاومة بالنقاط')
Support_Offset = input.float(defval=0.0, title='تعديل الدعم (نقاط)', step=0.01, group='تعديل المستويات', tooltip='رفع (+) أو خفض (-) مستوى الدعم بالنقاط')
// إعدادات خط المنتصف
Show_Middle_Line = input.bool(defval=true, title='عرض خط المنتصف', group='"0"')
Color_Middle = input.color(title='لون خط المنتصف', defval=color.blue, group='Key Levels')
//----------------------------------------
// Targets Settings
//----------------------------------------
Show_Targets = input.bool(defval=true, title='إظهار الأهداف', group='إعدادات الأهداف')
// أهداف صاعدة (بعد اختراق المقاومة)
Target1_Up_Distance = input.float(defval=0.5, title='المسافة للهدف الأول %', minval=0.01, step=0.1, group='أهداف الاختراق (صعود)')
Color_Target1_Up = input.color(title='لون الهدف الأول', defval=color.new(color.lime, 40), group='أهداف الاختراق (صعود)')
Target2_Up_Distance = input.float(defval=1.0, title='المسافة للهدف الثاني %', minval=0.01, step=0.1, group='أهداف الاختراق (صعود)')
Color_Target2_Up = input.color(title='لون الهدف الثاني', defval=color.new(color.lime, 20), group='أهداف الاختراق (صعود)')
Target3_Up_Distance = input.float(defval=1.5, title='المسافة للهدف الثالث %', minval=0.01, step=0.1, group='أهداف الاختراق (صعود)')
Color_Target3_Up = input.color(title='لون الهدف الثالث', defval=color.lime, group='أهداف الاختراق (صعود)')
// أهداف هابطة (بعد كسر الدعم)
Target1_Down_Distance = input.float(defval=0.5, title='المسافة للهدف الأول %', minval=0.01, step=0.1, group='أهداف الكسر (هبوط)')
Color_Target1_Down = input.color(title='لون الهدف الأول', defval=color.new(color.fuchsia, 40), group='أهداف الكسر (هبوط)')
Target2_Down_Distance = input.float(defval=1.0, title='المسافة للهدف الثاني %', minval=0.01, step=0.1, group='أهداف الكسر (هبوط)')
Color_Target2_Down = input.color(title='لون الهدف الثاني', defval=color.new(color.fuchsia, 20), group='أهداف الكسر (هبوط)')
Target3_Down_Distance = input.float(defval=1.5, title='المسافة للهدف الثالث %', minval=0.01, step=0.1, group='أهداف الكسر (هبوط)')
Color_Target3_Down = input.color(title='لون الهدف الثالث', defval=color.fuchsia, group='أهداف الكسر (هبوط)')
Style_Targets = input.string('Dashed', 'نمط خطوط الأهداف', , group="إعدادات الأهداف")
//----------------------------------------
// Signal Settings
//----------------------------------------
Show_Signals = input.bool(defval=true, title='إظهار إشارات البيع والشراء', group='إعدادات الإشارات')
Signal_Size = input.string(defval='Normal', title='حجم الإشارة', options= , group='إعدادات الإشارات')
Color_Buy_Signal = input.color(title='لون إشارة الشراء', defval=color.new(color.lime, 0), group='إعدادات الإشارات')
Color_Sell_Signal = input.color(title='لون إشارة البيع', defval=color.new(color.red, 0), group='إعدادات الإشارات')
//----------------------------------------
// FVG Settings
//----------------------------------------
Show_FVG = input.bool(defval=true, title='إظهار FVG', group='إعدادات FVG')
FVG_Lookback = input.int(defval=10, title='عدد الشموع للبحث عن FVG', minval=3, maxval=50, group='إعدادات FVG')
Color_Bullish_FVG = input.color(title='لون FVG الصاعد', defval=color.new(color.lime, 80), group='إعدادات FVG')
Color_Bearish_FVG = input.color(title='لون FVG الهابط', defval=color.new(color.red, 80), group='إعدادات FVG')
FVG_Border_Color = input.color(title='لون إطار FVG', defval=color.new(color.gray, 50), group='إعدادات FVG')
//========================================
// HELPER FUNCTIONS
//========================================
// Format price display
formatPrice(float price) =>
str.tostring(price, format.mintick)
// Get signal size
getSignalSize(string size_str) =>
switch size_str
'Tiny' => size.tiny
'Small' => size.small
'Normal' => size.normal
'Large' => size.large
'Huge' => size.huge
=> size.normal
// Get line style
getLineStyle(string x) =>
switch x
'Solid' => line.style_solid
'Dashed' => line.style_dashed
'Dotted' => line.style_dotted
=> line.style_solid
// Get font size
getFontSize(string size_str) =>
switch size_str
'Small' => size.small
'Medium' => size.normal
'Large' => size.large
=> size.normal
// Detect Bullish FVG
detectBullishFVG(int lookback) =>
float fvg_top = na
float fvg_bottom = na
int fvg_left = na
if bar_index >= 3
int max_bars = math.min(lookback, bar_index - 2)
for i = 1 to max_bars
if bar_index >= i + 1
if low > high
fvg_top := low
fvg_bottom := high
fvg_left := bar_index - i
break
// Detect Bearish FVG
detectBearishFVG(int lookback) =>
float fvg_top = na
float fvg_bottom = na
int fvg_left = na
if bar_index >= 3
int max_bars = math.min(lookback, bar_index - 2)
for i = 1 to max_bars
if bar_index >= i + 1
if high < low
fvg_top := low
fvg_bottom := high
fvg_left := bar_index - i
break
// Extend line to current bar
extendToCurrentBar(int offset_bars) =>
timenow + (time - time ) * offset_bars
//========================================
// MAIN CALCULATIONS
//========================================
// Get 4H levels
= request.security(syminfo.tickerid, '240', [time , high ], lookahead=barmerge.lookahead_on)
= request.security(syminfo.tickerid, '240', [time , low ], lookahead=barmerge.lookahead_on)
// Apply offsets to levels
float adjusted_resistance = intrah_value + Resistance_Offset
float adjusted_support = intral_value + Support_Offset
// Text labels
string resistance_text = Text_4H_Levels ? 'كول' : 'مقاومة'
string support_text = Text_4H_Levels ? 'بوت' : 'دعم'
// Style settings
int line_width = 1
string font_size = getFontSize(labelsize)
string line_style = getLineStyle(Style_4H_Levels)
string target_style = getLineStyle(Style_Targets)
int distance_right = 25
//========================================
// BREAKOUT DETECTION & TRACKING
//========================================
var bool resistance_broken = false
var bool support_broken = false
var float last_resistance = na
var float last_support = na
var int buy_signal_bar = na
var int sell_signal_bar = na
var float buy_signal_price = na
var float sell_signal_price = na
// Detect resistance breakout
if close > adjusted_resistance and not resistance_broken
resistance_broken := true
support_broken := false
last_resistance := adjusted_resistance
buy_signal_bar := bar_index
buy_signal_price := adjusted_resistance
// Detect support breakdown
if close < adjusted_support and not support_broken
support_broken := true
resistance_broken := false
last_support := adjusted_support
sell_signal_bar := bar_index
sell_signal_price := adjusted_support
// Cancel breakout if price returns
if close < adjusted_resistance and resistance_broken
resistance_broken := false
buy_signal_bar := na
buy_signal_price := na
if close > adjusted_support and support_broken
support_broken := false
sell_signal_bar := na
sell_signal_price := na
// Reset on new level formation
if adjusted_resistance != last_resistance
resistance_broken := false
last_resistance := adjusted_resistance
buy_signal_bar := na
buy_signal_price := na
if adjusted_support != last_support
support_broken := false
last_support := adjusted_support
sell_signal_bar := na
sell_signal_price := na
//========================================
// DRAWING - SUPPORT & RESISTANCE LEVELS
//========================================
if barstate.islast and Show_4H_Levels
int right_extension = extendToCurrentBar(distance_right)
// Draw Resistance Line
var line resistance_line = line.new(na, na, na, na, xloc=xloc.bar_time, color=Color_Resistance, width=line_width, style=line_style)
line.set_xy1(resistance_line, intrah_time, adjusted_resistance)
line.set_xy2(resistance_line, right_extension, adjusted_resistance)
line.set_color(resistance_line, Color_Resistance)
var label resistance_label = label.new(na, na, text="", xloc=xloc.bar_time, style=label.style_none, textcolor=Color_Resistance, size=font_size)
label.set_xy(resistance_label, right_extension, adjusted_resistance)
label.set_text(resistance_label, formatPrice(adjusted_resistance) + " " + resistance_text)
label.set_textcolor(resistance_label, Color_Resistance)
// Draw Support Line
var line support_line = line.new(na, na, na, na, xloc=xloc.bar_time, color=Color_Support, width=line_width, style=line_style)
line.set_xy1(support_line, intral_time, adjusted_support)
line.set_xy2(support_line, right_extension, adjusted_support)
line.set_color(support_line, Color_Support)
var label support_label = label.new(na, na, text="", xloc=xloc.bar_time, style=label.style_none, textcolor=Color_Support, size=font_size)
label.set_xy(support_label, right_extension, adjusted_support)
label.set_text(support_label, formatPrice(adjusted_support) + " " + support_text)
label.set_textcolor(support_label, Color_Support)
// Draw Middle Line
if Show_Middle_Line
float middle_price = (adjusted_resistance + adjusted_support) / 2
var line middle_line = line.new(na, na, na, na, xloc=xloc.bar_time, color=Color_Middle, width=line_width, style=line_style)
line.set_xy1(middle_line, intrah_time, middle_price)
line.set_xy2(middle_line, right_extension, middle_price)
line.set_color(middle_line, Color_Middle)
var label middle_label = label.new(na, na, text="", xloc=xloc.bar_time, style=label.style_none, textcolor=Color_Middle, size=font_size)
label.set_xy(middle_label, right_extension, middle_price)
label.set_text(middle_label, formatPrice(middle_price) +"0")
label.set_textcolor(middle_label, Color_Middle)
//========================================
// DRAWING - BULLISH TARGETS & SIGNALS
//========================================
if barstate.islast and Show_Targets and resistance_broken
int right_extension = extendToCurrentBar(distance_right)
// Buy Signal
if Show_Signals and not na(buy_signal_bar)
var label buy_label = label.new(na, na, text="شراء BUY", style=label.style_label_up, color=Color_Buy_Signal, textcolor=color.white, size=getSignalSize(Signal_Size))
label.set_xy(buy_label, buy_signal_bar, buy_signal_price)
label.set_color(buy_label, Color_Buy_Signal)
label.set_size(buy_label, getSignalSize(Signal_Size))
// Bullish FVG Box
if Show_FVG
= detectBullishFVG(FVG_Lookback)
if not na(bull_top) and not na(bull_bottom) and not na(bull_left)
var box bull_box = box.new(na, na, na, na, xloc=xloc.bar_index, bgcolor=Color_Bullish_FVG, border_color=FVG_Border_Color, border_width=1)
box.set_lefttop(bull_box, bull_left, bull_top)
box.set_rightbottom(bull_box, bar_index, bull_bottom)
box.set_bgcolor(bull_box, Color_Bullish_FVG)
box.set_border_color(bull_box, FVG_Border_Color)
// Calculate Target Prices
float target1_price = adjusted_resistance * (1 + Target1_Up_Distance / 100)
float target2_price = adjusted_resistance * (1 + Target2_Up_Distance / 100)
float target3_price = adjusted_resistance * (1 + Target3_Up_Distance / 100)
// Target 1
var line t1_line = line.new(na, na, na, na, xloc=xloc.bar_time, color=Color_Target1_Up, width=2, style=target_style)
line.set_xy1(t1_line, intrah_time, target1_price)
line.set_xy2(t1_line, right_extension, target1_price)
line.set_color(t1_line, Color_Target1_Up)
var label t1_label = label.new(na, na, text="", xloc=xloc.bar_time, style=label.style_none, textcolor=Color_Target1_Up, size=size.small)
label.set_xy(t1_label, right_extension, target1_price)
label.set_text(t1_label, formatPrice(target1_price) + " ⬆ T1")
label.set_textcolor(t1_label, Color_Target1_Up)
// Target 2
var line t2_line = line.new(na, na, na, na, xloc=xloc.bar_time, color=Color_Target2_Up, width=2, style=target_style)
line.set_xy1(t2_line, intrah_time, target2_price)
line.set_xy2(t2_line, right_extension, target2_price)
line.set_color(t2_line, Color_Target2_Up)
var label t2_label = label.new(na, na, text="", xloc=xloc.bar_time, style=label.style_none, textcolor=Color_Target2_Up, size=size.small)
label.set_xy(t2_label, right_extension, target2_price)
label.set_text(t2_label, formatPrice(target2_price) + " ⬆ T2")
label.set_textcolor(t2_label, Color_Target2_Up)
// Target 3
var line t3_line = line.new(na, na, na, na, xloc=xloc.bar_time, color=Color_Target3_Up, width=2, style=target_style)
line.set_xy1(t3_line, intrah_time, target3_price)
line.set_xy2(t3_line, right_extension, target3_price)
line.set_color(t3_line, Color_Target3_Up)
var label t3_label = label.new(na, na, text="", xloc=xloc.bar_time, style=label.style_none, textcolor=Color_Target3_Up, size=size.small)
label.set_xy(t3_label, right_extension, target3_price)
label.set_text(t3_label, formatPrice(target3_price) + " ⬆ T3")
label.set_textcolor(t3_label, Color_Target3_Up)
//========================================
// DRAWING - BEARISH TARGETS & SIGNALS
//========================================
if barstate.islast and Show_Targets and support_broken
int right_extension = extendToCurrentBar(distance_right)
// Sell Signal
if Show_Signals and not na(sell_signal_bar)
var label sell_label = label.new(na, na, text="بيع SELL", style=label.style_label_down, color=Color_Sell_Signal, textcolor=color.white, size=getSignalSize(Signal_Size))
label.set_xy(sell_label, sell_signal_bar, sell_signal_price)
label.set_color(sell_label, Color_Sell_Signal)
label.set_size(sell_label, getSignalSize(Signal_Size))
// Bearish FVG Box
if Show_FVG
= detectBearishFVG(FVG_Lookback)
if not na(bear_top) and not na(bear_bottom) and not na(bear_left)
var box bear_box = box.new(na, na, na, na, xloc=xloc.bar_index, bgcolor=Color_Bearish_FVG, border_color=FVG_Border_Color, border_width=1)
box.set_lefttop(bear_box, bear_left, bear_top)
box.set_rightbottom(bear_box, bar_index, bear_bottom)
box.set_bgcolor(bear_box, Color_Bearish_FVG)
box.set_border_color(bear_box, FVG_Border_Color)
// Calculate Target Prices
float target1_price = adjusted_support * (1 - Target1_Down_Distance / 100)
float target2_price = adjusted_support * (1 - Target2_Down_Distance / 100)
float target3_price = adjusted_support * (1 - Target3_Down_Distance / 100)
// Target 1
var line t1_down_line = line.new(na, na, na, na, xloc=xloc.bar_time, color=Color_Target1_Down, width=2, style=target_style)
line.set_xy1(t1_down_line, intral_time, target1_price)
line.set_xy2(t1_down_line, right_extension, target1_price)
line.set_color(t1_down_line, Color_Target1_Down)
var label t1_down_label = label.new(na, na, text="", xloc=xloc.bar_time, style=label.style_none, textcolor=Color_Target1_Down, size=size.small)
label.set_xy(t1_down_label, right_extension, target1_price)
label.set_text(t1_down_label, formatPrice(target1_price) + " ⬇ T1")
label.set_textcolor(t1_down_label, Color_Target1_Down)
// Target 2
var line t2_down_line = line.new(na, na, na, na, xloc=xloc.bar_time, color=Color_Target2_Down, width=2, style=target_style)
line.set_xy1(t2_down_line, intral_time, target2_price)
line.set_xy2(t2_down_line, right_extension, target2_price)
line.set_color(t2_down_line, Color_Target2_Down)
var label t2_down_label = label.new(na, na, text="", xloc=xloc.bar_time, style=label.style_none, textcolor=Color_Target2_Down, size=size.small)
label.set_xy(t2_down_label, right_extension, target2_price)
label.set_text(t2_down_label, formatPrice(target2_price) + " ⬇ T2")
label.set_textcolor(t2_down_label, Color_Target2_Down)
// Target 3
var line t3_down_line = line.new(na, na, na, na, xloc=xloc.bar_time, color=Color_Target3_Down, width=2, style=target_style)
line.set_xy1(t3_down_line, intral_time, target3_price)
line.set_xy2(t3_down_line, right_extension, target3_price)
line.set_color(t3_down_line, Color_Target3_Down)
var label t3_down_label = label.new(na, na, text="", xloc=xloc.bar_time, style=label.style_none, textcolor=Color_Target3_Down, size=size.small)
label.set_xy(t3_down_label, right_extension, target3_price)
label.set_text(t3_down_label, formatPrice(target3_price) + " ⬇ T3")
label.set_textcolor(t3_down_label, Color_Target3_Down)
// ===== إعدادات =====
src = input.source(close, "Source")
anchor = input.string( "top_right", "موقع الجدول", options= )
v_step = input.int(0, "تحريك عمودي 0 أعلى .. 1 أسفل", minval=0, maxval=1)
h_step = input.int(0, "تحريك أفقي 0 يسار .. 1 يمين", minval=0, maxval=1)
size_step = input.int(1, "حجم الخط 0 صغير جدًا .. 5 كبير", minval=0, maxval=5)
show_table = input.bool(true, "إظهار الجدول؟")
// ===== حساب RSI =====
r = ta.rsi(src, rsiLength)
// ===== حساب Flow (عرض وطلب) كمثال =====
FlowUp = close > open
FlowDown = close < open
FlowText = FlowUp ? "🟢" : FlowDown ? "🔴" : "⚪"
// ===== ألوان RSI =====
bgColor = r > 56 ? color.green : (r < 44 ? color.red : color.gray)
numColor = color.white
// ===== حجم الخط =====
textSizes = array.from(size.tiny, size.small, size.normal, size.large, size.large, size.large)
tsize = array.get(textSizes, size_step)
// ===== إنشاء جدول مصغر جدًا 2x2 =====
var int grid = 2
pos = anchor == "top_right" ? position.top_right :
anchor == "top_left" ? position.top_left :
anchor == "bottom_right" ? position.bottom_right : position.bottom_left
var table tbl = table.new(pos, grid, grid, frame_width=0, frame_color=color.black)
// ===== تحديث الجدول =====
if show_table
cellText = "قوة:" + str.tostring(r, "#.0") + FlowText
for row = 0 to grid-1
for col = 0 to grid-1
if row == v_step and col == h_step
table.cell(tbl, row, col, text=cellText, text_color=numColor, bgcolor=bgColor, text_size=tsize)
// # ========================================================================= #
// # | Colors |
// # ========================================================================= #
//#region
// # Core -------------------------------------------------------------------- #
colors_orange = color.rgb(246, 255, 0)
colors_blue = color.rgb(243, 246, 246)
colors_aqua = color.rgb(237, 245, 12)
colors_red = color.red
colors_green = color.rgb(246, 246, 16)
colors_maroon = color.maroon
colors_purple = color.rgb(9, 94, 253)
colors_gray = color.rgb(250, 6, 6)
colors_transparent = color.new(color.white,100)
//#endregion
// # ========================================================================= #
// # | End |
// # ========================================================================= #
// # ========================================================================= #
// # | Inputs |
// # ========================================================================= #
//#region
// # General ----------------------------------------------------------------- #
general_font = input.string("Monospace", "Text ", options = , inline = "5", group = "General")
general_text = input.string("Tiny", "", options = , inline = "5", group = "General", tooltip = "Customize global text size and style")
general_brand_show = input.bool(false, "Hide Brand", group = "General")
// # LKZ --------------------------------------------------------------------- #
hl_daily = input.bool(true, "Day ", inline = "1", group = "HTF Levels")
hl_weekly = input.bool(false, "Week ", inline = "2", group = "HTF Levels")
hl_monthly = input.bool(false, "Month ", inline = "3", group = "HTF Levels")
hl_quartely = input.bool(false, "Quarter ", inline = "4", group = "HTF Levels")
hl_yearly = input.bool(false, "Year ", inline = "5", group = "HTF Levels")
hl_css_daily = input.color(colors_blue, "", inline = "1", group = "HTF Levels")
hl_css_weekly = input.color(colors_green, "", inline = "2", group = "HTF Levels")
hl_css_monthly = input.color(colors_purple, "", inline = "3", group = "HTF Levels")
hl_css_quaterly = input.color(colors_maroon, "", inline = "4", group = "HTF Levels")
hl_css_yearly = input.color(colors_gray, "", inline = "5", group = "HTF Levels")
hl_line_daily = input.string('⎯⎯⎯', '', inline = '1', group = "HTF Levels", options = )
hl_line_weekly = input.string('⎯⎯⎯', '', inline = '2', group = "HTF Levels", options = )
hl_line_monthly = input.string('⎯⎯⎯', '', inline = '3', group = "HTF Levels", options = )
hl_line_quaterly = input.string('⎯⎯⎯', '', inline = '4', group = "HTF Levels", options = )
hl_line_yearly = input.string('⎯⎯⎯', '', inline = '5', group = "HTF Levels", options = )
hl_line_width_daily = input.int(1, '', inline = '1', group = "HTF Levels", minval = 1, maxval = 5)
hl_line_width_weekly = input.int(1, '', inline = '2', group = "HTF Levels", minval = 1, maxval = 5)
hl_line_width_monthly = input.int(1, '', inline = '3', group = "HTF Levels", minval = 1, maxval = 5)
hl_line_width_quaterly = input.int(1, '', inline = '4', group = "HTF Levels", minval = 1, maxval = 5)
hl_line_width_yearly = input.int(1, '', inline = '5', group = "HTF Levels", minval = 1, maxval = 5)
hl_midline = input.bool(true, "Show Average ", inline = "6" , group = "HTF Levels")
hl_midline_css = input.color(colors_aqua, "", inline = "6", group = "HTF Levels")
hl_midline_type = input.string("----", "", inline = "6", group = "HTF Levels", options = , tooltip = "Show highs & lows mid-line")
hl_midline_width = input.int(1, "", inline = "6", group = "HTF Levels", tooltip = "Change mid-line highs & lows width")
hl_openline = input.bool(true, "Show Open ", inline = "7" , group = "HTF Levels")
hl_openline_css = input.color(colors_orange, "", inline = "7", group = "HTF Levels")
hl_openline_type = input.string("····", "", inline = "7", group = "HTF Levels", options = , tooltip = "Show highs & lows mid-line")
hl_openline_width = input.int(1, "", inline = "7", group = "HTF Levels", tooltip = "Change mid-line highs & lows width")
//#endregion
// # ========================================================================= #
// # | End |
// # ========================================================================= #
// # ========================================================================= #
// # | UDTs |
// # ========================================================================= #
//#region
type UDT_Store
line hl_ln
label hl_lbl
type UDT_MTF
int x1 = na
int x2 = na
float y1 = na
float y2 = na
type UDT_HTF_Candle
string tf
// real coordinates of HTF candle
float o
float c
float h
float l
int ot
int ct
int ht
int lt
bool bull
//#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 line) =>
out = switch line
'⎯⎯⎯' => 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
shift_to_right(int current, int length, string tf) =>
current + timeframe.in_seconds(tf) * 1000 * (length + 1)
shift_to_left(int current, int prev, int length) =>
current - (current - prev) * length + 1
shift_bars_to_right(int bars) =>
bars + 20
//#endregion
// # ========================================================================= #
// # | End |
// # ========================================================================= #
// # ========================================================================= #
// # | Store |
// # ========================================================================= #
//#region
var UDT_Store bin = UDT_Store.new(hl_ln = array.new(), hl_lbl = array.new())
method clean_hl(UDT_Store store) =>
for obj in store.hl_ln
obj.delete()
for obj in store.hl_lbl
obj.delete()
store.hl_ln.clear()
store.hl_lbl.clear()
//#endregion
// # ========================================================================= #
// # | End |
// # ========================================================================= #
// # ========================================================================= #
// # | Highs & Lows MTF |
// # ========================================================================= #
//#region
method draw_pivots_ol_line(UDT_MTF mtf) =>
ol = line.new(
x1 = mtf.x1
, y1 = mtf.y1
, x2 = mtf.x2
, y2 = mtf.y2
, xloc = xloc.bar_time
, color = hl_openline_css
, style = line_style(hl_openline_type)
, width = hl_openline_width
)
bin.hl_ln.push(ol)
mtf
method draw_pivots_hl_line(UDT_MTF mtf, color css, string pdhl_style, int line_width) =>
hl = line.new(
x1 = mtf.x1
, y1 = mtf.y1
, x2 = mtf.x2
, y2 = mtf.y2
, xloc = xloc.bar_time
, color = css
, style = line_style(pdhl_style)
, width = line_width
)
bin.hl_ln.push(hl)
mtf
method draw_pivots_mid_line(UDT_MTF mtf) =>
ml = line.new(
x1 = mtf.x1
, y1 = mtf.y1
, x2 = mtf.x2
, y2 = mtf.y2
, xloc = xloc.bar_time
, color = hl_midline_css
, style = line_style(hl_midline_type)
, width = hl_midline_width
)
bin.hl_ln.push(ml)
mtf
method draw_pivots_ll_line(UDT_MTF mtf, color css, string pdhl_style, int line_width) =>
ll = line.new(
x1 = mtf.x1
, y1 = mtf.y1
, x2 = mtf.x2
, y2 = mtf.y2
, xloc = xloc.bar_time
, color = css
, style = line_style(pdhl_style)
, width = line_width
)
bin.hl_ln.push(ll)
mtf
method draw_pivots_label(UDT_MTF mtf, string fmt, string tf, color css) =>
lbl = label.new(
x = mtf.x2
, y = mtf.y2
, xloc = xloc.bar_time
, text = str.format(fmt, tf)
, color = colors_transparent
, textcolor = css
, size = text_size(general_text)
, style = label.style_label_left
, text_font_family = font_style(general_font)
)
bin.hl_lbl.push(lbl)
mtf
method mtf_pivots(UDT_HTF_Candle candle, tf, css
فلتر فوليوم// This work is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
// creativecommons.org
// © BigBeluga
//@version=6
indicator("فلتر فوليوم", max_labels_count = 500, max_lines_count = 500)
// INPUTS ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
int length = input.int(20, minval=1, title="Filter Length")
bool disp_lvl = input.bool(true, "Levels")
color up_color = input.color(color.rgb(8, 245, 59), "", inline = "color")
color dn_color = input.color(color.rgb(243, 2, 2), "", inline = "color")
var buy_line = line(na)
var sell_line = line(na)
// }
// CALCULATIONS――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
float sma1 = ta.sma(close, 25)
float sma_n1 = ((close - sma1) - ta.sma(close - sma1, 25)) / ta.stdev(close - sma1, 25)
float area = ta.sma(high-low, 100)
// Two-pole smooth filter function
f_two_pole_filter(source, length) =>
var float smooth1 = na
var float smooth2 = na
alpha = 2.0 / (length + 1)
if na(smooth1)
smooth1 := source
else
smooth1 := (1 - alpha) * smooth1 + alpha * source
if na(smooth2)
smooth2 := smooth1
else
smooth2 := (1 - alpha) * smooth2 + alpha * smooth1
// Oscillator
two_p = f_two_pole_filter(sma_n1, length)
two_pp = two_p
// Colors
color buy_col1 = color.from_gradient(two_p, -1, 0.5, up_color, na)
color buy_col2 = color.from_gradient(two_p, -1, 0.5, color.new(up_color, 50), na)
color sell_col1 = color.from_gradient(two_p, -0.5, 1, na, dn_color)
color sell_col2 = color.from_gradient(two_p, -0.5, 1, na, color.new(dn_color, 50))
color color = two_p > two_pp
? color.from_gradient(two_p, -1,1, up_color, color.new(up_color, 0))
: color.from_gradient(two_p, -1,1,color.new(dn_color, 0), dn_color)
// Signals
bool buy = ta.crossover(two_p, two_pp) and two_p < 0 and barstate.isconfirmed
bool sell = ta.crossunder(two_p, two_pp) and two_p > 0 and barstate.isconfirmed
// }
// PLOT ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
if buy //and two_p < -0.5
sell_line := line(na)
if disp_lvl
buy_line := line.new(
bar_index-1
, low - area
, bar_index
, low - area
, force_overlay = true
, color = buy_col1
, style = line.style_dashed
)
label.new(bar_index-1, low - area
, color = buy_col1, style = label.style_label_up, force_overlay = true, size = size.tiny)
if ta.crossunder(low, buy_line.get_y1()) and barstate.isconfirmed
label.new(
bar_index-1
, buy_line.get_y1()
, color = color.new(up_color, 100)
, style = label.style_label_center
, force_overlay = true
, size = size.large
, text = "✖"
, textcolor = up_color
)
buy_line := line(na)
if sell //and two_p > 0.5
buy_line := line(na)
if disp_lvl
sell_line := line.new(
bar_index-1
, high + area
, bar_index
, high + area
, force_overlay = true
, color = sell_col1
, style = line.style_dashed
)
label.new(bar_index-1, high + area
, color = sell_col1, style = label.style_label_down, force_overlay = true, size = size.tiny)
if ta.crossover(high, sell_line.get_y1()) and barstate.isconfirmed
label.new(
bar_index-1
, sell_line.get_y1()
, color = color.new(dn_color, 100)
, style = label.style_label_center
, force_overlay = true
, size = size.large
, text = "✖"
, textcolor = dn_color
)
sell_line := line(na)
switch
not na(buy_line) => buy_line. set_x2(bar_index)
not na(sell_line) => sell_line.set_x2(bar_index)
plotshape(buy ? two_p : na, "كول", shape.circle, location.absolute, buy_col2, -1, size = size.small)
plotshape(buy ? two_p : na, "كول", shape.circle, location.absolute, buy_col1, -1, size = size.tiny)
plotshape(sell ? two_p : na, "بوت", shape.circle, location.absolute, sell_col2, -1, size = size.small)
plotshape(sell ? two_p : na, "بوت", shape.circle, location.absolute, sell_col1, -1, size = size.tiny)
p11 = plot(1, color = color.new(chart.fg_color, 80))
plot(0.5, color = color.new(chart.fg_color, 50))
p00 = plot(0, color = color.new(bar_index % 2 == 0 ? chart.fg_color : na, 0))
plot(-0.5, color = color.new(chart.fg_color, 50))
p_1 = plot(-1, color = color.new(chart.fg_color, 80))
fill(p11, p00, 2, -1, color.new(chart.fg_color, 80), na)
fill(p_1, p00, 1, -2, na, color.new(chart.fg_color, 80))
p1 = plot(two_p, color = color, linewidth = 1)
p2 = plot(two_pp, display = display.none)
fill(p1, p2, two_p, two_pp, color, na)
// }
//@version=6
// indicator("Technical Ratings", "Technicals", precision = 2)
import TradingView/TechnicalRating/3 as rating
res = input.timeframe("", "Indicator Timeframe")
ratingSignal = input.string("All", "Rating is based on", options = )
GRP1 = "Show MTF"
useMtf1 = input(false, "", inline = "mtf1", group = GRP1)
mtf1 = input.timeframe("60", "", inline = "mtf1", group = GRP1, active = useMtf1)
useMtf2 = input(false, "", inline = "mtf2", group = GRP1)
mtf2 = input.timeframe("240", "", inline = "mtf2", group = GRP1, active = useMtf2)
useMtf3 = input(true, "", inline = "mtf3", group = GRP1)
mtf3 = input.timeframe("1D", "", inline = "mtf3", group = GRP1, active = useMtf3)
useMtf4 = input(true, "", inline = "mtf4", group = GRP1)
mtf4 = input.timeframe("1W", "", inline = "mtf4", group = GRP1, active = useMtf4)
useMtf5 = input(true, "", inline = "mtf5", group = GRP1)
mtf5 = input.timeframe("1M", "", inline = "mtf5", group = GRP1, active = useMtf5)
GRP2 = "Color Settings"
colBuy = input(#5b9cf6, "Buy ", inline = "كول Colors", group = GRP2)
colStrongBuy = input(#2962ff, "", inline = "كول Colors", group = GRP2)
colNeutral = input(#a8adbc, "Neutral ", inline = "تذبذب", group = GRP2)
colSell = input(#ef9a9a, "Sell ", inline = "بوت Colors", group = GRP2)
colStrongSell = input(#f44336, "", inline = "بوت Colors", group = GRP2)
tableTitleColor = input(#295b79, "Headers", inline = "تذبذب", group = GRP2)
StrongBound = 0.5
WeakBound = 0.1
getSignal(ratingTotal, ratingOther, ratingMA) =>
if ratingSignal == "MAs"
ratingMA
else if ratingSignal == "Oscillators"
ratingOther
else
ratingTotal
= request.security(syminfo.tickerid, res, rating.calcRatingAll())
= request.security(syminfo.tickerid, mtf1, rating.calcRatingAll())
= request.security(syminfo.tickerid, mtf2, rating.calcRatingAll())
= request.security(syminfo.tickerid, mtf3, rating.calcRatingAll())
= request.security(syminfo.tickerid, mtf4, rating.calcRatingAll())
= request.security(syminfo.tickerid, mtf5, rating.calcRatingAll())
tradeSignal = getSignal(ratingTotalCurrent, ratingOtherCurrent, ratingMACurrent)
calcRatingStatus(value) =>
if na(value)
"-"
else if -StrongBound > value
"Strong بوت"
else if value < -WeakBound
"Sell "
else if value > StrongBound
"Strong كول "
else if value > WeakBound
"كول "
else
"تذبذب"
allRatingsArray = array.from("All", calcRatingStatus(ratingTotalCurrent), calcRatingStatus(ratingTotal_mtf1), calcRatingStatus(ratingTotal_mtf2),
calcRatingStatus(ratingTotal_mtf3), calcRatingStatus(ratingTotal_mtf4), calcRatingStatus(ratingTotal_mtf5))
oscRatingsArray = array.from("Osc", calcRatingStatus(ratingOtherCurrent), calcRatingStatus(ratingOther_mtf1), calcRatingStatus(ratingOther_mtf2),
calcRatingStatus(ratingOther_mtf3), calcRatingStatus(ratingOther_mtf4), calcRatingStatus(ratingOther_mtf5))
maRatingsArray = array.from("MAs", calcRatingStatus(ratingMACurrent), calcRatingStatus(ratingMA_mtf1), calcRatingStatus(ratingMA_mtf2),
calcRatingStatus(ratingMA_mtf3), calcRatingStatus(ratingMA_mtf4), calcRatingStatus(ratingMA_mtf5))
currentRes = res==""?timeframe.period:res
allResArray = array.from("TF", currentRes, mtf1, mtf2, mtf3, mtf4, mtf5)
usedMtfArray = array.from(true, true, useMtf1, useMtf2, useMtf3, useMtf4, useMtf5)
removeUnused(duplicatedIndex) =>
if array.size(duplicatedIndex) > 0
int size = array.size(duplicatedIndex)-1
for j=0 to size
int currentDupIndex = array.shift(duplicatedIndex)
array.remove(allResArray, currentDupIndex-j)
array.remove(usedMtfArray, currentDupIndex-j)
array.remove(allRatingsArray, currentDupIndex-j)
array.remove(oscRatingsArray, currentDupIndex-j)
array.remove(maRatingsArray, currentDupIndex-j)
eraseDuplicatedAndDisabledTf() =>
int duplicatedIndex = array.new_int()
for m=1 to array.size(allResArray)-1
bool isCurrentMtfDisabled = array.get(usedMtfArray, m) == false
if isCurrentMtfDisabled
array.push(duplicatedIndex, m)
removeUnused(duplicatedIndex)
for m=1 to array.size(allResArray)-1
int firstSearchElemIndex = array.indexof(allResArray, array.get(allResArray, m))
int lastSearchElemIndex = array.lastindexof(allResArray, array.get(allResArray, m))
if firstSearchElemIndex == lastSearchElemIndex or array.indexof(duplicatedIndex, lastSearchElemIndex) != -1
continue
string searchElem = array.get(allResArray, firstSearchElemIndex)
for i=firstSearchElemIndex+1 to lastSearchElemIndex
string currentElem = array.get(allResArray, i)
if searchElem == currentElem
array.push(duplicatedIndex, i)
removeUnused(duplicatedIndex)
poscond = tradeSignal > WeakBound
negcond = tradeSignal < -WeakBound
posseries = poscond ? tradeSignal : 0
negseries = negcond ? tradeSignal : 0
count_rising(plot) =>
v_plot = plot > 0 ? plot : -plot
var count = 0
if v_plot == 0
count := 0
else if v_plot >= v_plot
count := math.min(5, count + 1)
else if v_plot < v_plot
count := math.max(1, count - 1)
count
poscount = count_rising(posseries)
negcount = count_rising(negseries)
_pc = poscond ? poscount : negcond ? negcount : 0
colorTransp(col, transp) =>
red = color.r(col)
green = color.g(col)
blue = color.b(col)
color.rgb(red, green, blue, transp)
hline(1, color=colorTransp(colBuy, 50), linestyle=hline.style_solid)
hline(0.5, color=colorTransp(colBuy, 50), linestyle=hline.style_dashed)
hline(-1, color=colorTransp(colSell, 50), linestyle=hline.style_solid)
hline(-0.5, color=colorTransp(colSell, 50), linestyle=hline.style_dashed)
f_cellBgColor(_signal) =>
_returnColor = tableTitleColor
if _signal == "بوت "
_returnColor := colSell
else if _signal == "Strong بوت"
_returnColor := colStrongSell
else if _signal == "كول "
_returnColor := colBuy
else if _signal == "Strong كول "
_returnColor := colStrongBuy
else if _signal == "تذبذب" or _signal == "-"
_returnColor := colNeutral
_returnColor
f_cellAlign(_cellTitle) =>
_align = text.align_left
if _cellTitle == "MAs" or _cellTitle == "Osc" or _cellTitle == "All" or _cellTitle == "-"
_align := text.align_center
_align
f_addCell(_table, _column, _row, _cellTitle) =>
table.cell(_table, _column, _row, _cellTitle, text_color=color.white, text_halign=f_cellAlign(_cellTitle), bgcolor=f_cellBgColor(_cellTitle), text_size=size.small)
f_drawInfo() =>
var t1 = table.new(position.middle_right, 4, array.size(allRatingsArray), frame_width=2, frame_color=color.white, border_width=1, border_color=color.white)
eraseDuplicatedAndDisabledTf()
timeframesCount = array.size(allResArray)
if timeframesCount < 3
for i=0 to timeframesCount-1
f_addCell(t1, i, 1, array.get(maRatingsArray, i))
f_addCell(t1, i, 2, array.get(oscRatingsArray, i))
f_addCell(t1, i, 3, array.get(allRatingsArray, i))
else
for i=0 to timeframesCount-1
f_addCell(t1, 0, i, array.get(allResArray, i))
if ratingSignal == "All"
f_addCell(t1, 1, i, array.get(maRatingsArray, i))
f_addCell(t1, 2, i, array.get(oscRatingsArray, i))
f_addCell(t1, 3, i, array.get(allRatingsArray, i))
if ratingSignal == "Oscillators"
f_addCell(t1, 1, i, array.get(oscRatingsArray, i))
if ratingSignal == "MAs"
f_addCell(t1, 1, i, array.get(maRatingsArray, i))
col_buy = color.from_gradient(tradeSignal, 0.0, 0.2, colNeutral, colStrongBuy)
col_sell = color.from_gradient(tradeSignal, -0.2, 0.0, colStrongSell, colNeutral)
col_gradient = color.from_gradient(tradeSignal, -0.2, 0.2, col_sell, col_buy)
if barstate.islast
f_drawInfo()
plot(tradeSignal, title="Rating", linewidth = 1, style = plot.style_columns, color = color.new(col_gradient, 50 - _pc * 10))
_cond1 = ta.crossunder(tradeSignal, -WeakBound)
alertcondition(_cond1, "بوت", "Ratings changed to بوت")
_cond2 = ta.crossover(tradeSignal, WeakBound)
alertcondition(_cond2, "كول", "Ratings changed to كول")
_cond3 = ta.crossunder(tradeSignal, -StrongBound)
alertcondition(_cond3, "Strong بوت", "Ratings changed to Strong بوت")
_cond4 = ta.crossover(tradeSignal, StrongBound)
alertcondition(_cond4, "Strong كول", "Ratings changed to Strong كول")// This work is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
// creativecommons.org
// © BigBeluga
//@version=6
indicator("فلتر فوليوم", max_labels_count = 500, max_lines_count = 500)
// INPUTS ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
int length = input.int(20, minval=1, title="Filter Length")
bool disp_lvl = input.bool(true, "Levels")
color up_color = input.color(color.rgb(8, 245, 59), "", inline = "color")
color dn_color = input.color(color.rgb(243, 2, 2), "", inline = "color")
var buy_line = line(na)
var sell_line = line(na)
// }
// CALCULATIONS――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
float sma1 = ta.sma(close, 25)
float sma_n1 = ((close - sma1) - ta.sma(close - sma1, 25)) / ta.stdev(close - sma1, 25)
float area = ta.sma(high-low, 100)
// Two-pole smooth filter function
f_two_pole_filter(source, length) =>
var float smooth1 = na
var float smooth2 = na
alpha = 2.0 / (length + 1)
if na(smooth1)
smooth1 := source
else
smooth1 := (1 - alpha) * smooth1 + alpha * source
if na(smooth2)
smooth2 := smooth1
else
smooth2 := (1 - alpha) * smooth2 + alpha * smooth1
// Oscillator
two_p = f_two_pole_filter(sma_n1, length)
two_pp = two_p
// Colors
color buy_col1 = color.from_gradient(two_p, -1, 0.5, up_color, na)
color buy_col2 = color.from_gradient(two_p, -1, 0.5, color.new(up_color, 50), na)
color sell_col1 = color.from_gradient(two_p, -0.5, 1, na, dn_color)
color sell_col2 = color.from_gradient(two_p, -0.5, 1, na, color.new(dn_color, 50))
color color = two_p > two_pp
? color.from_gradient(two_p, -1,1, up_color, color.new(up_color, 0))
: color.from_gradient(two_p, -1,1,color.new(dn_color, 0), dn_color)
// Signals
bool buy = ta.crossover(two_p, two_pp) and two_p < 0 and barstate.isconfirmed
bool sell = ta.crossunder(two_p, two_pp) and two_p > 0 and barstate.isconfirmed
// }
// PLOT ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――{
if buy //and two_p < -0.5
sell_line := line(na)
if disp_lvl
buy_line := line.new(
bar_index-1
, low - area
, bar_index
, low - area
, force_overlay = true
, color = buy_col1
, style = line.style_dashed
)
label.new(bar_index-1, low - area
, color = buy_col1, style = label.style_label_up, force_overlay = true, size = size.tiny)
if ta.crossunder(low, buy_line.get_y1()) and barstate.isconfirmed
label.new(
bar_index-1
, buy_line.get_y1()
, color = color.new(up_color, 100)
, style = label.style_label_center
, force_overlay = true
, size = size.large
, text = "✖"
, textcolor = up_color
)
buy_line := line(na)
if sell //and two_p > 0.5
buy_line := line(na)
if disp_lvl
sell_line := line.new(
bar_index-1
, high + area
, bar_index
, high + area
, force_overlay = true
, color = sell_col1
, style = line.style_dashed
)
label.new(bar_index-1, high + area
, color = sell_col1, style = label.style_label_down, force_overlay = true, size = size.tiny)
if ta.crossover(high, sell_line.get_y1()) and barstate.isconfirmed
label.new(
bar_index-1
, sell_line.get_y1()
, color = color.new(dn_color, 100)
, style = label.style_label_center
, force_overlay = true
, size = size.large
, text = "✖"
, textcolor = dn_color
)
sell_line := line(na)
switch
not na(buy_line) => buy_line. set_x2(bar_index)
not na(sell_line) => sell_line.set_x2(bar_index)
plotshape(buy ? two_p : na, "كول", shape.circle, location.absolute, buy_col2, -1, size = size.small)
plotshape(buy ? two_p : na, "كول", shape.circle, location.absolute, buy_col1, -1, size = size.tiny)
plotshape(sell ? two_p : na, "بوت", shape.circle, location.absolute, sell_col2, -1, size = size.small)
plotshape(sell ? two_p : na, "بوت", shape.circle, location.absolute, sell_col1, -1, size = size.tiny)
p11 = plot(1, color = color.new(chart.fg_color, 80))
plot(0.5, color = color.new(chart.fg_color, 50))
p00 = plot(0, color = color.new(bar_index % 2 == 0 ? chart.fg_color : na, 0))
plot(-0.5, color = color.new(chart.fg_color, 50))
p_1 = plot(-1, color = color.new(chart.fg_color, 80))
fill(p11, p00, 2, -1, color.new(chart.fg_color, 80), na)
fill(p_1, p00, 1, -2, na, color.new(chart.fg_color, 80))
p1 = plot(two_p, color = color, linewidth = 1)
p2 = plot(two_pp, display = display.none)
fill(p1, p2, two_p, two_pp, color, na)
// }
//@version=6
// indicator("Technical Ratings", "Technicals", precision = 2)
import TradingView/TechnicalRating/3 as rating
res = input.timeframe("", "Indicator Timeframe")
ratingSignal = input.string("All", "Rating is based on", options = )
GRP1 = "Show MTF"
useMtf1 = input(false, "", inline = "mtf1", group = GRP1)
mtf1 = input.timeframe("60", "", inline = "mtf1", group = GRP1, active = useMtf1)
useMtf2 = input(false, "", inline = "mtf2", group = GRP1)
mtf2 = input.timeframe("240", "", inline = "mtf2", group = GRP1, active = useMtf2)
useMtf3 = input(true, "", inline = "mtf3", group = GRP1)
mtf3 = input.timeframe("1D", "", inline = "mtf3", group = GRP1, active = useMtf3)
useMtf4 = input(true, "", inline = "mtf4", group = GRP1)
mtf4 = input.timeframe("1W", "", inline = "mtf4", group = GRP1, active = useMtf4)
useMtf5 = input(true, "", inline = "mtf5", group = GRP1)
mtf5 = input.timeframe("1M", "", inline = "mtf5", group = GRP1, active = useMtf5)
GRP2 = "Color Settings"
colBuy = input(#5b9cf6, "Buy ", inline = "كول Colors", group = GRP2)
colStrongBuy = input(#2962ff, "", inline = "كول Colors", group = GRP2)
colNeutral = input(#a8adbc, "Neutral ", inline = "تذبذب", group = GRP2)
colSell = input(#ef9a9a, "Sell ", inline = "بوت Colors", group = GRP2)
colStrongSell = input(#f44336, "", inline = "بوت Colors", group = GRP2)
tableTitleColor = input(#295b79, "Headers", inline = "تذبذب", group = GRP2)
StrongBound = 0.5
WeakBound = 0.1
getSignal(ratingTotal, ratingOther, ratingMA) =>
if ratingSignal == "MAs"
ratingMA
else if ratingSignal == "Oscillators"
ratingOther
else
ratingTotal
= request.security(syminfo.tickerid, res, rating.calcRatingAll())
= request.security(syminfo.tickerid, mtf1, rating.calcRatingAll())
= request.security(syminfo.tickerid, mtf2, rating.calcRatingAll())
= request.security(syminfo.tickerid, mtf3, rating.calcRatingAll())
= request.security(syminfo.tickerid, mtf4, rating.calcRatingAll())
= request.security(syminfo.tickerid, mtf5, rating.calcRatingAll())
tradeSignal = getSignal(ratingTotalCurrent, ratingOtherCurrent, ratingMACurrent)
calcRatingStatus(value) =>
if na(value)
"-"
else if -StrongBound > value
"Strong بوت"
else if value < -WeakBound
"Sell "
else if value > StrongBound
"Strong كول "
else if value > WeakBound
"كول "
else
"تذبذب"
allRatingsArray = array.from("All", calcRatingStatus(ratingTotalCurrent), calcRatingStatus(ratingTotal_mtf1), calcRatingStatus(ratingTotal_mtf2),
calcRatingStatus(ratingTotal_mtf3), calcRatingStatus(ratingTotal_mtf4), calcRatingStatus(ratingTotal_mtf5))
oscRatingsArray = array.from("Osc", calcRatingStatus(ratingOtherCurrent), calcRatingStatus(ratingOther_mtf1), calcRatingStatus(ratingOther_mtf2),
calcRatingStatus(ratingOther_mtf3), calcRatingStatus(ratingOther_mtf4), calcRatingStatus(ratingOther_mtf5))
maRatingsArray = array.from("MAs", calcRatingStatus(ratingMACurrent), calcRatingStatus(ratingMA_mtf1), calcRatingStatus(ratingMA_mtf2),
calcRatingStatus(ratingMA_mtf3), calcRatingStatus(ratingMA_mtf4), calcRatingStatus(ratingMA_mtf5))
currentRes = res==""?timeframe.period:res
allResArray = array.from("TF", currentRes, mtf1, mtf2, mtf3, mtf4, mtf5)
usedMtfArray = array.from(true, true, useMtf1, useMtf2, useMtf3, useMtf4, useMtf5)
removeUnused(duplicatedIndex) =>
if array.size(duplicatedIndex) > 0
int size = array.size(duplicatedIndex)-1
for j=0 to size
int currentDupIndex = array.shift(duplicatedIndex)
array.remove(allResArray, currentDupIndex-j)
array.remove(usedMtfArray, currentDupIndex-j)
array.remove(allRatingsArray, currentDupIndex-j)
array.remove(oscRatingsArray, currentDupIndex-j)
array.remove(maRatingsArray, currentDupIndex-j)
eraseDuplicatedAndDisabledTf() =>
int duplicatedIndex = array.new_int()
for m=1 to array.size(allResArray)-1
bool isCurrentMtfDisabled = array.get(usedMtfArray, m) == false
if isCurrentMtfDisabled
array.push(duplicatedIndex, m)
removeUnused(duplicatedIndex)
for m=1 to array.size(allResArray)-1
int firstSearchElemIndex = array.indexof(allResArray, array.get(allResArray, m))
int lastSearchElemIndex = array.lastindexof(allResArray, array.get(allResArray, m))
if firstSearchElemIndex == lastSearchElemIndex or array.indexof(duplicatedIndex, lastSearchElemIndex) != -1
continue
string searchElem = array.get(allResArray, firstSearchElemIndex)
for i=firstSearchElemIndex+1 to lastSearchElemIndex
string currentElem = array.get(allResArray, i)
if searchElem == currentElem
array.push(duplicatedIndex, i)
removeUnused(duplicatedIndex)
poscond = tradeSignal > WeakBound
negcond = tradeSignal < -WeakBound
posseries = poscond ? tradeSignal : 0
negseries = negcond ? tradeSignal : 0
count_rising(plot) =>
v_plot = plot > 0 ? plot : -plot
var count = 0
if v_plot == 0
count := 0
else if v_plot >= v_plot
count := math.min(5, count + 1)
else if v_plot < v_plot
count := math.max(1, count - 1)
count
poscount = count_rising(posseries)
negcount = count_rising(negseries)
_pc = poscond ? poscount : negcond ? negcount : 0
colorTransp(col, transp) =>
red = color.r(col)
green = color.g(col)
blue = color.b(col)
color.rgb(red, green, blue, transp)
hline(1, color=colorTransp(colBuy, 50), linestyle=hline.style_solid)
hline(0.5, color=colorTransp(colBuy, 50), linestyle=hline.style_dashed)
hline(-1, color=colorTransp(colSell, 50), linestyle=hline.style_solid)
hline(-0.5, color=colorTransp(colSell, 50), linestyle=hline.style_dashed)
f_cellBgColor(_signal) =>
_returnColor = tableTitleColor
if _signal == "بوت "
_returnColor := colSell
else if _signal == "Strong بوت"
_returnColor := colStrongSell
else if _signal == "كول "
_returnColor := colBuy
else if _signal == "Strong كول "
_returnColor := colStrongBuy
else if _signal == "تذبذب" or _signal == "-"
_returnColor := colNeutral
_returnColor
f_cellAlign(_cellTitle) =>
_align = text.align_left
if _cellTitle == "MAs" or _cellTitle == "Osc" or _cellTitle == "All" or _cellTitle == "-"
_align := text.align_center
_align
f_addCell(_table, _column, _row, _cellTitle) =>
table.cell(_table, _column, _row, _cellTitle, text_color=color.white, text_halign=f_cellAlign(_cellTitle), bgcolor=f_cellBgColor(_cellTitle), text_size=size.small)
f_drawInfo() =>
var t1 = table.new(position.middle_right, 4, array.size(allRatingsArray), frame_width=2, frame_color=color.white, border_width=1, border_color=color.white)
eraseDuplicatedAndDisabledTf()
timeframesCount = array.size(allResArray)
if timeframesCount < 3
for i=0 to timeframesCount-1
f_addCell(t1, i, 1, array.get(maRatingsArray, i))
f_addCell(t1, i, 2, array.get(oscRatingsArray, i))
f_addCell(t1, i, 3, array.get(allRatingsArray, i))
else
for i=0 to timeframesCount-1
f_addCell(t1, 0, i, array.get(allResArray, i))
if ratingSignal == "All"
f_addCell(t1, 1, i, array.get(maRatingsArray, i))
f_addCell(t1, 2, i, array.get(oscRatingsArray, i))
f_addCell(t1, 3, i, array.get(allRatingsArray, i))
if ratingSignal == "Oscillators"
f_addCell(t1, 1, i, array.get(oscRatingsArray, i))
if ratingSignal == "MAs"
f_addCell(t1, 1, i, array.get(maRatingsArray, i))
col_buy = color.from_gradient(tradeSignal, 0.0, 0.2, colNeutral, colStrongBuy)
col_sell = color.from_gradient(tradeSignal, -0.2, 0.0, colStrongSell, colNeutral)
col_gradient = color.from_gradient(tradeSignal, -0.2, 0.2, col_sell, col_buy)
if barstate.islast
f_drawInfo()
plot(tradeSignal, title="Rating", linewidth = 1, style = plot.style_columns, color = color.new(col_gradient, 50 - _pc * 10))
_cond1 = ta.crossunder(tradeSignal, -WeakBound)
alertcondition(_cond1, "بوت", "Ratings changed to بوت")
_cond2 = ta.crossover(tradeSignal, WeakBound)
alertcondition(_cond2, "كول", "Ratings changed to كول")
_cond3 = ta.crossunder(tradeSignal, -StrongBound)
alertcondition(_cond3, "Strong بوت", "Ratings changed to Strong بوت")
_cond4 = ta.crossover(tradeSignal, StrongBound)
alertcondition(_cond4, "Strong كول", "Ratings changed to Strong كول")
GainzAlgo V2 [Proficient]// © GainzAlgo
//@version=5
indicator('GainzAlgo V2 ', overlay=true, max_labels_count=500)
show_tp_sl = input.bool(true, 'Display TP & SL', group='Techical', tooltip='Display the exact TP & SL price levels for BUY & SELL signals.')
rrr = input.string('1:2', 'Risk to Reward Ratio', group='Techical', options= , tooltip='Set a risk to reward ratio (RRR).')
tp_sl_multi = input.float(1, 'TP & SL Multiplier', 1, group='Techical', tooltip='Multiplies both TP and SL by a chosen index. Higher - higher risk.')
tp_sl_prec = input.int(2, 'TP & SL Precision', 0, group='Techical')
candle_stability_index_param = 0.7
rsi_index_param = 60
candle_delta_length_param = 4
disable_repeating_signals_param = input.bool(true, 'Disable Repeating Signals', group='Techical', tooltip='Removes repeating signals. Useful for removing clusters of signals and general clarity.')
GREEN = color.rgb(29, 255, 40)
RED = color.rgb(255, 0, 0)
TRANSPARENT = color.rgb(0, 0, 0, 100)
label_size = input.string('huge', 'Label Size', options= , group='Cosmetic')
label_style = input.string('text bubble', 'Label Style', , group='Cosmetic')
buy_label_color = input(GREEN, 'BUY Label Color', inline='Highlight', group='Cosmetic')
sell_label_color = input(RED, 'SELL Label Color', inline='Highlight', group='Cosmetic')
label_text_color = input(color.white, 'Label Text Color', inline='Highlight', group='Cosmetic')
stable_candle = math.abs(close - open) / ta.tr > candle_stability_index_param
rsi = ta.rsi(close, 14)
atr = ta.atr(14)
bullish_engulfing = close < open and close > open and close > open
rsi_below = rsi < rsi_index_param
decrease_over = close < close
var last_signal = ''
var tp = 0.
var sl = 0.
bull_state = bullish_engulfing and stable_candle and rsi_below and decrease_over and barstate.isconfirmed
bull = bull_state and (disable_repeating_signals_param ? (last_signal != 'buy' ? true : na) : true)
bearish_engulfing = close > open and close < open and close < open
rsi_above = rsi > 100 - rsi_index_param
increase_over = close > close
bear_state = bearish_engulfing and stable_candle and rsi_above and increase_over and barstate.isconfirmed
bear = bear_state and (disable_repeating_signals_param ? (last_signal != 'sell' ? true : na) : true)
round_up(number, decimals) =>
factor = math.pow(10, decimals)
math.ceil(number * factor) / factor
if bull
last_signal := 'buy'
dist = atr * tp_sl_multi
tp_dist = rrr == '2:3' ? dist / 2 * 3 : rrr == '1:2' ? dist * 2 : rrr == '1:4' ? dist * 4 : dist
tp := round_up(close + tp_dist, tp_sl_prec)
sl := round_up(close - dist, tp_sl_prec)
if label_style == 'text bubble'
label.new(bar_index, low, 'BUY', color=buy_label_color, style=label.style_label_up, textcolor=label_text_color, size=label_size)
else if label_style == 'triangle'
label.new(bar_index, low, 'BUY', yloc=yloc.belowbar, color=buy_label_color, style=label.style_triangleup, textcolor=TRANSPARENT, size=label_size)
else if label_style == 'arrow'
label.new(bar_index, low, 'BUY', yloc=yloc.belowbar, color=buy_label_color, style=label.style_arrowup, textcolor=TRANSPARENT, size=label_size)
label.new(show_tp_sl ? bar_index : na, low, 'TP: ' + str.tostring(tp) + ' SL: ' + str.tostring(sl), yloc=yloc.price, color=color.gray, style=label.style_label_down, textcolor=label_text_color)
if bear
last_signal := 'sell'
dist = atr * tp_sl_multi
tp_dist = rrr == '2:3' ? dist / 2 * 3 : rrr == '1:2' ? dist * 2 : rrr == '1:4' ? dist * 4 : dist
tp := round_up(close - tp_dist, tp_sl_prec)
sl := round_up(close + dist, tp_sl_prec)
if label_style == 'text bubble'
label.new(bear ? bar_index : na, high, 'SELL', color=sell_label_color, style=label.style_label_down, textcolor=label_text_color, size=label_size)
else if label_style == 'triangle'
label.new(bear ? bar_index : na, high, 'SELL', yloc=yloc.abovebar, color=sell_label_color, style=label.style_triangledown, textcolor=TRANSPARENT, size=label_size)
else if label_style == 'arrow'
label.new(bear ? bar_index : na, high, 'SELL', yloc=yloc.abovebar, color=sell_label_color, style=label.style_arrowdown, textcolor=TRANSPARENT, size=label_size)
label.new(show_tp_sl ? bar_index : na, low, 'TP: ' + str.tostring(tp) + ' SL: ' + str.tostring(sl), yloc=yloc.price, color=color.gray, style=label.style_label_up, textcolor=label_text_color)
alertcondition(bull or bear, 'BUY & SELL Signals', 'New signal!')
alertcondition(bull, 'BUY Signals (Only)', 'New signal: BUY')
alertcondition(bear, 'SELL Signals (Only)', 'New signal: SELL')
Quasimodo Pattern Strategy Back Test [TradingFinder] QM Trading🔵 Introduction
The QM pattern, also known as the Quasimodo pattern, is one of the popular patterns in price action, and it is often used by technical analysts. The QM pattern is used to identify trend reversals and provides a very good risk-to-reward ratio. One of the advantages of the QM pattern is its high frequency and visibility in charts.
Additionally, due to its strength, it is highly profitable, and as mentioned, its risk-to-reward ratio is very good. The QM pattern is highly popular among traders in supply and demand, and traders also use this pattern.
The Price Action QM pattern, like other Price Action patterns, has two types: Bullish QM and Bearish QM patterns. To identify this pattern, you need to be familiar with its types to recognize it.
🔵 Identifying the QM Pattern
🟣 Bullish QM
In the bullish QM pattern, as you can see in the image below, an LL and HH are formed. As you can see, the neckline is marked as a dashed line. When the price reaches this range, it will start its upward movement.
🟣 Bearish QM
The Price Action QM pattern also has a bearish pattern. As you can see in the image below, initially, an HH and LL are formed. The neckline in this image is the dashed line, and when the LL is formed, the price reaches this neckline. However, it cannot pass it, and the downward trend resumes.
🔵 How to Use
The Quasimodo pattern is one of the clearest structures used to identify market reversals. It is built around the concept of a structural break followed by a pullback into an area of trapped liquidity. Instead of relying on lagging indicators, this pattern focuses purely on price action and how the market reacts after exhausting one side of liquidity. When understood correctly, it provides traders with precise entry points at the transition between trend phases.
🟣 Bullish Quasimodo
A bullish Quasimodo forms after a clear downtrend when sellers start losing control. The market continues to make lower lows until a sudden higher high appears, signaling that buyers are entering with strength. Price then pulls back to retest the previous low, creating what is known as the Quasimodo low.
This area often becomes the final trap for sellers before the market shifts upward. A visible rejection or displacement from this zone confirms bullish momentum. Traders usually place entries near this level, stops below the low, and targets at previous highs or the next resistance zone. Combining the setup with demand zones or Fair Value Gaps increases its accuracy.
🟣 Bearish Quasimodo
A bearish Quasimodo forms near the top of an uptrend when buyers begin to lose strength. The market continues to make higher highs until a sudden lower low breaks the bullish structure, showing that selling pressure is entering the market. Price then retraces upward to retest the previous high, forming the Quasimodo high, where breakout buyers are often trapped.
Once rejection appears at this level, it indicates a likely reversal. Traders can enter short near this area, with stop-losses placed above the high and targets near the next support or previous lows. The setup gains more reliability when aligned with supply zones, SMT divergence, or bearish Fair Value Gaps.
🔵 Setting
Pivot Period : You can use this parameter to use your desired period to identify the QM pattern. By default, this parameter is set to the number 5.
Take Profit Mode : You can choose your desired Take Profit in three ways. Based on the logic of the QM strategy, you can select two Take Profit levels, TP1 and TP2. You can also choose your take profit based on the Reward to Risk ratio. You must enter your desired R/R in the Reward to Risk Ratio parameter.
Stop Loss Refine : The loss limit of the QM strategy is based on its logic on the Head pattern. You can refine it using the ATR Refine option to prevent Stop Hunt. You can enter your desired coefficient in the Stop Loss ATR Adjustment Coefficient parameter.
Reward to Risk Ratio : If you set Take Profit Mode to R/R, you must enter your desired R/R here. For example, if your loss limit is 10 pips and you set R/R to 2, your take profit will be reached when the price is 20 pips away from your entry point.
Stop Loss ATR Adjustment Coefficient : If you set Stop Loss Refine to ATR Refine, you must adjust your loss limit coefficient here. For example, if your buy position's loss limit is at the price of 1000, and your ATR is 10, if you set Stop Loss ATR Adjustment Coefficient to 2, your loss limit will be at the price of 980.
Entry Level Validity : Determines how long the Entry level remains valid. The higher the level, the longer the entry level will remain valid. By default it is 2 and it can be set between 2 and 15.
🔵 Results
The following examples show the backtest results of the Quasimodo (QM) strategy in action. Each image is based on specific settings for the symbol, timeframe, and input parameters, illustrating how the QM logic can generate signals under different market conditions. The detailed configuration for each backtest is also displayed on the image.
⚠ Important Note : Even with identical settings and the same symbol, results may vary slightly across different brokers due to data feed variations and pricing differences.
Default Properties of Backtests :
OANDA:XAUUSD | TimeFrame: 5min | Duration: 1 Year :
BINANCE:BTCUSD | TimeFrame: 5min | Duration: 1 Year :
CAPITALCOM:US30 | TimeFrame: 5min | Duration: 1 Year :
NASDAQ:QQQ | TimeFrame: 5min | Duration: 5 Year :
OANDA:EURUSD | TimeFrame: 5min | Duration: 5 Year :
PEPPERSTONE:US500 | TimeFrame: 5min | Duration: 5 Year :
Strict Engulfing + Rich Email Alerts (v6, stable)an engulfing pattern indicator designed to alert whenever the pattern forms in the chart. this is killer pattern when used together with market structure. not final version though
Multi-EMA Session Breakout Strategythis is a strategy that use the session high and low and the EMA LOWS 2 3 6 9 110 355 AND 480
Choch Pattern Levels WITH ALERTS [credit to: @BigBeluga]🔵 OVERVIEW
The Choch Pattern Levels WITH ALERTS indicator automatically detects Change of Character (CHoCH) shifts in market structure — crucial moments that often signal early trend reversals or major directional transitions. It plots the structural break level, visualizes the pattern zone with triangle overlays, and tracks delta volume to help traders assess the strength behind each move. Now, an additional feature of alerts have been included!
🔵 CONCEPTS
CHoCH Pattern: A bullish CHoCH forms when price breaks a previous swing high after a swing low, while a bearish CHoCH appears when price breaks a swing low after a prior swing high.
snapshot
Break Level Mapping: The indicator identifies the highest or lowest point between the pivot and the breakout, marking it with a clean horizontal level where price often reacts.
snapshot
Delta Volume Tracking: Net bullish or bearish volume is accumulated between the pivot and the breakout, revealing the momentum and conviction behind each CHoCH.
snapshot
Chart Clean-Up: If price later closes through the CHoCH level, the zone is automatically removed to maintain clarity and focus on active setups only.
🔵 FEATURES
Automatic CHoCH pattern detection using pivot-based logic.
Triangle shapes show structure break: pivot → breakout → internal high/low.
snapshot
snapshot
Horizontal level marks the structural zone with a ◯ symbol.
snapshot
Optional delta volume label with directional sign (+/−).
Green visuals for bullish CHoCHs, red for bearish.
Fully auto-cleaning invalidated levels to reduce clutter.
Clean organization of all lines, labels, and overlays.
User-defined Length input to adjust pivot sensitivity.
snapshot
NEW! - alert system inserted to Pinescript for either: any triangle forms or whether a bullish "green" triangle or bearish "red" triangle forms - providing real-time alerts for whenever timeframe chart you've selected while creating the alert.
🔵 HOW TO USE
Use CHoCH levels as early trend reversal zones or confirmation signals.
Treat bullish CHoCHs as support zones, bearish CHoCHs as resistance.
Look for high delta volume to validate the strength behind each CHoCH.
Combine with other BigBeluga tools like supply/demand, FVGs, or liquidity maps for confluence.
Adjust pivot Length based on your strategy — shorter for intraday, longer for swing trading.
🔵 CONCLUSION
Choch Pattern Levels WITH ALERTS highlights key structural breaks that can mark the start of new trends. By combining precise break detection with volume analytics and automatic cleanup, it provides actionable insights into the true intent behind price moves — giving traders a clean edge in spotting early reversals and key reaction zones with real-time alerts for precision to evaluate and enter markets.
4/8/15 EMA + Classic & Camarilla PivotsSays it all in the title...4/8/15 EMA + Classic & Camarilla Pivots without setting up difficult choices on TOS. Stay on the right side of the 15. Let it detach from the 8 and follow it up. If you are entangled in the 4/8, time to bail in my humble opinon. For Scalpers and intraday traders.
Previous Day/Week/Month OHLC for renko (from Regular Candles)this indiactor gives you previous day/week/month levels on a renko chart based on the ohlc data of normal candles
4/8/15 EMA + Classic & Camarilla PivotsEssentially this is what you can get on TOS but everything included in one chart.






















