Skip to content

Conversation

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 24, 2025

📝 Walkthrough

Walkthrough

Adds fifth-level pivot points R5 and S5 across Pivot Points and Rolling Pivots: new properties were added to IPivotPoint, PivotPointsResult, WindowPoint, and RollingPivotsResult; the common catalog listing now includes R4/R5 and S4/S5; Standard, Camarilla, and Fibonacci computations and result emission were extended to produce S4–S5 and R4–R5 where applicable. Also tightens Alligator.Validate boundary from teethPeriods <= lipsPeriods to teethPeriods < lipsPeriods.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/m-r/PivotPoints/PivotPoints.StaticSeries.cs (1)

197-211: Critical: Camarilla R5/S5 formulas don't match standard definition.

Multiple authoritative sources define Camarilla R5 as (High / Low) * Close and S5 as Close - (R5 - Close), not as linear extensions of the 1.1/divisor pattern. The implementation uses close + 1.1m * (high - low) for R5 and close - 1.1m * (high - low) for S5, which deviates from the standard Camarilla equation.

Apply this diff to match the standard Camarilla formulas:

             S3 = close - (1.1m / 4 * (high - low)),
             S4 = close - (1.1m / 2 * (high - low)),
-            S5 = close - (1.1m / 1 * (high - low)),
             R1 = close + (1.1m / 12 * (high - low)),
             R2 = close + (1.1m / 6 * (high - low)),
             R3 = close + (1.1m / 4 * (high - low)),
             R4 = close + (1.1m / 2 * (high - low)),
-            R5 = close + (1.1m / 1 * (high - low)),
+            R5 = (high / low) * close,
+            S5 = close - ((high / low) * close - close),
         };
🧹 Nitpick comments (1)
src/m-r/PivotPoints/PivotPoints.Models.cs (1)

8-11: Consider reordering interface properties for consistency.

The interface places R5 before R4 but S5 after S4, creating an asymmetric pattern (R5→R4→R3...S3→S4→S5). While functionally correct, consider a consistent ordering such as R5→R4→R3→R2→R1→PP→S1→S2→S3→S4→S5 or grouping the fifth levels together for better maintainability.

Also applies to: 58-61

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e0bddff and ae17183.

📒 Files selected for processing (6)
  • src/m-r/PivotPoints/PivotPoints.Catalog.cs (1 hunks)
  • src/m-r/PivotPoints/PivotPoints.Models.cs (6 hunks)
  • src/m-r/PivotPoints/PivotPoints.StaticSeries.cs (4 hunks)
  • src/m-r/RollingPivots/RollingPivots.BufferList.cs (1 hunks)
  • src/m-r/RollingPivots/RollingPivots.Models.cs (2 hunks)
  • src/m-r/RollingPivots/RollingPivots.StaticSeries.cs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (9)
**/src/**/*.Catalog.cs

📄 CodeRabbit inference engine (.github/instructions/catalog.instructions.md)

**/src/**/*.Catalog.cs: All catalog files must follow the filename pattern {IndicatorName}.Catalog.cs
Catalog files must reside alongside the indicator source in the src tree (e.g., src/e-k/Ema/Ema.Catalog.cs)
Catalog file must be in the same directory as the corresponding {IndicatorName}.Models.cs and other indicator files
Define indicator metadata using the CatalogListingBuilder pattern
Catalog class must be a static partial class matching the indicator name (e.g., public static partial class Ema)
Use consistent internal static readonly field names: SeriesListing, StreamListing, BufferListing
Include comments "No StreamListing" and/or "No BufferListing" when those styles aren’t supported
Construct listings with IndicatorDefinitionBuilder() and call methods in order: WithName(), WithId(), WithStyle(), WithCategory(), WithMethodName(), parameters, AddResult(), Build()
Use AddParameter() for basic types and include descriptive names/descriptions; set isRequired for mandatory params and provide defaultValue/minimum/maximum as appropriate
Use AddEnumParameter() for enum parameters with sensible default
Use AddDateParameter() for DateTime parameters
Use AddSeriesParameter() for IReadOnlyList where T : IReusable inputs
For optional parameters set isRequired: false and supply a sensible defaultValue
For nullable parameters use nullable types (e.g., AddParameter<double?>())
Always set appropriate minimum/maximum constraints for numeric parameters
Declare results with AddResult(dataName, displayName, ResultType.Default, isReusable) and ensure dataName matches the exact property name in Models (case-sensitive)
For IReusable models, set isReusable: true only for the result mapped to the Value property; exactly one such result must exist
For ISeries (non-IReusable) models, all results must have isReusable: false
Use descriptive displayName values for results for UI clarity
Ensure builder validations pass: no duplicate parameter or result names; interface (IReusable ...

Files:

  • src/m-r/PivotPoints/PivotPoints.Catalog.cs
src/**/*.Catalog.cs

📄 CodeRabbit inference engine (.github/instructions/indicator-buffer.instructions.md)

Add a catalog file at src/**/{IndicatorName}.Catalog.cs with accurate metadata

Create a catalog entry file for each indicator as .Catalog.cs under the appropriate src subfolder

Create an indicator catalog entry file: {IndicatorName}.Catalog.cs and keep it accurate

Files:

  • src/m-r/PivotPoints/PivotPoints.Catalog.cs
src/**

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

src/**: Apply critical formula change rules and mathematical precision requirements for AI agents per src/agents.md
Use the source code completion checklist before committing per .github/instructions/source-code-completion.instructions.md

Files:

  • src/m-r/PivotPoints/PivotPoints.Catalog.cs
  • src/m-r/PivotPoints/PivotPoints.Models.cs
  • src/m-r/RollingPivots/RollingPivots.Models.cs
  • src/m-r/RollingPivots/RollingPivots.StaticSeries.cs
  • src/m-r/RollingPivots/RollingPivots.BufferList.cs
  • src/m-r/PivotPoints/PivotPoints.StaticSeries.cs
src/**/*.cs

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

src/**/*.cs: Provide XML documentation comments for all public types and members; prefer /// to avoid duplication
Prefer explicit variable names over var following .editorconfig conventions
Use filenames that match the containing class name; use modifiers for partial classes spread across files

src/**/*.cs: Implement efficient lookback period calculations for indicators
Validate all public method parameters (input validation)
Provide complete XML documentation for all public methods
Use consistent error messages and exception types across the codebase
Handle insufficient data scenarios and null safety gracefully (e.g., avoid null reference exceptions)
Handle double.NaN appropriately in result types
Implement IReusable correctly for chainable indicators and follow lookback validation patterns
Follow the standard indicator structure: static partial class Indicator with extension methods like ToIndicatorName
Implement series-style indicator method and corresponding result model inheriting from IReusable or ISeries
Avoid off-by-one errors, index out of bounds, and ensure robust historical data access
Prevent precision loss; default to double for performance and use decimal only when materially needed
Refresh and align XML documentation and inline comments with implemented behavior when code changes

Files:

  • src/m-r/PivotPoints/PivotPoints.Catalog.cs
  • src/m-r/PivotPoints/PivotPoints.Models.cs
  • src/m-r/RollingPivots/RollingPivots.Models.cs
  • src/m-r/RollingPivots/RollingPivots.StaticSeries.cs
  • src/m-r/RollingPivots/RollingPivots.BufferList.cs
  • src/m-r/PivotPoints/PivotPoints.StaticSeries.cs

⚙️ CodeRabbit configuration file

src/**/*.cs: Focus on:

  • Mathematical accuracy: Verify financial calculations against reference implementations
  • Performance: Flag unnecessary allocations, excessive LINQ, boxing operations
  • Precision: Ensure appropriate use of double vs decimal for financial calculations
  • Null safety: Validate handling of insufficient data scenarios
  • Input validation: Check parameter validation and error handling
  • Lookback periods: Verify off-by-one errors in window calculations
  • Streaming support: Ensure stateful indicators handle edge cases properly
  • Memory efficiency: Check for proper span usage and buffer management
  • XML documentation: Ensure all public APIs have complete documentation

Files:

  • src/m-r/PivotPoints/PivotPoints.Catalog.cs
  • src/m-r/PivotPoints/PivotPoints.Models.cs
  • src/m-r/RollingPivots/RollingPivots.Models.cs
  • src/m-r/RollingPivots/RollingPivots.StaticSeries.cs
  • src/m-r/RollingPivots/RollingPivots.BufferList.cs
  • src/m-r/PivotPoints/PivotPoints.StaticSeries.cs
{src,tests}/**/*.cs

📄 CodeRabbit inference engine (.github/instructions/source-code-completion.instructions.md)

{src,tests}/**/*.cs: Remove dead or debugging code: delete obsolete/commented code, unused imports/variables/helpers, debug prints (e.g., Console.WriteLine), ad‑hoc harness code, and leftover breakpoints
Use double precision by default; limit decimal to price-sensitive monetary calculations
Minimize LINQ chaining in hot paths to avoid performance regressions
Adhere to .editorconfig formatting and address all Roslyn analyzer/CS warnings

Files:

  • src/m-r/PivotPoints/PivotPoints.Catalog.cs
  • src/m-r/PivotPoints/PivotPoints.Models.cs
  • src/m-r/RollingPivots/RollingPivots.Models.cs
  • src/m-r/RollingPivots/RollingPivots.StaticSeries.cs
  • src/m-r/RollingPivots/RollingPivots.BufferList.cs
  • src/m-r/PivotPoints/PivotPoints.StaticSeries.cs
**/*.Catalog.cs

⚙️ CodeRabbit configuration file

**/*.Catalog.cs: Verify:

  • Parameter definitions: Check types, defaults, constraints match implementation
  • Result definitions: Ensure property names match Models exactly
  • IReusable flags: Verify only one result per indicator has isReusable=true
  • Method names: Follow To{IndicatorName} pattern consistently
  • Category assignments: Use appropriate technical analysis categories

Files:

  • src/m-r/PivotPoints/PivotPoints.Catalog.cs
src/**/*.*Series.cs

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Follow series-style indicator development guidelines from .github/instructions/indicator-series.instructions.md

Files:

  • src/m-r/RollingPivots/RollingPivots.StaticSeries.cs
  • src/m-r/PivotPoints/PivotPoints.StaticSeries.cs
src/**/*.StaticSeries.cs

📄 CodeRabbit inference engine (.github/instructions/indicator-series.instructions.md)

src/**/*.StaticSeries.cs: Provide a source file for each indicator: {IndicatorName}.StaticSeries.cs implementing the series-style indicator per these instructions
Validate parameters up front and throw consistent exceptions/messages
Use efficient loops; avoid unnecessary allocations and LINQ in hot paths
Implement warmup logic and return results with correct timestamps
Follow the prescribed member order in the implementation file
Expose a static extension method To{IndicatorName}(this IReadOnlyList quotes, int lookbackPeriods = {defaultValue}) returning IReadOnlyList<{IndicatorName}Result> with complete XML docs
Input validation: quotes.ThrowIfNull(); materialize quotes to List via ToList()
Input validation: throw ArgumentOutOfRangeException when lookbackPeriods <= 0 with the specified message
On insufficient data (quotes count < lookbackPeriods), return Enumerable.Empty<{IndicatorName}Result>()
Initialize results: preallocate List<{IndicatorName}Result>(quotesList.Count) and pre-populate warmup entries with timestamps
Use a main calculation loop from index lookbackPeriods-1 to end; compute values and append results with timestamp
Provide complete XML documentation including formulas, parameter constraints, references, and examples for complex indicators

Files:

  • src/m-r/RollingPivots/RollingPivots.StaticSeries.cs
  • src/m-r/PivotPoints/PivotPoints.StaticSeries.cs
src/**/*.BufferList.cs

📄 CodeRabbit inference engine (.github/instructions/indicator-buffer.instructions.md)

src/**/*.BufferList.cs: Each BufferList implementation file must exist at src/**/{IndicatorName}.BufferList.cs and adhere to these buffer guidelines
Inherit BufferList and implement exactly one increment interface: IIncrementFromChain or IIncrementFromQuote or IIncrementFromPairs
Provide two constructors for quote-based indicators: (1) parameters-only; (2) parameters + IReadOnlyList quotes, chained via : this(...) => Add(quotes) with an expression-bodied constructor
For IIncrementFromChain indicators, constructor must accept IReadOnlyList (not IReadOnlyList)
For IIncrementFromPairs indicators, constructor must accept two IReadOnlyList collections and validate equal counts and timestamp alignment
Implement required Add overloads for the chosen interface and use BufferUtilities.Update() or UpdateWithDequeue() for buffer operations
Clear() must reset results (via base.Clear()) and all internal buffers/caches
Follow member order: Fields → Constructors → Properties → Methods (Add overloads, Clear) → Extension
Use BufferUtilities extension methods from src/_common/BufferLists/BufferUtilities.cs for all buffer management; do not implement manual enqueue/dequeue logic
Choose UpdateWithDequeue() when tracking removed values for running sums; otherwise use Update()
Prefer tuples for internal buffer state (e.g., Queue<(High, Low, Close)>) and avoid custom structs for internal-only state
Base class pattern: include LookbackPeriods property, Add(DateTime timestamp, double value) that updates the buffer and calls AddInternal, and override Clear() to clear buffers
IIncrementFromChain required methods: Add(DateTime,double), Add(IReusable), Add(IReadOnlyList); no Add(IQuote) methods; use value.Value or OHLC helpers (Hl2OrValue/QuotePartOrValue)
IIncrementFromQuote required methods: Add(IQuote) and Add(IReadOnlyList)
IIncrementFromPairs required methods: Add(DateTime,double,double), Add(IReusable,IReusable), Add(IRea...

Files:

  • src/m-r/RollingPivots/RollingPivots.BufferList.cs
⏰ Context from checks skipped due to timeout of 400000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (10)
src/m-r/PivotPoints/PivotPoints.Catalog.cs (1)

14-24: LGTM - Catalog entries properly extended for fifth-level pivots.

The R5 and S5 result definitions correctly follow the established catalog pattern with appropriate display names, result types, and the reusable flag only on PP.

src/m-r/PivotPoints/PivotPoints.Models.cs (2)

86-87: LGTM - Properties correctly implemented.

The R5 and S5 properties follow the established pattern with appropriate types, accessors, and XML documentation inheritance.

Also applies to: 97-98


117-118: LGTM - WindowPoint properties correctly added.

The internal WindowPoint record properly extends with R5 and S5 properties matching the interface contract.

Also applies to: 128-129

src/m-r/PivotPoints/PivotPoints.StaticSeries.cs (4)

75-100: LGTM - Result initialization properly extended.

The ToPivotPoints method correctly populates S5, R4, and R5 from the calculated WindowPoint, maintaining the existing pattern for non-first windows.


170-188: LGTM - Standard pivot formulas verified correct.

The R4/R5 and S4/S5 formulas match multiple authoritative sources, correctly extending the pattern with multipliers 3x and 4x for the fourth and fifth levels.


244-262: Fibonacci formulas use valid ratios.

The implementation uses 1.618 (golden ratio) and 2.618 (Fibonacci extension) for the fourth and fifth levels. Note that some sources use different Fibonacci ratios like 1.272/1.382 for these levels, but the chosen values are mathematically valid Fibonacci numbers and maintain a consistent progression.


221-285: Correctly preserves Demark and Woodie pivot limitations.

Demark and Woodie pivot types intentionally don't compute S4/S5/R4/R5, as these methods only define levels up to S1/R1 (Demark) and S3/R3 (Woodie) respectively. The WindowPoint properties will remain null for these types, which is the expected behavior.

src/m-r/RollingPivots/RollingPivots.Models.cs (1)

39-42: LGTM - Model properties correctly extended.

The S5 and R5 properties are properly defined with appropriate types, accessors, and XML documentation, fulfilling the IPivotPoint interface contract.

Also applies to: 64-67

src/m-r/RollingPivots/RollingPivots.StaticSeries.cs (1)

56-79: LGTM - Rolling pivots correctly populated.

The S5, R4, and R5 values are properly assigned from the WindowPoint calculation. Note that the Camarilla R5/S5 formula issue identified in PivotPoints.StaticSeries.cs will also affect rolling pivots when using PivotPointType.Camarilla.

src/m-r/RollingPivots/RollingPivots.BufferList.cs (1)

102-118: LGTM - Buffer list correctly extended.

The RollingPivotsList properly populates S5, R4, and R5 from the computed WindowPoint. The buffer management logic remains sound. Note that the Camarilla formula issue in PivotPoints.StaticSeries.cs affects this implementation as well.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/a-d/Alligator/Alligator.Utilities.cs (1)

67-71: Inconsistent validation logic with error message.

The condition change from teethPeriods <= lipsPeriods to teethPeriods < lipsPeriods now allows teethPeriods == lipsPeriods, but the exception message still states "must be greater than" (strict inequality). This creates an inconsistency:

  • The new condition enforces teethPeriods >= lipsPeriods (allows equality)
  • The error message says "must be greater than" (implies strict inequality)
  • Line 61 uses <= with "must be greater than" consistently enforcing strict inequality

The standard Alligator indicator uses strict inequalities between jaw, teeth, and lips periods (e.g., 13 > 8 > 5). Either:

  1. Revert to teethPeriods <= lipsPeriods to maintain strict inequality and match the error message, OR
  2. Update the error message to "greater than or equal to" if equality is intentionally allowed

Apply this diff to restore consistency:

-        if (teethPeriods < lipsPeriods)
+        if (teethPeriods <= lipsPeriods)
         {
             throw new ArgumentOutOfRangeException(nameof(teethPeriods), teethPeriods,
                 "Teeth lookback periods must be greater than Lips lookback periods for Alligator.");
         }
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 731db18 and b735887.

📒 Files selected for processing (3)
  • src/a-d/Alligator/Alligator.Utilities.cs (1 hunks)
  • src/m-r/PivotPoints/PivotPoints.Catalog.cs (1 hunks)
  • src/m-r/PivotPoints/PivotPoints.StaticSeries.cs (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/m-r/PivotPoints/PivotPoints.Catalog.cs
🧰 Additional context used
📓 Path-based instructions (4)
src/**

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

src/**: Apply critical formula change rules and mathematical precision requirements for AI agents per src/agents.md
Use the source code completion checklist before committing per .github/instructions/source-code-completion.instructions.md

Files:

  • src/m-r/PivotPoints/PivotPoints.StaticSeries.cs
  • src/a-d/Alligator/Alligator.Utilities.cs
src/**/*.*Series.cs

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Follow series-style indicator development guidelines from .github/instructions/indicator-series.instructions.md

Files:

  • src/m-r/PivotPoints/PivotPoints.StaticSeries.cs
src/**/*.cs

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

src/**/*.cs: Provide XML documentation comments for all public types and members; prefer /// to avoid duplication
Prefer explicit variable names over var following .editorconfig conventions
Use filenames that match the containing class name; use modifiers for partial classes spread across files

src/**/*.cs: Implement efficient lookback period calculations for indicators
Validate all public method parameters (input validation)
Provide complete XML documentation for all public methods
Use consistent error messages and exception types across the codebase
Handle insufficient data scenarios and null safety gracefully (e.g., avoid null reference exceptions)
Handle double.NaN appropriately in result types
Implement IReusable correctly for chainable indicators and follow lookback validation patterns
Follow the standard indicator structure: static partial class Indicator with extension methods like ToIndicatorName
Implement series-style indicator method and corresponding result model inheriting from IReusable or ISeries
Avoid off-by-one errors, index out of bounds, and ensure robust historical data access
Prevent precision loss; default to double for performance and use decimal only when materially needed
Refresh and align XML documentation and inline comments with implemented behavior when code changes

Files:

  • src/m-r/PivotPoints/PivotPoints.StaticSeries.cs
  • src/a-d/Alligator/Alligator.Utilities.cs

⚙️ CodeRabbit configuration file

src/**/*.cs: Focus on:

  • Mathematical accuracy: Verify financial calculations against reference implementations
  • Performance: Flag unnecessary allocations, excessive LINQ, boxing operations
  • Precision: Ensure appropriate use of double vs decimal for financial calculations
  • Null safety: Validate handling of insufficient data scenarios
  • Input validation: Check parameter validation and error handling
  • Lookback periods: Verify off-by-one errors in window calculations
  • Streaming support: Ensure stateful indicators handle edge cases properly
  • Memory efficiency: Check for proper span usage and buffer management
  • XML documentation: Ensure all public APIs have complete documentation

Files:

  • src/m-r/PivotPoints/PivotPoints.StaticSeries.cs
  • src/a-d/Alligator/Alligator.Utilities.cs
{src,tests}/**/*.cs

📄 CodeRabbit inference engine (.github/instructions/source-code-completion.instructions.md)

{src,tests}/**/*.cs: Remove dead or debugging code: delete obsolete/commented code, unused imports/variables/helpers, debug prints (e.g., Console.WriteLine), ad‑hoc harness code, and leftover breakpoints
Use double precision by default; limit decimal to price-sensitive monetary calculations
Minimize LINQ chaining in hot paths to avoid performance regressions
Adhere to .editorconfig formatting and address all Roslyn analyzer/CS warnings

Files:

  • src/m-r/PivotPoints/PivotPoints.StaticSeries.cs
  • src/a-d/Alligator/Alligator.Utilities.cs
⏰ Context from checks skipped due to timeout of 400000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (1)
src/m-r/PivotPoints/PivotPoints.StaticSeries.cs (1)

89-96: LGTM! Consistent emission of new pivot levels.

The addition of S5, R4, and R5 to the result emission follows the existing pattern correctly. The levels are properly assigned from windowPoint for non-first windows.

Comment on lines +182 to +188
S4 = low - (3 * (high - pp)),
S5 = low - (4 * (high - pp)),
R1 = (pp * 2) - low,
R2 = pp + (high - low),
R3 = high + (2 * (pp - low))
R3 = high + (2 * (pp - low)),
R4 = high + (3 * (pp - low)),
R5 = high + (4 * (pp - low))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify Standard pivot formulas against the reference source.

The formulas follow a consistent mathematical pattern extending R3/S3, but should be verified against the referenced Classic Pivot Points definition to ensure correctness.


🌐 Web query:

What are the formulas for R4, R5, S4, and S5 in Classic/Standard pivot points according to mypivots.com?

💡 Result:

Classic (Standard) pivot formulas on MyPivots:

  • PP = (HIGH + LOW + CLOSE) / 3. [1]
  • RANGE = HIGH − LOW. [1]
  • R1 = (2 * PP) − LOW. [1]
  • R2 = PP + RANGE. [1]
  • R3 = R2 + RANGE = PP + 2 * RANGE. [1]
  • R4 = R3 + RANGE = PP + 3 * RANGE. [1]
  • S1 = (2 * PP) − HIGH. [1]
  • S2 = PP − RANGE. [1]
  • S3 = S2 − RANGE = PP − 2 * RANGE. [1]
  • S4 = S3 − RANGE = PP − 3 * RANGE. [1]

MyPivots' Classic definition lists R1–R4 and S1–S4 only; it does not provide R5 or S5 for the Classic/Standard set. [1][2]

Sources: MyPivots Classic Pivot Points definition and Pivot Point Calculator. [1][2]


Critical formula errors in Standard pivot point calculations—R3, R4, S4 do not match reference; R5/S5 should not exist.

The code's formulas diverge from the MyPivots Classic/Standard definition. R3 should be PP + 2 * RANGE, not high + (2 * (pp - low)). Similarly, R4 = PP + 3 * RANGE, and S4 = PP − 3 * RANGE. Additionally, MyPivots' Classic definition lists R1–R4 and S1–S4 only; it does not provide R5 or S5 for the Classic/Standard set, so these should be removed.

Lines 182–188 require correction to align with the authoritative reference formulas.

🤖 Prompt for AI Agents
In src/m-r/PivotPoints/PivotPoints.StaticSeries.cs around lines 182–188 the
pivot formulas are incorrect and include extra levels R5/S5; replace them so the
Classic/Standard set only computes R1–R4 and S1–S4 using RANGE = high - low and
PP = pp: R1 = (pp * 2) - low, R2 = pp + RANGE, R3 = pp + 2 * RANGE, R4 = pp + 3
* RANGE, S1 = (pp * 2) - high, S2 = pp - RANGE, S3 = pp - 2 * RANGE, S4 = pp - 3
* RANGE; remove any R5 and S5 entries and adjust any surrounding code/exports
that referenced R5/S5.

Comment on lines +207 to +212
S5 = close - (1.1m / 1 * (high - low)),
R1 = close + (1.1m / 12 * (high - low)),
R2 = close + (1.1m / 6 * (high - low)),
R3 = close + (1.1m / 4 * (high - low)),
R4 = close + (1.1m / 2 * (high - low))
R4 = close + (1.1m / 2 * (high - low)),
R5 = close + (1.1m / 1 * (high - low)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify Camarilla pivot formulas against the reference source.

The S5/R5 formulas use the multiplier 1.1 (from 1.1/1), which extends the Camarilla pattern. Please confirm this matches the referenced Camarilla Pivot Points definition.


🌐 Web query:

What are the formulas for R5 and S5 in Camarilla pivot points according to mypivots.com?

💡 Result:

MyPivots.com lists Camarilla pivots only through R4 and S4 — it does not provide formulas for R5 or S5. The site gives:

  • R4 = C + RANGE * 1.1/2
  • R3 = C + RANGE * 1.1/4
  • R2 = C + RANGE * 1.1/6
  • R1 = C + RANGE * 1.1/12
  • PP = (HIGH + LOW + CLOSE) / 3
  • S1 = C - RANGE * 1.1/12
  • S2 = C - RANGE * 1.1/6
  • S3 = C - RANGE * 1.1/4
  • S4 = C - RANGE * 1.1/2

(Where RANGE = HIGH − LOW and C = Close.) [1]

Source: MyPivots — “Camarilla Pivot Points.” [1]


Update GetPivotPointCamarilla R5/S5 formulas to match standard Camarilla implementation.

The fifth layer of Camarilla formulas can vary depending on which version is used, but the code's R5/S5 implementation differs from industry standards. Standard Camarilla implementations define R5 = R4 + 1.168 * (R4 - R3) and S5 = S4 - 1.168 * (S3 - S4), or alternatively R5 = (High/Low) * Close and S5 = Close - (R5 - Close). The code currently uses close ± 1.1 * (high - low), which extends the 1.1/x multiplier pattern but does not align with documented Camarilla variants. Additionally, the cited MyPivots.com reference only defines levels through R4/S4.

Replace the R5/S5 formulas with the standard formula-based approach or document the custom variant rationale.

🤖 Prompt for AI Agents
In src/m-r/PivotPoints/PivotPoints.StaticSeries.cs around lines 207-212, the
R5/S5 Camarilla formulas currently use close ± 1.1*(high-low) which does not
match standard Camarilla definitions; replace the R5/S5 assignments with the
standard Camarilla formula: set R5 = R4 + 1.168m * (R4 - R3) and S5 = S4 -
1.168m * (S3 - S4) (ensure you reference the already-computed R3/R4 and S3/S4
values and use decimal literals with the m suffix), or alternatively implement
the (High/Low)*Close variant if you prefer that documented approach; update any
comments to indicate which Camarilla variant is used.

Comment on lines +256 to +262
S4 = pp - (1.618m * (high - low)),
S5 = pp - (2.618m * (high - low)),
R1 = pp + (0.382m * (high - low)),
R2 = pp + (0.618m * (high - low)),
R3 = pp + (1.000m * (high - low))
R3 = pp + (1.000m * (high - low)),
R4 = pp + (1.618m * (high - low)),
R5 = pp + (2.618m * (high - low)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Verify Fibonacci pivot formulas against the reference source.

The formulas use Fibonacci extension ratios 1.618 and 2.618, which are standard. However, please verify these match the referenced Fibonacci Pivot Points definition. Note: The PR description references the Woodie URL (definition/228) for Fibonacci verification—please confirm the correct reference URL.


🌐 Web query:

What are the formulas for R4, R5, S4, and S5 in Fibonacci pivot points?

💡 Result:

Use the standard pivot (PP) and the prior-day range (DR):

PP = (High + Low + Close) / 3
DR = High - Low

Fibonacci extensions:

  • R4 = PP + 1.382 * DR. [1]
  • R5 = PP + 1.618 * DR. [1]
  • S4 = PP - 1.382 * DR. [1]
  • S5 = PP - 1.618 * DR. [1]

(These ratios are the common Fibonacci extension multipliers used for R4/R5 and S4/S5.) [1][2]

Sources: Sierra Chart pivot formulas; TradingView Fibonacci pivot implementation. [1][2]


Fix Fibonacci pivot formulas—ratios are incorrect.

The formulas use wrong Fibonacci extension ratios. According to standard Fibonacci pivot implementations:

  • R4 and S4 should use 1.382, not 1.618
  • R5 and S5 should use 1.618, not 2.618

Corrected formulas (lines 256-262):

S4 = pp - (1.382m * (high - low)),
S5 = pp - (1.618m * (high - low)),
R1 = pp + (0.382m * (high - low)),
R2 = pp + (0.618m * (high - low)),
R3 = pp + (1.000m * (high - low)),
R4 = pp + (1.382m * (high - low)),
R5 = pp + (1.618m * (high - low)),
🤖 Prompt for AI Agents
In src/m-r/PivotPoints/PivotPoints.StaticSeries.cs around lines 256 to 262 the
Fibonacci extension ratios are wrong: R4/S4 currently use 1.618 and R5/S5 use
2.618; update the constants so S4 = pp - (1.382m * (high - low)), S5 = pp -
(1.618m * (high - low)), R1 = pp + (0.382m * (high - low)), R2 = pp + (0.618m *
(high - low)), R3 = pp + (1.000m * (high - low)), R4 = pp + (1.382m * (high -
low)), R5 = pp + (1.618m * (high - low)) to reflect standard Fibonacci pivot
ratios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants