Skip to content

Commit

Permalink
macos dev update
Browse files Browse the repository at this point in the history
  • Loading branch information
mihakralj committed Oct 27, 2024
1 parent e4f718a commit c21b961
Show file tree
Hide file tree
Showing 28 changed files with 458 additions and 345 deletions.
4 changes: 1 addition & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@
<PackageReference Include="Microsoft.DotNet.Interactive.Formatting" Version="1.0.0-beta.21459.1" />
</ItemGroup>

<PropertyGroup Condition="'$(IsLocalBuild)' == 'true'">

<!-- Set the correct path to Quantower here -->
<PropertyGroup Condition="'$(IsLocalBuild)' == 'true' AND $([MSBuild]::IsOSPlatform('Windows'))">
<QuantowerRoot>D:\Quantower</QuantowerRoot>
<QuantowerPath>$([System.IO.Directory]::GetDirectories("$(QuantowerRoot)\TradingPlatform", "v1*")[0])</QuantowerPath>
</PropertyGroup>
Expand Down
8 changes: 7 additions & 1 deletion Tests/test_eventing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ public void EventBasedCalculations()
("Tema", new Tema(p), new Tema(input, p)),
("Kama", new Kama(2, 30, 6), new Kama(input, 2, 30, 6)),
("Zlema", new Zlema(p), new Zlema(input, p)),
// oscillators
("Rsi", new Rsi(p), new Rsi(input, p)),
("Rsx", new Rsx(p), new Rsx(input, p)),
("Cmo", new Cmo(p), new Cmo(input, p)),
// volatility
("Rv", new Rv(p), new Rv(input, p)),
// error classes
("Mae", new Mae(p), new Mae(input, p)),
("Mapd", new Mapd(p), new Mapd(input, p)),
Expand All @@ -67,7 +73,7 @@ public void EventBasedCalculations()
("Rse", new Rse(p), new Rse(input, p)),
("Smape", new Smape(p), new Smape(input, p)),
("Rsquared", new Rsquared(p), new Rsquared(input, p)),
("Huberloss", new Huberloss(p), new Huberloss(input, p))
("Huber", new Huber(p), new Huber(input, p))
};

// Generate 200 random values and feed them to both direct and event-based indicators
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_updates_errors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ private double GetRandomDouble()
[Fact]
public void Huberloss_Update()
{
var indicator = new Huberloss(period: 14);
var indicator = new Huber(period: 14);
double initialValue = indicator.Calc(new TValue(DateTime.Now, ReferenceValue, IsNew: true));

for (int i = 0; i < RandomUpdates; i++)
Expand Down
4 changes: 2 additions & 2 deletions Tests/test_updates_volatility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void Atr_Update()
[Fact]
public void Historical_Update()
{
var indicator = new Historical(period: 14);
var indicator = new Hv(period: 14);
double initialValue = indicator.Calc(new TBar(DateTime.Now, ReferenceValue, ReferenceValue, ReferenceValue, ReferenceValue, 1000, IsNew: true));

for (int i = 0; i < RandomUpdates; i++)
Expand All @@ -60,7 +60,7 @@ public void Historical_Update()
[Fact]
public void Realized_Update()
{
var indicator = new Realized(period: 14);
var indicator = new Rv(period: 14);
double initialValue = indicator.Calc(new TBar(DateTime.Now, ReferenceValue, ReferenceValue, ReferenceValue, ReferenceValue, 1000, IsNew: true));

for (int i = 0; i < RandomUpdates; i++)
Expand Down
3 changes: 3 additions & 0 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@

* [Home](/)

[JMA](indicators/averages/jma/calc.md)

* Introduction
* [Overview]()
* [Features]()
Expand Down
48 changes: 48 additions & 0 deletions docs/indicators/averages/jma/calc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# JMA Calculation

### Initial Parameters:

$\beta = factor \cdot \frac{period - 1}{factor \cdot (period - 1) + 2}$

$len1 = \frac{\ln(\sqrt{period - 1})}{\ln(2)} + 2$

$pow1 = \max(len1 - 2, 0.5)$

$phase \in [0.5, 2.5]$ (clamped to $(phase \cdot 0.01) + 1.5$)

### Volatility Calculations:

$del1_t = price_t - upperBand_{t-1}$

$del2_t = price_t - lowerBand_{t-1}$

$volty_t = \max(|del1_t|, |del2_t|)$

$vSum_t = \frac{\sum_{i=t-buffer+1}^t volty_i}{buffer}$

$avgVolty_t = \text{mean}(vSum_{t-64:t})$

$rVolty_t = \text{clamp}(\frac{volty_t}{avgVolty_t}, 1, len1^{1/pow1})$

### Band Calculations:

$pow2_t = rVolty_t^{pow1}$

$K_v = \beta^{\sqrt{pow2_t}}$


$upperBand_t = price_t - K_v \cdot del1_t$



$\alpha_t = \beta^{pow2_t}$

$ma1_t = price_t + \alpha_t(ma1_{t-1} - price_t)$

$det0_t = price_t + \beta(det0_{t-1} - price_t + ma1_t) - ma1_t$

$ma2_t = ma1_t + phase \cdot det0_t$

$det1_t = (ma2_t - jma_{t-1})(1-\alpha_t)^2 + \alpha_t^2 \cdot det1_{t-1}$

$jma_t = jma_{t-1} + det1_t$
Loading

0 comments on commit c21b961

Please sign in to comment.