Add Stochastic Oscillator implementation and validation tests

- Implemented Stochastic Oscillator (%K and %D) in Stoch.cs with streaming and batch processing capabilities.
- Added validation tests for the Stochastic Oscillator in Stoch.Validation.Tests.cs, ensuring consistency with Skender.Stock.Indicators.
- Created documentation for the Stochastic Oscillator in Stoch.md, detailing its mathematical formula, architecture, parameters, and common pitfalls.
- Updated project file to include necessary numeric libraries for highest and lowest calculations.
This commit is contained in:
Miha Kralj
2026-02-12 14:29:54 -08:00
parent 653aafacd8
commit 92709ef2ed
73 changed files with 14721 additions and 35 deletions
-9
View File
@@ -3,13 +3,6 @@
//@version=6
indicator("Bollinger %B", "BBB", overlay=false)
//@function Calculates Bollinger Bands components for %B calculation
//@doc https://github.com/mihakralj/pinescript/blob/main/indicators/oscillators/bbb.md
//@param source Series to calculate from
//@param period Lookback period for SMA and standard deviation
//@param multiplier Standard deviation multiplier for band width
//@returns Bollinger %B value (typically 0-1 range; can overshoot)
//@optimized Uses circular buffer with running sums, O(1) complexity per bar
bbb(series float source, simple int period, simple float multiplier) =>
if period <= 0 or multiplier <= 0.0
runtime.error("Period and multiplier must be greater than 0")
@@ -66,8 +59,6 @@ bbb(series float source, simple int period, simple float multiplier) =>
result
// ---------- Main loop ----------
// Inputs
i_period = input.int(20, "Period", minval=1)
i_source = input.source(close, "Source")