mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-25 05:48:06 +00:00
Merge branch 'dev' into main
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
| **PineScript** | [starchannel.pine](starchannel.pine) |
|
||||
|
||||
- Stoller Average Range Channel creates a volatility-adaptive price envelope using Average True Range (ATR) to determine band width around a simple m...
|
||||
- **Similar:** [KChannel](../kchannel/kchannel.md), [ATRBands](../atrbands/atrbands.md) | **Complementary:** ADX for trend confirmation | **Trading note:** Stoller Average Range Channel; ATR-based bands around a moving average.
|
||||
- **Similar:** [KC](../kc/kc.md), [ATRBands](../atrbands/atrbands.md) | **Complementary:** ADX for trend confirmation | **Trading note:** Stoller Average Range Channel; ATR-based bands around a moving average.
|
||||
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
|
||||
|
||||
Stoller Average Range Channel creates a volatility-adaptive price envelope using Average True Range (ATR) to determine band width around a simple moving average centerline. The bands automatically expand during volatile periods and contract during calmer markets. The implementation uses a circular buffer for the SMA running sum and Wilder's RMA with a warmup compensator for ATR, achieving O(1) streaming updates per bar.
|
||||
|
||||
@@ -501,16 +501,16 @@ public sealed class StarchannelValidationTests : IDisposable
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Validate_KchannelComparison_Structure()
|
||||
public void Validate_KcComparison_Structure()
|
||||
{
|
||||
// Compare structural properties with Kchannel (EMA vs SMA middle)
|
||||
// Compare structural properties with Kc (EMA vs SMA middle)
|
||||
// Both use ATR for bands, so band calculation should be similar
|
||||
|
||||
const int period = 20;
|
||||
const double multiplier = 2.0;
|
||||
|
||||
var star = new Starchannel(period, multiplier);
|
||||
var kelt = new Kchannel(period, multiplier);
|
||||
var kelt = new Kc(period, multiplier);
|
||||
|
||||
foreach (var bar in _testData.Bars)
|
||||
{
|
||||
@@ -543,18 +543,18 @@ public sealed class StarchannelValidationTests : IDisposable
|
||||
double keltLowerDist = kelt.Last.Value - kelt.Lower.Value;
|
||||
Assert.Equal(keltUpperDist, keltLowerDist, 1e-10);
|
||||
|
||||
_output.WriteLine("Starchannel vs Kchannel structure validated");
|
||||
_output.WriteLine("Starchannel vs Kc structure validated");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Validate_Starchannel_DifferentFromKchannel()
|
||||
public void Validate_Starchannel_DifferentFromKc()
|
||||
{
|
||||
// Starchannel (SMA) should differ from Kchannel (EMA) in the middle line
|
||||
// Starchannel (SMA) should differ from Kc (EMA) in the middle line
|
||||
const int period = 20;
|
||||
const double multiplier = 2.0;
|
||||
|
||||
var star = new Starchannel(period, multiplier);
|
||||
var kelt = new Kchannel(period, multiplier);
|
||||
var kelt = new Kc(period, multiplier);
|
||||
|
||||
foreach (var bar in _testData.Bars)
|
||||
{
|
||||
@@ -569,7 +569,7 @@ public sealed class StarchannelValidationTests : IDisposable
|
||||
// Just verify they're both finite and reasonable
|
||||
Assert.True(double.IsFinite(diff));
|
||||
|
||||
_output.WriteLine($"Starchannel vs Kchannel middle difference: {diff:F6}");
|
||||
_output.WriteLine($"Starchannel vs Kc middle difference: {diff:F6}");
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════
|
||||
|
||||
Reference in New Issue
Block a user