Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/scripts/validate_portfolio.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from pathlib import Path
import re
from urllib.parse import unquote

ROOT = Path(__file__).resolve().parents[2]
errors: list[str] = []

for markdown in ROOT.rglob("*.md"):
text = markdown.read_text(encoding="utf-8", errors="replace")
for target in re.findall(r"!?\[[^\]]*\]\(([^)]+)\)", text):
target = target.strip().split(" ", 1)[0].strip("<>")
if not target or target.startswith(("http://", "https://", "mailto:", "#")):
continue
local = unquote(target.split("#", 1)[0])
if local and not (markdown.parent / local).resolve().exists():
errors.append(f"Broken link in {markdown.relative_to(ROOT)}: {target}")

pine_files = list(ROOT.rglob("*.pine"))
for pine in pine_files:
text = pine.read_text(encoding="utf-8", errors="replace")
if not re.search(r"^//@version=\d+", text, re.MULTILINE):
errors.append(f"Missing Pine version: {pine.relative_to(ROOT)}")
if not re.search(r"\b(indicator|strategy|library)\s*\(", text):
errors.append(f"Missing Pine declaration: {pine.relative_to(ROOT)}")

if errors:
print("\n".join(errors))
raise SystemExit(1)

print(f"Validated {len(pine_files)} Pine files and local Markdown links.")
15 changes: 15 additions & 0 deletions .github/workflows/portfolio-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Portfolio quality

on:
push:
pull_request:

jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: python .github/scripts/validate_portfolio.py
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable repository-level changes are documented here. This changelog tracks repository organization, validation evidence, documentation, and portfolio engineering work; it does not claim trading profitability.

## 2026-08-24 — Full 120/120 validation integration

- Integrated the five repaired Pine scripts and their isolated TradingView evidence onto the latest `main` baseline.
- Updated the public validation status to **120 / 120** successful loading and rendering checks.
- Added two evidence-based strategy case studies covering both positive and negative historical outcomes.
- Added automated portfolio-quality validation, an explicit license, and a security policy.

## 2026-08-22 — TradingView validation milestone

- Completed isolated TradingView validation for **120 archived Pine scripts**.
Expand Down
15 changes: 15 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Copyright (c) 2026 Alaa Hamza (Alaamo7)

All rights reserved.

This repository and its source code are made publicly available solely for
portfolio review, personal study, and educational reference.

No permission is granted to copy, modify, redistribute, sublicense, resell,
publish as another product, or use this work commercially without prior written
permission from the copyright owner.

Trading indicators, strategies, reports, and screenshots are provided as
research software only. They do not constitute financial or investment advice,
and no warranty of performance, accuracy, merchantability, or fitness for a
particular purpose is provided.
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ A structured TradingView/Pine Script repository focused on EGX technical-analysi

This project covers trend analysis, momentum, liquidity, smart-money concepts, trap detection, price matrices, risk dashboards, and long-only backtesting workflows.

[![Portfolio quality](https://github.com/Alaamo7/pine-script-indicators/actions/workflows/portfolio-quality.yml/badge.svg)](https://github.com/Alaamo7/pine-script-indicators/actions/workflows/portfolio-quality.yml)

## Verified TradingView Validation Snapshot

A full validation run was completed on **2026-08-22** against the archived TradingView export.

| Validation item | Result |
|---|---:|
| Pine scripts tested individually | **120** |
| Loaded and rendered successfully | **115** |
| Documented Pine compilation errors | **5** |
| Loaded and rendered successfully after repair and re-test | **120** |
| Original compilation errors repaired and re-tested | **5 / 5** |
| Strategies tested | **7** |
| Strategy Tester evidence captured | **7 / 7** |

Expand Down Expand Up @@ -46,7 +48,7 @@ The maintained toolkit is separated from the larger archival TradingView export
| Experimental indicators | 3 | Research-oriented tools requiring continued validation. |
| Backtest strategies | 2 | EGX-friendly long-only strategy prototypes. |
| Legacy / Archive scripts | 3 | Preserved for reference, not primary production use. |
| Archived TradingView scripts | 120 | Individually tested; 115 passed loading/render checks and 5 have documented compile errors. |
| Archived TradingView scripts | 120 | Individually tested; 120 / 120 passed loading/render checks after five original compile errors were repaired and re-tested. |

See the maintained toolkit index: [`docs/scripts-index.md`](docs/scripts-index.md)

Expand Down Expand Up @@ -108,6 +110,11 @@ A documented QA case study covering the **120-script** TradingView validation ru

[`Read the validation case study →`](docs/case-studies/2026-08-22-tradingview-validation.md)

### Verified strategy case studies

- [`Ultimate Scalping Pro v2.6`](docs/case-studies/ultimate-scalping-pro-v2-6.md) — positive historical result with documented assumptions and limitations.
- [`Integrated Swing Strategy`](docs/case-studies/integrated-swing-strategy.md) — negative historical result documented transparently with engineering lessons.

### Future market-behavior case studies

A reusable template is available for future chart-review and signal-outcome studies where sufficient evidence exists:
Expand All @@ -121,6 +128,10 @@ Potential candidates include:
- EGX Pro Price Matrix on a swing-trading setup.
- Reverse SMA+RSI Strategy backtest on selected EGX symbols.

## License

Source is published for portfolio viewing and education. Redistribution, resale, modification, or commercial use requires written permission; see [`LICENSE`](LICENSE).

## Important Disclaimer

This repository is for education, research, software demonstration, and technical portfolio purposes only. It does not provide financial advice, investment recommendations, brokerage advice, or guaranteed trading signals.
Expand Down
27 changes: 27 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Security Policy

## Supported version

Only the latest commit on `main` is actively maintained.

## Reporting a vulnerability

Do not publish API keys, tokens, credentials, exploit details, or private account data in a public issue.

- Use GitHub's private vulnerability-reporting option when it is available.
- If private reporting is unavailable, open a minimal public issue requesting a private contact channel without including sensitive details.
- Include the affected path, impact, and safe reproduction steps only through a private channel.

## Exposed secrets

If a credential is committed or appears in a workflow log:

1. Revoke or rotate it immediately.
2. Remove it from the current files and configuration.
3. Store replacements in environment variables or GitHub Secrets.
4. Review repository history and logs for additional exposure.
5. Never paste the full secret into an issue, pull request, or test fixture.

## Scope

This repository contains Pine Script research code, test evidence, documentation, and automation helpers. Security reports should distinguish software defects from trading-performance claims.
34 changes: 34 additions & 0 deletions docs/case-studies/integrated-swing-strategy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Case Study: Integrated Swing Strategy

## Test context

| Field | Value |
|---|---|
| Platform | TradingView Strategy Tester |
| Symbol | EGX:RMDA |
| Timeframe | 4 hours |
| Test date | 2026-08-21 |
| Direction | Long-only research setup |

## Recorded result

| Metric | Result |
|---|---:|
| Total P&L | -7,189.45 EGP (-0.72%) |
| Maximum drawdown | 24,027.10 EGP (2.39%) |
| Profitable trades | 38.52% (47 of 122) |
| Profit factor | 0.884 |

## Interpretation

This configuration did not demonstrate an edge in the sampled market. A profit factor below 1.0 and a low win rate make the unmodified setup unsuitable for practical use. Publishing the negative result prevents compile success from being confused with trading performance and provides a concrete baseline for improvement.

## Lessons and next steps

1. Review regime filters so entries are reduced during sideways markets.
2. Inspect exit timing and the balance between average win and average loss.
3. Add realistic costs before any optimization.
4. Validate changes out of sample and across multiple EGX symbols.
5. Reject parameter combinations that improve one period but degrade broadly.

This case study is a transparent research record, not financial advice.
34 changes: 34 additions & 0 deletions docs/case-studies/ultimate-scalping-pro-v2-6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Case Study: Ultimate Scalping Pro v2.6

## Test context

| Field | Value |
|---|---|
| Platform | TradingView Strategy Tester |
| Symbol | EGX:RMDA |
| Timeframe | 15 minutes |
| Test date | 2026-08-21 |
| Direction | Long-only research setup |

## Recorded result

| Metric | Result |
|---|---:|
| Total P&L | +7,446.33 EGP (+0.74%) |
| Maximum drawdown | 7,016.84 EGP (0.70%) |
| Profitable trades | 58.06% (18 of 31) |
| Profit factor | 1.585 |

## Interpretation

The sampled run was profitable and kept its measured drawdown below one percent. The result is encouraging as a software-validation example, but 31 trades on one symbol and timeframe are not enough to claim robustness. Commission, slippage, liquidity, order-fill assumptions, and different market regimes can materially change the outcome.

## Next validation steps

1. Repeat the test on a broader set of liquid EGX symbols.
2. Use out-of-sample dates and multiple volatility regimes.
3. Add realistic commission and slippage assumptions.
4. Compare bar-close execution with intrabar behavior.
5. Record parameter sensitivity instead of selecting only the best settings.

This case study documents one historical test; it is not a forecast or trading recommendation.
4 changes: 2 additions & 2 deletions tradingview-export/2026-08-21/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ These files preserve the source as copied from TradingView. They were not normal
## TradingView validation — 2026-08-22

- All 120 scripts were tested individually on `EGX:RMDA` after removing the default indicator and clearing the chart between tests.
- 115 scripts loaded and rendered successfully.
- 5 scripts produced documented Pine compilation errors.
- All 120 scripts loaded and rendered successfully after a repair and re-test pass.
- Five original compilation failures (036, 045, 047, 049, and 050) were corrected, migrated or confirmed on Pine v6, and re-tested on 2026-08-22.
- Strategy Tester reports and screenshots were captured for all 7 strategies.
- Every `.pine` file now has an adjacent `.tests` folder containing `TEST-REPORT.md` and its TradingView screenshot(s).
- [Open the complete test index](test-results/2026-08-22/README.md).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,43 +93,13 @@ alertcondition(ta.crossover(ema_short1, ema_short2), title="تقاطع EMA لل
alertcondition(ta.crossunder(ema_short1, ema_short2), title="تقاطع EMA للمضارب (بيع)", message="EMA 9 crossed below EMA 21")

// ========== دليل الألوان والمؤشرات ========== //
legendText = "دليل الألوان والمؤشرات:\n"+
"EMA 9: سماوي - اتجاه سريع\n"+
"EMA 21: أزرق - اتجاه قصير\n"+
"EMA 100: بنفسجي - اتجاه متوسط\n"+
"EMA 200: أحمر - اتجاه رئيسي\n"+
"SMA 50: برتقالي - متوسط\n"+
"VWAP: أصفر - متوسط مرجح بالحجم\n"+
"Bollinger Bands: رمادي - تقلب السعر\n"+
"MACD: أخضر - زخم\n"+
"MACD Signal: أحمر - خط الإشارة\n"+
"MACD Histogram: رمادي - أعمدة الزخم\n"+
"Ichimoku Conv.: أخضر فاتح شفاف\n"+
"Ichimoku Base: أحمر فاتح شفاف\n"+
"Senkou A: أخضر شفاف\n"+
"Senkou B: أحمر شفاف\n"+
"سحابة صاعدة: أخضر فاتح جدًا\n"+
"سحابة هابطة: أحمر فاتح جدًا\n"+
"RSI > 70: أحمر - تشبع شراء\n"+
"RSI < 30: أخضر - تشبع بيع\n"+
"RSI عادي: رمادي\n"+
"منطقة طلب: مثلث أخضر\n"+
"منطقة عرض: مثلث أحمر"
string legendText = "دليل الألوان والمؤشرات:\nEMA 9: سماوي - اتجاه سريع\nEMA 21: أزرق - اتجاه قصير\nEMA 100: بنفسجي - اتجاه متوسط\nEMA 200: أحمر - اتجاه رئيسي\nSMA 50: برتقالي - متوسط\nVWAP: أصفر - متوسط مرجح بالحجم\nBollinger Bands: رمادي - تقلب السعر\nMACD: أخضر - زخم\nMACD Signal: أحمر - خط الإشارة\nMACD Histogram: رمادي - أعمدة الزخم\nIchimoku Conv.: أخضر فاتح شفاف\nIchimoku Base: أحمر فاتح شفاف\nSenkou A: أخضر شفاف\nSenkou B: أحمر شفاف\nسحابة صاعدة: أخضر فاتح جدًا\nسحابة هابطة: أحمر فاتح جدًا\nRSI > 70: أحمر - تشبع شراء\nRSI < 30: أخضر - تشبع بيع\nRSI عادي: رمادي\nمنطقة طلب: مثلث أخضر\nمنطقة عرض: مثلث أحمر"

// رسم الدليل أعلى الشارت (label)
var legendLabel = na
if bar_index == ta.highest(bar_index, 100)
legendLabel := label.new(
x = bar_index,
y = high,
text = legendText,
xloc = xloc.bar_index,
yloc = yloc.price,
color = color.new(color.white, 92),
style = label.style_label_down,
textcolor = color.black,
size = size.normal
)
if not na(legendLabel)
label.set_x(legendLabel, bar_index)
label.set_y(legendLabel, high)
var label legendLabel = na
if barstate.islast
if na(legendLabel)
legendLabel := label.new(x=bar_index, y=high, text=legendText, xloc=xloc.bar_index, yloc=yloc.price, color=color.new(color.white, 92), style=label.style_label_down, textcolor=color.black, size=size.normal)
else
label.set_xy(legendLabel, bar_index, high)
label.set_text(legendLabel, legendText)
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,25 @@
- **ملف المصدر:** `tradingview-export/2026-08-21/indicators/036-smart-investor-pro-all-in-one-v6-1-with-legend.pine`
- **الرمز المختبر:** EGX:RMDA
- **الإطار الزمني:** 1 day
- **وقت توثيق النتيجة:** 2026-08-21 23:54:25 UTC
- **وقت إعادة الاختبار:** 2026-08-22 (Africa/Cairo)

## النتيجة

❌ خطأ Pine موثّق
✅ تم التجميع والتحميل والعرض بنجاح بعد الإصلاح

### رسائل Pine Editor
### الإصلاح المطبق

- `Syntax error at input "end of line without line continuation"(CE10156)`
- تحويل نص الدليل إلى سلسلة صالحة، واستخدام `label` واحد قابل لإعادة الاستخدام على آخر شمعة لمنع تراكم عناصر الرسم.
- لا توجد أخطاء تجميع متبقية في إعادة الاختبار.

## منهجية الاختبار

1. أُزيل المؤشر الافتراضي وأي سكربت سابق من الرسم قبل بدء الاختبار.
2. فُتح السكربت المحفوظ باسمه الأصلي داخل Pine Editor.
3. أُضيف السكربت منفرداً إلى رسم EGX:RMDA على الإطار الزمني الموضّح أعلاه.
4. سُجّلت رسائل Pine Editor، ثم التُقطت صورة الرسم.
6. أُزيل السكربت من الرسم قبل الانتقال إلى الاختبار التالي.
1. أُزيل المؤشر الافتراضي وأي نسخة اختبار سابقة من الرسم.
2. نُسخ ملف المصدر المصحح نفسه من المستودع إلى Pine Editor مع الحفاظ على فواصل الأسطر.
3. حُفظ كنسخة اختبار خاصة، ثم جرى تجميعه وتحديثه منفردًا على رسم EGX:RMDA.
4. تأكد ظهور Pine v6 وعدم وجود رمز أو رسالة خطأ تجميع.
5. التُقطت صورة الرسم المعزولة بعد نجاح التحديث.
6. جرى استبدال كود نسخة الاختبار الخاصة بالملف التالي دون نشر أي سكربت للعامة.

## الصور

Expand All @@ -32,4 +34,4 @@

- النتيجة توثّق حالة السكربت وإعداداته وبيانات TradingView وقت الاختبار، وليست ضماناً للأداء المستقبلي.
- نتائج الاستراتيجية التاريخية لا تشمل بالضرورة الانزلاق السعري أو السيولة الفعلية أو كل تكاليف التنفيذ.
- لا يُنصح بالاعتماد على أي سكربت ذي خطأ Pine قبل إصلاحه وإعادة اختباره.
- الصورة الحالية توثّق نسخة المصدر المصححة التي جرى تجميعها على Pine v6.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@version=5
//@version=6
indicator("Swing Trader Template - Smart EGX v2", overlay=true, max_lines_count=500, max_labels_count=500)

// === إعدادات الظهور ===
Expand Down Expand Up @@ -53,9 +53,11 @@ plotshape(buySignal, title="إشارة شراء", location=location.belowbar, co
alertcondition(buySignal, title="تنبيه إشارة شراء", message="📢 إشارة شراء على الشارت - تقاطع EMA مع RSI")

// === الدليل المفتاحي على الشارت ===
if bar_index == ta.highest(bar_index, 1)
label.new(x=bar_index, y=high, text=
"🔸 دليل الألوان:\n" +
"🟠 EMA 9\n🔵 EMA 21\n⚪ SMA 50\n⚫ SMA 200\n" +
"🟣 RSI\n🔴 مقاومة\n🟢 دعم\n🟩 خلفية خضراء: اتجاه صاعد\n🟥 خلفية حمراء: اتجاه هابط\n📍 BUY: إشارة شراء",
style=label.style_label_left, textcolor=color.white, size=size.small, bgcolor=color.gray)
string legendText = "🔸 دليل الألوان:\n🟠 EMA 9\n🔵 EMA 21\n⚪ SMA 50\n⚫ SMA 200\n🟣 RSI\n🔴 مقاومة\n🟢 دعم\n🟩 خلفية خضراء: اتجاه صاعد\n🟥 خلفية حمراء: اتجاه هابط\n📍 BUY: إشارة شراء"
var label legendLabel = na
if barstate.islast
if na(legendLabel)
legendLabel := label.new(x=bar_index, y=high, text=legendText, style=label.style_label_left, textcolor=color.white, size=size.small, color=color.gray)
else
label.set_xy(legendLabel, bar_index, high)
label.set_text(legendLabel, legendText)
Loading
Loading