PROTECTED SOURCE SCRIPT

XAUMO Gap Retrace

68
XAUMO Gap Retrace
Educational description for TradingView (English)

📘 EDUCATIONAL ONLY — NOT FINANCIAL ADVICE
This script is for study, training and back-testing ideas. It does NOT give guaranteed
buy/sell signals and must NOT be used to promote any “risk-free” or “fixed return” schemes.

────────────────────────────────
1) What does XAUMO Gap Retrace do?
────────────────────────────────
This indicator tracks a very specific price behaviour:

» After a bar closes (and is NOT a tweezer with the previous bar),
it “arms” a target at the previous bar’s High or Low.
» It then watches to see if the market retraces to that level
on the next bar (or later, depending on your setting).
» When price touches that previous High/Low, it marks the fill,
updates a live label with distance and progress, and can fire an alert.

In simple terms:
“Every candle that closes away from the previous candle
gets a ‘magnet’ at the previous High or Low.
XAUMO Gap Retrace tells you if the very next candle comes back
to fill that gap to the previous bar.”

────────────────────────────────
2) Core logic step-by-step
────────────────────────────────
(1) Tweezer detection
• It calculates:
– prevH = previous bar’s High
– prevL = previous bar’s Low
– tol = toleranceTicks × syminfo.mintick
• If the current bar’s High or Low is within “tol” of the previous High or Low,
it is treated as a tweezer:
isTweezer = highs or lows almost equal to previous bar.
• Tweezer bars are ignored (no new target armed) to avoid noise.

(2) Target selection (Midline vs Nearest)
When a bar closes (barstate.isconfirmed) and it’s not a tweezer:

• Mode = "Midline"
– prevMid = (prevH + prevL) / 2
– If close >= prevMid → target = prevH (previous High)
– Else → target = prevL (previous Low)

• Mode = "Nearest"
– target = whichever is nearer to the close:
• prevH or prevL

The chosen level is stored in:
• lastTarget = the price level we are waiting to be filled
• lastSigIndex = bar_index of the signal candle
• needUp = true if close < target (price must go up to fill)
false if close > target (price must go down)
• baseDist = |close - target| at the signal bar
(used later to compute “progress”).

(3) Active state and fill detection
• isArmed = lastTarget is not na (we have a live target).
• isNextBar = bar_index == lastSigIndex + 1.
• isActive =
– if nextBarOnly = true → only the immediate next bar is allowed
– if nextBarOnly = false → any bar after the signal is active.

Price-touch rule:
• If needUp = true → fill when high >= lastTarget.
• If needUp = false → fill when low <= lastTarget.

This gives:
• fillNow = true on the bar where the previous High/Low is touched.

(4) Target line and fill marker
• plot() draws a line at lastTarget (with linebreak style) while armed.
• plotshape() draws a tiny circle at the touch price when fillNow is true,
labelled “fill”.

(5) Live distance / progress label
A single live label (liveLbl) shows live stats on the last bar:

• dist = |close - lastTarget|
• distTicks = dist / tick
• progress = how far the market has moved towards the target since the signal:
– 0% = no progress
– 100% = fully filled
(internally clamped between 0 and 1 with a custom clamp function).

If showLabel is ON, on the last bar:
• Old label is deleted,
• New label is created at (bar_index + liveLabelShift, close),
so it appears shifted to the right by N bars.
• Text includes:
– Target price
– Distance in price and ticks
– Progress %
– Direction text “↑ need up” or “↓ need down”.

(6) Alerts
• alertcondition(fillNow, ...) triggers when the previous High/Low
is touched according to the rules above.
• You can connect this to TradingView alerts to be notified when
the gap retrace happens.

(7) Auto-reset (when nextBarOnly = true)
• After the “next bar” closes, if the target is still armed,
the script clears:
– lastTarget
– baseDist
so that a new signal can be armed on future bars.

────────────────────────────────
3) Inputs summary
────────────────────────────────
• Tweezer tolerance (ticks)
– How close highs or lows can be to be considered a tweezer (skip signal).

• Target selection
– "Midline": choose High or Low based on whether close is above/below midpoint.
– "Nearest": choose whichever of prev High/Low is closer to the close.

• Only allow fill on the following bar
– If true: only the very next bar can fill the target.
– If false: any later bar can fill it.

• Show target line
– Draw/Hide the H/L target line.

• Show signal/fill markers
– Draw/Hide the small circle marker on fill.

• Show live distance label
– Turn the floating label ON/OFF.

• Live label → shift right (bars)
– Horizontal shift in bars for the live label (default 3 bars to the right).

────────────────────────────────
4) How to use it (educational view)
────────────────────────────────
XAUMO Gap Retrace is a study tool for:
• Testing how often a candle “comes back” to revisit the previous bar’s High/Low.
• Studying behaviour of retracements after a non-tweezer move.
• Combining gap-retrace logic with your own system:
– support/resistance
– VWAP / FVRP
– volume / delta

It is NOT meant to be traded blindly. It’s a microscope for one specific
price pattern: “does the next bar retrace to the previous bar’s H/L?”

────────────────────────────────
5) Risk & scam awareness
────────────────────────────────
• No script can guarantee profit or remove risk.
• Past retrace behaviour does not guarantee future behaviour.
• Never send money or account credentials to anyone claiming they can
use this indicator to give “fixed income” or “guaranteed returns”.
• Always test ideas, manage your own risk, and trade only money you
can afford to lose.



================================================


XAUMO Gap Retrace
وصف تعليمي بالعربي لمكتبة TradingView

📘 الاسكريبت تعليمي فقط — مش توصية شراء أو بيع
الهدف إنك تذاكر سلوك السعر وتعمل باك-تست، مش إنك تاخد منه أرباح مضمونة.
ممنوع استخدامه في أي دعاية نصب أو وعود كاذبة.

────────────────────────────────
١) الاسكريبت ده بيعمل إيه؟
────────────────────────────────
XAUMO Gap Retrace بيراقب سلوك معيّن:

• بعد ما الشمعة تقفل (وبتكون مش تويزر مع الشمعة اللي قبلها)
الاسكريبت “يسلّح” Target عند هاي أو لو الشمعة السابقة.
• بعد كده يبص: هل الشمعة اللي بعدها (أو اللي بعدهم لو حابب)
رجعت لمست الهاي/اللو بتوع الشمعة اللي فاتت ولا لأ؟
• لو اتلمس الهاي/اللو:
– بيحط علامة “fill”
– يحدّث ليبل حيّ بمسافة السعر والتقدّم
– ممكن يضرب Alert لو أنت فعّلتها.

يعني بالعربي:
“كل شمعة تقفل بعيد شوية عن اللي قبلها، بنحطلها مغناطيس
عند هاي أو لو الشمعة اللي قبلها، وبنشوف هل الشمعة الجاية
هترجع تلمسه ولا لأ.”

────────────────────────────────
٢) المنطق الداخلي خطوة بخطوة
────────────────────────────────
(أ) كشف الـ Tweezer
• بيحسب:
– prevH = هاي الشمعة اللي قبل
– prevL = لو الشمعة اللي قبل
– tol = toleranceTicks × حجم التكة
• لو الهاي أو اللو الحالي قريب من الهاي/اللو اللي قبل
بمقدار tol → تعتبر Tweezer:
isTweezer = true
• في الحالة دي بنعدّي ومابنسلّحش Target عشان نتفادى النويز.

(ب) اختيار الهدف (Midline أو Nearest)
لو الشمعة اتأكدت (barstate.isconfirmed) ومش تويزر:

• لو Mode = "Midline":
– prevMid = (prevH + prevL) / 2
– لو close ≥ prevMid → الهدف = prevH (هاي السابق)
– غير كده → الهدف = prevL (لو السابق)

• لو Mode = "Nearest":
– الهدف = الأقرب للـ close بين prevH و prevL.

وبعدين يخزن:
• lastTarget = مستوى السعر اللي مستنّين اللمسة عنده.
• lastSigIndex = bar_index للشمعة اللي سلّحت الإشارة.
• needUp = true لو التارجت فوق الكلوز (السعر محتاج يطلع).
false لو التارجت تحت الكلوز (السعر محتاج ينزل).
• baseDist = المسافة الأصلية |close - target| عند شمعة الإشارة.

(ج) حالة التسلّح والFill
• isArmed = في Target شغّال؟
• isNextBar = إحنا في الشمعة اللي بعد الإشارة مباشرة؟
• isActive =
– لو nextBarOnly = true → بس الشمعة اللي بعد الإشارة مسموح تملأ.
– لو false → أي شمعة بعد الإشارة مسموح.

شرط اللمس:
• لو needUp = true → fill لما high ≥ lastTarget.
• لو needUp = false → fill لما low ≤ lastTarget.

ده بيطلع:
• fillNow = true على الشمعة اللي لمست فيها الهاي/اللو بتاع الشمعة السابقة.

(د) خط الهدف وعلامة الـ Fill
• plot() يرسم خط عند lastTarget طول ما الإشارة متسلّحة.
• plotshape() يرسم دايرة صغيرة مكتوب عليها “fill” وقت ما الشرط يتحقق.

(هـ) ليبل المسافة والتقدّم (لايف)
ليبل واحد حيّ liveLbl يوضح إيه اللي بيحصل حاليًا:

• dist = |close - lastTarget|
• distTicks = dist ÷ حجم التكة
• progress = التقدم من ٠٪ لحد ١٠٠٪ من المسافة الأصلية:
– ٠٪ = لسه ما اتحركناش ناحية الهدف
– ١٠٠٪ = تم ملء الهدف
(محسوبة بـ clamp عشان نفضل بين ٠ و١).

لو showLabel شغّال وعلى آخر شمعة:
• يمسح الليبل القديم (لو موجود)
• يرسم ليبل جديد عند:
bar_index + liveLabelShift, close
يعني مزحزح الليبل كذا شمعة قدام على الشارت.
• النص بيعرض:
– Target
– Dist + Dist in ticks
– Progress٪
– سهم واتجاه: "↑ need up" أو "↓ need down".

(و) التنبيهات (Alerts)
• alertcondition(fillNow, ...) بتضرب لما الهدف (هاي/لو الشمعة السابقة)
يتلمس حسب القاعدة.
• تقدر توصلها بألارم على TradingView عشان يجيلك نوتيفيكيشن أول ما
يحصل Retrace.

(ز) إعادة ضبط أوتوماتيكي (لما nextBarOnly = true)
• بعد قفل الشمعة اللي بعد الإشارة، لو لسه فيه Target متسلّح:
– lastTarget = na
– baseDist = na
عشان يبقى جاهز يسلّح إشارة جديدة بعد كده.

────────────────────────────────
٣) أهم الإعدادات (Inputs)
────────────────────────────────
• Tweezer tolerance (ticks)
– مساحة التسامح في الهاي/اللو عشان نعتبرها تويزر ونسيبها.

• Target selection
– "Midline": يختار الهاي أو اللو حسب مكان الكلوز من منتصف الشمعة.
– "Nearest": يختار الأقرب للكلوز.

• Only allow fill on the following bar
– لو true: بس الشمعة اللي بعدها اللي تقول “اتملّى ولا لأ”.
– لو false: أي شمعة بعد كده ممكن تملّي الهدف.

• Show target line
– إظهار/إخفاء خط الهدف.

• Show signal/fill markers
– إظهار/إخفاء دائرة الـ fill.

• Show live distance label
– تشغيل/إيقاف الليبل اللايف.

• Live label → shift right (bars)
– تزحزح الليبل كام شمعة قدام (افتراضي ٣).

────────────────────────────────
٤) الاستخدام التعليمي
────────────────────────────────
مفيد لو عايز:
• تدرس: كام مرة الشمعة اللي بعد كده بترجع تلمس هاي/لو الشمعة اللي قبلها؟
• تشوف سلوك Retrace بعد حركة مش تويزر.
• تضيف المنطق ده لاستراتيجيتك:
– زونز، VWAP، FVRP، فوليوم، دلتا… إلخ.

مش معمول إنك تشتري/تبيع لوحده بمجرد ظهور إشارة.

────────────────────────────────
٥) مخاطر واحتيال
────────────────────────────────
• مفيش سكريبت بيشيل عنك المخاطرة.
• اللي حصل في الماضي مش ضمان للي جاي.
• إوعى حد يقول لك “ب XAUMO Gap Retrace هديك ربح ثابت”.
• ادير ريسكك بنفسك، جرّب الأول على ديمو، واتاجر بس بفلوس
تقدر تتحمل خسارتها.


================================================================


XAUMO Gap Retrace — Business Case (English)
Scenario: Post-selloff balance inside Implosion Box

📘 EDUCATIONAL ONLY — NOT FINANCIAL ADVICE
For TradingView idea / script description. Not a signal, not a promise of profit.

────────────────────────────────
1) What do we see on the chart?
────────────────────────────────
• Symbol: XAUUSD (gold CFD)
• TF: intraday (15m in the screenshot)
• XAUMO Implosion Box is active:
– Box High ≈ 4084.6
– Box Low ≈ 4065.5
Price is moving sideways inside this purple “implosion” range
after a strong Mega Bear waterfall.

• XAUMO Gap Retrace has armed a target at:
– Prev H/L Target ≈ 4077.12
– Live label says:
Target: 4077.12
Dist: 0.84 (64 ticks)
Progress: 71%
↓ need down

This means:
• The last “signal bar” closed ABOVE the chosen previous High/Low.
• The script selected 4077.12 as the magnet (previous H or L).
• Current price is still ABOVE that level, so we “need down”
for a full retrace.
• 71% of the original distance has already been eaten — most of
the gap has been retraced, a small part remains.

────────────────────────────────
2) What is the business case here?
────────────────────────────────
Context:
• We had aggressive selling (multiple Mega Bear tags) pushing price
from the upper green zone into the Implosion box.
• After the dump, price is no longer trending: it is compressing
between Box High and Box Low (implosion phase).
• Inside this box, XAUMO Gap Retrace is tracking small dislocations
between a bar’s close and the previous bar’s High/Low.

Current business case:
• The system is telling us:
“The last impulse away from the previous bar left a void at 4077.12.
The market has already retraced ~71% of that distance, but a
small downward move is still needed to fully ‘close the loop’.”

Educational interpretation:
• As long as price stays inside the Implosion Box, these small
retraces behave like micro mean-reversion trades: the market likes
to test old highs/lows inside the range before deciding whether to
break out (Explosion) or fully revert to the opposite side.

So the business case is:
> We are in a post-liquidation balance (Implosion box).
> XAUMO Gap Retrace shows an unfinished downside retrace to 4077.12.
> This supports a short-term mean-reversion idea INSIDE the box,
> not a blind breakout chase.

You still need:
• Your own trigger (price action / volume / order flow).
• Your own risk plan (SL, size, invalidation if Box High/Low breaks).

────────────────────────────────
3) Risk & scam awareness
────────────────────────────────
• XAUMO Gap Retrace does NOT guarantee that 4077.12 will be filled.
• Implosion boxes sometimes break violently without completing every
tiny retrace.
• Never sell this idea as “guaranteed fill” or “risk-free setup”.
• Always test, size properly, and trade only what you can afford to lose.

SHOW ME THE MONEY ya XAUMO…
but with discipline, risk limits, and zero tolerance for scams.


=========================================================


XAUMO Gap Retrace — الحالة دي بتقول إيه؟ (عربي)

📘 تنبيه مهم:
الشرح ده تعليمي بس، مش توصية شراء أو بيع، ومش وعد بأي ربح.
ممنوع استخدامه في دعاية نصب أو “أرباح مضمونة”.

────────────────────────────────
١) إيه اللي باين على الشارت؟
────────────────────────────────
• الأداة: XAUUSD
• الفريم: إنترادي (١٥ دقايق في الصورة)
• صندوق XAUMO Implosion شغّال:
– Box High حوالي 4084.6
– Box Low حوالي 4065.5
السعر بيتحرّك رايح جاي جوّه البوكس البنفسجي بعد نازلة
جامدة (Mega Bear) من المنطقة الخضرا فوق.

• XAUMO Gap Retrace مسلّح هدف عند:
– Prev H/L Target ≈ 4077.12
– الليبل كاتب:
Target: 4077.12
Dist: 0.84 (64 ticks)
Progress: 71%
↓ need down

يعني:
• شمعة الإشارة قفلت فوق الهاي/اللو اللي الاسكريبت اختاره.
• التارجت 4077.12 هو هاي أو لو الشمعة اللي قبلها.
• السعر دلوقتي لسه فوق التارجت، فـ “محتاج ينزل” عشان يكمّل الـ Retrace.
• ٧١٪ من المسافة الأصلية اتحركت بالفعل، فاضل جزء صغير من الجاب.

────────────────────────────────
٢) الـ Business Case هنا إيه؟
────────────────────────────────
الخلفية:
• كان فيه بيع عنيف من فوق (Mega Bear) نزّل السعر لحد جوّه
صندوق الـ Implosion.
• بعد النزلة، السوق دخل في حالة توازن/كومبريشن بين Box High و Box Low.
• جوّه البوكس، XAUMO Gap Retrace بيتابع كل مرة الشمعة تقفل
بعيد عن هاي/لو الشمعة اللي قبلها وبيشوف: هل الشمعة الجاية
هترجع تلمس المستوى ده ولا لأ.

في اللحظة دي:
• السيستم بيقول لك:
“فيه حركة طالعة فوق سببت فجوة صغيرة لحد 4077.12.
أغلب المسافة اتردّت (حوالي ٧١٪)، لسه ناقص نزلة بسيطة
عشان نقفل الدورة على الآخر.”

القراءة التعليمية:
• طول ما السعر جوّه صندوق الـ Implosion، الحركات دي غالبًا
Mean-Reversion جوّه الرينج: السوق يحب يختبر الهاي/اللوهات
القديمة جوّه البوكس قبل ما يقرر:
– يكسر لفوق (Explosion Up)
– أو يكمل نزلة لتحت.

فالـ Business Case:
> إحنا في توازن بعد نزلة قوية (Implosion Box).
> XAUMO Gap Retrace بيقول لسه فيه Retrace ناقص لتحت لحد 4077.12.
> الفكرة أقرب لتريدات رينج/Mean-Reversion جوّه البوكس،
> مش مطاردة بريك أوت عشوائي.

بس لسه محتاج:
• تأكيد دخول من طريقتك (برايس أكشن / فوليوم / فلو).
• خطة ريسك واضحة (ستوب، حجم عقد، إلغاء الفكرة لو Box High/Low اتكسر).

────────────────────────────────
٣) مخاطر واحتيال
────────────────────────────────
• مفيش ضمان إن السعر لازم يلمس 4077.12.
• ساعات صندوق الـ Implosion بيتكسّر بعنف من غير ما كل Retrace
صغير يكتمل.
• إوعى حد يقول لك “كل هدف Gap Retrace بيتملّي ١٠٠٪” — ده نصب.
• دايمًا جرّب، اتحكّم في حجمك، واتاجر بس بفلوس تقدر تستحمل خسارتها.

SHOW ME THE MONEY يا XAUMO…
بس بالعقل، وبريسـك مانجمنت، ومن غير ولا وعد كدب.

Declinazione di responsabilità

Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.