From d5e0fed4cd4293f5c32d18a73aed85900673dd4d Mon Sep 17 00:00:00 2001 From: Toh4iem9 Date: Sat, 22 Aug 2026 18:09:00 +0200 Subject: [PATCH] docs: refactor --- Indicators/MyIndicators/PivotPoints_Pro.md | 209 +++++++++++++++++---- 1 file changed, 168 insertions(+), 41 deletions(-) diff --git a/Indicators/MyIndicators/PivotPoints_Pro.md b/Indicators/MyIndicators/PivotPoints_Pro.md index af07d8c..635af31 100644 --- a/Indicators/MyIndicators/PivotPoints_Pro.md +++ b/Indicators/MyIndicators/PivotPoints_Pro.md @@ -1,69 +1,196 @@ -# Pivot Points Pro +# Pivot Points Pro (v3.30) *Professional Quantitative Multi-Timeframe Support & Resistance Suite* + +--- ## 1. Summary (Introduction) -**Pivot Points Pro** is a professional-grade support and resistance indicator designed for precision trading. Unlike standard pivot indicators that clutter the chart with historical lines, this tool focuses on clarity and relevance by displaying levels **only for the current period**. +**Pivot Points Pro** is a high-performance, institutional-grade support and resistance indicator developed for MetaTrader 5 (2026 Edition). Designed specifically for active technical analysts and systematic traders, it eliminates the visual noise of historical lines by rendering levels **strictly for the active period** while extending them continuously across the entire chart workspace. -It offers advanced features such as: +### Key Innovations in Version 3.30 -* **Multi-Timeframe (MTF) Calculation:** Display Daily pivots on an M15 chart, Weekly pivots on H1, etc. -* **5 Calculation Modes:** Classic, Fibonacci, Woodie, Camarilla, and DeMark. -* **Heikin Ashi Support:** Calculate pivot levels based on Heikin Ashi candles for smoother, trend-aligned levels. -* **Full Visual Customization:** Control the color, style, and width of every level group (PP, Resistance, Support, Medians). +* **Native Full-Workspace & Chart Shift Support:** Utilizes a zero-latency vector rendering engine (`OBJPROP_RAY_RIGHT`) that anchors lines to the exact period open (e.g., 00:00) and extends them seamlessly across current price action to the far-right price scale. +* **Dual-Layer Architecture:** Combines hardware-accelerated chart objects for flawless visuals with synchronized indicator buffers (`DRAW_NONE`) to ensure 100% compatibility with MetaTrader 5 **Data Window (`Ctrl+D`)** and automated Expert Advisors (`iCustom`). +* **Multi-Timeframe (MTF) Engine:** Real-time synchronization allowing Daily, Weekly, or Monthly pivots to be displayed on intraday timeframes (M1, M5, M15, H1). +* **5 Institutional Formula Modes:** Classic Floor, Fibonacci, Woodie, Camarilla, and Tom DeMark. +* **Heikin Ashi Filtered Source:** Dynamic transformation of OHLC prices into synthetic Heikin Ashi data to eliminate high-frequency false breakouts. + +--- ## 2. Mathematical Foundations -Pivot Points are calculated based on the High (H), Low (L), and Close (C) of the **previous** period. +Pivot Points are computed using the High ($H$), Low ($L$), and Close ($C$) prices from the **previous completed** higher-timeframe bar. The Range is defined as: +$$\text{Range} = H - L$$ -### Calculation Modes +### 2.1. Calculation Modes -1. **Classic:** The standard floor trader pivots. - * $PP = (H + L + C) / 3$ - * $R1 = 2 \times PP - L$, $S1 = 2 \times PP - H$ -2. **Fibonacci:** Uses Fibonacci ratios (0.382, 0.618, 1.0) added to/subtracted from the PP. - * $R1 = PP + 0.382 \times (H - L)$ -3. **Woodie:** Gives more weight to the Close price. - * $PP = (H + L + 2 \times C) / 4$ -4. **Camarilla:** Focuses on close-range mean reversion. - * $R3 = C + (H - L) \times 1.1 / 4$ -5. **DeMark:** Uses a conditional logic based on the relationship between Open and Close to predict the next period's range. +#### 1. Classic (Floor Trader) -## 3. MQL5 Implementation Details +The quintessential standard for intraday equilibrium and reaction bands: +$$PP = \frac{H + L + C}{3}$$ +$$R1 = 2 \cdot PP - L \quad\quad S1 = 2 \cdot PP - H$$ +$$R2 = PP + \text{Range} \quad\quad S2 = PP - \text{Range}$$ +$$R3 = H + 2 \cdot (PP - L) \quad\quad S3 = L - 2 \cdot (H - PP)$$ -* **Optimized Performance:** The indicator uses an intelligent caching mechanism. It calculates the levels only once per higher-timeframe period (e.g., once a day for D1 pivots), ensuring zero impact on terminal performance. -* **Current Period Only:** The indicator automatically detects the start of the current period and draws lines only from that point forward. This keeps the chart clean and focused on the "now." -* **Modular Engine:** Powered by `PivotPoint_Calculator.mqh`. +#### 2. Fibonacci -## 4. Parameters +Projects golden ratio intervals around the central equilibrium: +$$PP = \frac{H + L + C}{3}$$ +$$R1 = PP + 0.382 \cdot \text{Range} \quad\quad S1 = PP - 0.382 \cdot \text{Range}$$ +$$R2 = PP + 0.618 \cdot \text{Range} \quad\quad S2 = PP - 0.618 \cdot \text{Range}$$ +$$R3 = PP + 1.000 \cdot \text{Range} \quad\quad S3 = PP - 1.000 \cdot \text{Range}$$ + +#### 3. Woodie + +Weights the settlement price more heavily to account for late-session momentum: +$$PP = \frac{H + L + 2 \cdot C}{4}$$ +$$R1 = 2 \cdot PP - L \quad\quad S1 = 2 \cdot PP - H$$ +$$R2 = PP + \text{Range} \quad\quad S2 = PP - \text{Range}$$ +$$R3 = H + 2 \cdot (PP - L) \quad\quad S3 = L - 2 \cdot (H - PP)$$ + +#### 4. Camarilla + +Specifically calibrated for mean-reverting range scalping and explosive breakout triggers: +$$PP = \frac{H + L + C}{3}$$ +$$R1 = C + \text{Range} \cdot \frac{1.1}{12} \quad\quad S1 = C - \text{Range} \cdot \frac{1.1}{12}$$ +$$R2 = C + \text{Range} \cdot \frac{1.1}{6} \quad\quad S2 = C - \text{Range} \cdot \frac{1.1}{6}$$ +$$R3 = C + \text{Range} \cdot \frac{1.1}{4} \quad\quad S3 = C - \text{Range} \cdot \frac{1.1}{4}$$ + +#### 5. Tom DeMark + +A conditional predictive model based on open-close directional pressure: +$$\text{If } C < O \implies X = H + 2 \cdot L + C$$ +$$\text{If } C > O \implies X = 2 \cdot H + L + C$$ +$$\text{If } C = O \implies X = H + L + 2 \cdot C$$ + +$$PP = \frac{X}{4}$$ +$$R1 = \frac{X}{2} - L \quad\quad S1 = \frac{X}{2} - H$$ + +--- + +### 2.2. Median Equilibrium Levels (Mid-Points) + +When enabled, arithmetic midpoints are calculated to provide intermediate micro-structure targets: +$$M_1 = \frac{S1 + S2}{2}, \quad M_2 = \frac{S1 + PP}{2}, \quad M_3 = \frac{PP + R1}{2}$$ +$$M_4 = \frac{R1 + R2}{2}, \quad M_5 = \frac{R2 + R3}{2}, \quad M_6 = \frac{S2 + S3}{2}$$ + +--- + +### 2.3. Heikin Ashi Synthetic Price Model + +When `InpSourceType = PIVOT_SRC_HEIKIN_ASHI`, prices are filtered prior to level calculations: +$$C_{\text{ha}} = \frac{O + H + L + C}{4}$$ +$$O_{\text{ha}} = \frac{O_{\text{prev}} + C_{\text{prev}}}{2}$$ +$$H_{\text{ha}} = \max(H, \max(O_{\text{ha}}, C_{\text{ha}}))$$ +$$L_{\text{ha}} = \min(L, \min(O_{\text{ha}}, C_{\text{ha}}))$$ + +--- + +## 3. MQL5 Architecture & Technical Implementation + +```text + +┌────────────────────────────────────────────────────────┐ +│ PivotPoint_Calculator.mqh │ +│ (Core Math Engine - Stateful O(1) Cache Memory) │ +└──────────────────────────┬─────────────────────────────┘ + │ Computes Levels & Period Start + ▼ +┌────────────────────────────────────────────────────────┐ +│ PivotPoints_Pro.mq5 │ +│ (Thin Wrapper - Vector Ray Engine & Data Buffers) │ +├──────────────────────────┬─────────────────────────────┤ +│ Buffer Layer (13) │ Extended Object Engine │ +│ • Data Window (Ctrl+D) │ • Ray Right Vector Lines │ +│ • iCustom EA Ready │ • Future Shift Labels │ +└──────────────────────────┴─────────────────────────────┘ + +``` + +1. **Stateful HTF Caching ($O(1)$ Efficiency):** Calculations run only once when a new HTF session bar opens. Subsequent ticks retrieve levels from cached memory. +2. **Extended Ray Objects:** Utilizes `OBJ_TREND` with `OBJPROP_RAY_RIGHT = true` and `OBJPROP_BACK = true`. This prevents line clipping at the live bar index and fills the Chart Shift workspace cleanly. +3. **Smart Label Engine:** Text labels (`OBJ_TEXT`) automatically float into the forward workspace margin (`InpLabelShift` bars ahead) to avoid obscuring the current price action. +4. **Resource Management:** Safe pointer deletion (`CheckPointer`) and prefix-based object purging (`ObjectsDeleteAll`) prevent ghost objects during symbol, timeframe, or parameter updates. + +--- + +## 4. Parameters Reference ### Timeframe Settings -* **Pivot Timeframe:** The higher timeframe used for calculation (e.g., D1, W1, MN1). Must be greater than or equal to the chart timeframe. +* `InpTimeframe` (*default: `PERIOD_D1`*): The Higher Timeframe used for calculation. Must be greater than or equal to the current chart timeframe. ### Calculation Settings -* **Pivot Formula:** Select the calculation method (Classic, Fibonacci, etc.). -* **Price Source:** Select `Standard` (OHLC) or `Heikin Ashi` (HA-OHLC). Using HA can filter out noise spikes from the calculation. +* `InpPivotType` (*default: `PIVOT_CLASSIC`*): Formula selection (`PIVOT_CLASSIC`, `PIVOT_FIBONACCI`, `PIVOT_WOODIE`, `PIVOT_CAMARILLA`, `PIVOT_DEMARK`). +* `InpSourceType` (*default: `PIVOT_SRC_STANDARD`*): Price series source (`PIVOT_SRC_STANDARD` or `PIVOT_SRC_HEIKIN_ASHI`). -### Visual Settings +### Visual Settings - Pivot Point -* **Colors/Styles:** Customize the appearance of the Pivot Point (PP), Resistance levels (R1-R3), Support levels (S1-S3), and Median levels (M). -* **Show Medians:** Toggle the display of mid-point levels (e.g., between PP and R1). -* **Labels:** Toggle text labels and adjust their position/size. +* `InpColorPP` (*default: `clrGold`*): Color of the central equilibrium level (PP). +* `InpStylePP` (*default: `STYLE_SOLID`*): Line style of the central PP. +* `InpWidthPP` (*default: `2`*): Line thickness of the central PP. -## 5. Usage and Interpretation +### Visual Settings - Resistance Levels -### Trend Determination +* `InpColorRes` (*default: `clrDodgerBlue`*): Color applied to R1, R2, and R3. +* `InpStyleRes` (*default: `STYLE_SOLID`*): Line style for resistance lines. +* `InpWidthRes` (*default: `1`*): Line thickness for resistance lines. -* **Above PP:** If price is trading above the central Pivot Point (Gold line), the bias is **Bullish**. -* **Below PP:** If price is trading below the central Pivot Point, the bias is **Bearish**. +### Visual Settings - Support Levels -### Support and Resistance +* `InpColorSup` (*default: `clrFireBrick`*): Color applied to S1, S2, and S3. +* `InpStyleSup` (*default: `STYLE_SOLID`*): Line style for support lines. +* `InpWidthSup` (*default: `1`*): Line thickness for support lines. -* **R1, R2, R3:** Act as profit targets for long positions or potential reversal zones for short entries. -* **S1, S2, S3:** Act as profit targets for short positions or potential reversal zones for long entries. +### Visual Settings - Medians -### Breakout vs. Bounce +* `InpShowMedians` (*default: `true`*): Toggle arithmetic midpoint levels between main pivots. +* `InpColorMed` (*default: `clrSilver`*): Color for median lines. +* `InpStyleMed` (*default: `STYLE_DOT`*): Line style for median lines. +* `InpWidthMed` (*default: `1`*): Line thickness for median lines. -* **Bounce:** In a ranging market, look for price to reject these levels (e.g., buy at S1, sell at R1). -* **Breakout:** In a trending market, a strong close beyond a level (e.g., R1) often signals a continuation to the next level (R2). +### Labels + +* `InpShowLabels` (*default: `true`*): Toggle text identifiers (PP, R1, S1, etc.) on the chart. +* `InpLabelShift` (*default: `8`*): Offset distance (in bars) extending into the forward chart shift space. +* `InpFontSize` (*default: `8`*): Font size of the text identifiers. + +--- + +## 5. Usage & Trading Interpretation + +### 5.1. Directional Bias (The Central Pivot) + +* **Bullish Bias:** Price established above $PP$. Look for pullbacks toward $PP$ or momentum continuations toward $R1$, $R2$, and $R3$. +* **Bearish Bias:** Price established below $PP$. Look for pullbacks toward $PP$ or momentum continuations toward $S1$, $S2$, and $S3$. + +### 5.2. Mean Reversion vs. Momentum Breakout + +* **Ranging Markets (Consolidation):** Support levels ($S1, S2$) act as demand pools; resistance levels ($R1, R2$) act as supply caps. Fades from $S1$ toward $PP$ and $R1$ toward $PP$ offer favorable risk-to-reward ratios. +* **Trending Markets (Breakout Expansion):** A decisive candle close beyond $R1$ or $S1$ confirms momentum, shifting the next targets to $R2/R3$ or $S2/S3$. + +### 5.3. Role of Median Lines ($M_1 \dots M_6$) + +* Medians serve as early take-profit targets or entry-confirmation zones before committing to full structural target levels. + +--- + +## 6. Indicator Buffer Map (For Developers & EA Integration) + +| Buffer Index | Name | Formula / Level | Description | +| :---: | :---: | :---: | :--- | +| **0** | `BufferPP` | $PP$ | Central Pivot Point | +| **1** | `BufferR1` | $R1$ | First Resistance Level | +| **2** | `BufferS1` | $S1$ | First Support Level | +| **3** | `BufferR2` | $R2$ | Second Resistance Level | +| **4** | `BufferS2` | $S2$ | Second Support Level | +| **5** | `BufferR3` | $R3$ | Third Resistance Level | +| **6** | `BufferS3` | $S3$ | Third Support Level | +| **7** | `BufferM1` | $(S1 + S2)/2$ | Median Between S1 and S2 | +| **8** | `BufferM2` | $(S1 + PP)/2$ | Median Between S1 and PP | +| **9** | `BufferM3` | $(PP + R1)/2$ | Median Between PP and R1 | +| **10** | `BufferM4` | $(R1 + R2)/2$ | Median Between R1 and R2 | +| **11** | `BufferM5` | $(R2 + R3)/2$ | Median Between R2 and R3 | +| **12** | `BufferM6` | $(S2 + S3)/2$ | Median Between S2 and S3 | + +*All buffers return `EMPTY_VALUE` for historical periods outside the active session, maintaining a pristine and deterministic environment for backtesting and automated execution.*