diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 00000000..05967830
Binary files /dev/null and b/.DS_Store differ
diff --git a/QuanTAlib.sln b/QuanTAlib.sln
index cc6b9863..0d9aeabf 100644
--- a/QuanTAlib.sln
+++ b/QuanTAlib.sln
@@ -1,74 +1,51 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.2.32210.308
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "Tests\Tests.csproj", "{283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}"
- ProjectSection(ProjectDependencies) = postProject
- {5096AEA1-81BC-46E7-9F2B-B408AFAA850C} = {5096AEA1-81BC-46E7-9F2B-B408AFAA850C}
- EndProjectSection
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QuanTAlib", "Source\QuanTAlib.csproj", "{AAE21F8A-9BC2-4647-A9EB-4DC86C569080}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{3AA87FFE-4EEE-4C1B-82E0-2A5E40E2254D}"
- ProjectSection(SolutionItems) = preProject
- Docs\bars_and_HMA.dib = Docs\bars_and_HMA.dib
- Docs\Comparing_w_TALIB.ipynb = Docs\Comparing_w_TALIB.ipynb
- Docs\getting_started.ipynb = Docs\getting_started.ipynb
- Docs\Indicators.md = Docs\Indicators.md
- Docs\LICENSE = Docs\LICENSE
- Docs\ma-comparison.dib = Docs\ma-comparison.dib
- Docs\macd_example.ipynb = Docs\macd_example.ipynb
- Docs\QuanTAlib_Indicators.dib = Docs\QuanTAlib_Indicators.dib
- Docs\QuanTAlib_test.ipynb = Docs\QuanTAlib_test.ipynb
- Docs\README.md = Docs\README.md
- EndProjectSection
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Source", "Source", "{8D8CD223-7A8C-46C4-A326-58E0B735FBA4}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Quantower", "Quantower\Quantower.csproj", "{5096AEA1-81BC-46E7-9F2B-B408AFAA850C}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Debug|x64 = Debug|x64
- Release|Any CPU = Release|Any CPU
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Debug|Any CPU.ActiveCfg = Debug|x64
- {283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Debug|Any CPU.Build.0 = Debug|x64
- {283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Debug|x64.ActiveCfg = Debug|x64
- {283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Debug|x64.Build.0 = Debug|x64
- {283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Release|Any CPU.Build.0 = Release|Any CPU
- {283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Release|x64.ActiveCfg = Release|x64
- {283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Release|x64.Build.0 = Release|x64
- {AAE21F8A-9BC2-4647-A9EB-4DC86C569080}.Debug|Any CPU.ActiveCfg = Release|Any CPU
- {AAE21F8A-9BC2-4647-A9EB-4DC86C569080}.Debug|Any CPU.Build.0 = Release|Any CPU
- {AAE21F8A-9BC2-4647-A9EB-4DC86C569080}.Debug|x64.ActiveCfg = Debug|Any CPU
- {AAE21F8A-9BC2-4647-A9EB-4DC86C569080}.Debug|x64.Build.0 = Debug|Any CPU
- {AAE21F8A-9BC2-4647-A9EB-4DC86C569080}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {AAE21F8A-9BC2-4647-A9EB-4DC86C569080}.Release|Any CPU.Build.0 = Release|Any CPU
- {AAE21F8A-9BC2-4647-A9EB-4DC86C569080}.Release|x64.ActiveCfg = Release|Any CPU
- {AAE21F8A-9BC2-4647-A9EB-4DC86C569080}.Release|x64.Build.0 = Release|Any CPU
- {5096AEA1-81BC-46E7-9F2B-B408AFAA850C}.Debug|Any CPU.ActiveCfg = Release|Any CPU
- {5096AEA1-81BC-46E7-9F2B-B408AFAA850C}.Debug|Any CPU.Build.0 = Release|Any CPU
- {5096AEA1-81BC-46E7-9F2B-B408AFAA850C}.Debug|x64.ActiveCfg = Release|Any CPU
- {5096AEA1-81BC-46E7-9F2B-B408AFAA850C}.Debug|x64.Build.0 = Release|Any CPU
- {5096AEA1-81BC-46E7-9F2B-B408AFAA850C}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {5096AEA1-81BC-46E7-9F2B-B408AFAA850C}.Release|Any CPU.Build.0 = Release|Any CPU
- {5096AEA1-81BC-46E7-9F2B-B408AFAA850C}.Release|x64.ActiveCfg = Release|Any CPU
- {5096AEA1-81BC-46E7-9F2B-B408AFAA850C}.Release|x64.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(NestedProjects) = preSolution
- {283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D} = {8D8CD223-7A8C-46C4-A326-58E0B735FBA4}
- {AAE21F8A-9BC2-4647-A9EB-4DC86C569080} = {8D8CD223-7A8C-46C4-A326-58E0B735FBA4}
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {E5592DC2-0542-45B2-A0CF-C6B1EDC72B87}
- EndGlobalSection
-EndGlobal
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.2.32210.308
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QuanTAlib", "Source\QuanTAlib.csproj", "{AAE21F8A-9BC2-4647-A9EB-4DC86C569080}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Quantower", "Quantower\Quantower.csproj", "{5096AEA1-81BC-46E7-9F2B-B408AFAA850C}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "Tests\Tests.csproj", "{283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Debug|x64 = Debug|x64
+ Release|Any CPU = Release|Any CPU
+ Release|x64 = Release|x64
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {AAE21F8A-9BC2-4647-A9EB-4DC86C569080}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AAE21F8A-9BC2-4647-A9EB-4DC86C569080}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {AAE21F8A-9BC2-4647-A9EB-4DC86C569080}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {AAE21F8A-9BC2-4647-A9EB-4DC86C569080}.Debug|x64.Build.0 = Debug|Any CPU
+ {AAE21F8A-9BC2-4647-A9EB-4DC86C569080}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AAE21F8A-9BC2-4647-A9EB-4DC86C569080}.Release|Any CPU.Build.0 = Release|Any CPU
+ {AAE21F8A-9BC2-4647-A9EB-4DC86C569080}.Release|x64.ActiveCfg = Release|x64
+ {AAE21F8A-9BC2-4647-A9EB-4DC86C569080}.Release|x64.Build.0 = Release|x64
+ {5096AEA1-81BC-46E7-9F2B-B408AFAA850C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {5096AEA1-81BC-46E7-9F2B-B408AFAA850C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {5096AEA1-81BC-46E7-9F2B-B408AFAA850C}.Debug|x64.ActiveCfg = Release|Any CPU
+ {5096AEA1-81BC-46E7-9F2B-B408AFAA850C}.Debug|x64.Build.0 = Release|Any CPU
+ {5096AEA1-81BC-46E7-9F2B-B408AFAA850C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {5096AEA1-81BC-46E7-9F2B-B408AFAA850C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {5096AEA1-81BC-46E7-9F2B-B408AFAA850C}.Release|x64.ActiveCfg = Release|x64
+ {5096AEA1-81BC-46E7-9F2B-B408AFAA850C}.Release|x64.Build.0 = Release|x64
+ {283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Debug|x64.ActiveCfg = Debug|x64
+ {283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Debug|x64.Build.0 = Debug|x64
+ {283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Release|x64.ActiveCfg = Release|x64
+ {283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Release|x64.Build.0 = Release|x64
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {E5592DC2-0542-45B2-A0CF-C6B1EDC72B87}
+ EndGlobalSection
+EndGlobal
diff --git a/Quantower/Indicators/ATR_chart.cs b/Quantower/Indicators/ATR_chart.cs
new file mode 100644
index 00000000..ce467455
--- /dev/null
+++ b/Quantower/Indicators/ATR_chart.cs
@@ -0,0 +1,46 @@
+using System.Drawing;
+using TradingPlatform.BusinessLayer;
+namespace QuanTAlib;
+
+public class ATR_chart : Indicator
+{
+ #region Parameters
+
+ [InputParameter("Smoothing period", 0, 1, 999, 1, 1)]
+ private readonly int Period = 10;
+
+ #endregion Parameters
+
+ private readonly TBars bars = new();
+
+ ///////
+ private ATR_Series indicator;
+ ///////
+
+ public ATR_chart()
+ {
+ this.SeparateWindow = true;
+ this.Name = "ATR - Average True Range";
+ this.Description = "Average True Range description";
+ this.AddLineSeries("ATR", Color.RoyalBlue, 3, LineStyle.Solid);
+ }
+
+ protected override void OnInit()
+ {
+ this.ShortName =
+ "ATR (" + this.Period + ")";
+ this.indicator = new(source: bars, period: this.Period, useNaN: false);
+ }
+
+ protected override void OnUpdate(UpdateArgs args)
+ {
+ bool update = !(args.Reason == UpdateReason.NewBar ||
+ args.Reason == UpdateReason.HistoricalBar);
+ this.bars.Add(this.Time(), this.GetPrice(PriceType.Open),
+ this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
+ this.GetPrice(PriceType.Close),
+ this.GetPrice(PriceType.Volume), update);
+ double result = this.indicator[this.indicator.Count - 1].v;
+ this.SetValue(result);
+ }
+}
diff --git a/Quantower/Indicators/BIAS_chart.cs b/Quantower/Indicators/BIAS_chart.cs
index 9d1adadb..7dde6123 100644
--- a/Quantower/Indicators/BIAS_chart.cs
+++ b/Quantower/Indicators/BIAS_chart.cs
@@ -38,8 +38,6 @@ public class BIAS_chart : Indicator
new(source: bars.Select(this.DataSource), period: this.Period);
}
- protected void OnNewData(bool update = false) { this.indicator.Add(update); }
-
protected override void OnUpdate(UpdateArgs args)
{
bool update = !(args.Reason == UpdateReason.NewBar ||
@@ -48,7 +46,6 @@ public class BIAS_chart : Indicator
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
this.GetPrice(PriceType.Close),
this.GetPrice(PriceType.Volume), update);
- this.OnNewData(update);
double result = this.indicator[this.indicator.Count - 1].v;
this.SetValue(result, 0);
}
diff --git a/Quantower/Indicators/DEMA_chart.cs b/Quantower/Indicators/DEMA_chart.cs
index ebca279a..76c63628 100644
--- a/Quantower/Indicators/DEMA_chart.cs
+++ b/Quantower/Indicators/DEMA_chart.cs
@@ -38,8 +38,6 @@ public class DEMA_chart : Indicator
period: this.Period, useNaN: false);
}
- protected void OnNewData(bool update = false) { this.indicator.Add(update); }
-
protected override void OnUpdate(UpdateArgs args)
{
bool update = !(args.Reason == UpdateReason.NewBar ||
@@ -48,8 +46,6 @@ public class DEMA_chart : Indicator
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
this.GetPrice(PriceType.Close),
this.GetPrice(PriceType.Volume), update);
- this.OnNewData(update);
-
double result = this.indicator[this.indicator.Count - 1].v;
this.SetValue(result);
}
diff --git a/Quantower/Indicators/EMA_chart.cs b/Quantower/Indicators/EMA_chart.cs
index 2dcbe4bd..27055ade 100644
--- a/Quantower/Indicators/EMA_chart.cs
+++ b/Quantower/Indicators/EMA_chart.cs
@@ -38,8 +38,6 @@ public class EMA_chart : Indicator
period: this.Period, useNaN: false);
}
- protected void OnNewData(bool update = false) { this.indicator.Add(update); }
-
protected override void OnUpdate(UpdateArgs args)
{
bool update = !(args.Reason == UpdateReason.NewBar ||
@@ -48,8 +46,6 @@ public class EMA_chart : Indicator
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
this.GetPrice(PriceType.Close),
this.GetPrice(PriceType.Volume), update);
- this.OnNewData(update);
-
double result = this.indicator[this.indicator.Count - 1].v;
this.SetValue(result);
}
diff --git a/Quantower/Indicators/ENTP_chart.cs b/Quantower/Indicators/ENTP_chart.cs
index d7e49cb3..5e1974eb 100644
--- a/Quantower/Indicators/ENTP_chart.cs
+++ b/Quantower/Indicators/ENTP_chart.cs
@@ -38,8 +38,6 @@ public class ENTP_chart : Indicator
period: this.Period, useNaN: true);
}
- protected void OnNewData(bool update = false) { this.indicator.Add(update); }
-
protected override void OnUpdate(UpdateArgs args)
{
bool update = !(args.Reason == UpdateReason.NewBar ||
@@ -48,8 +46,6 @@ public class ENTP_chart : Indicator
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
this.GetPrice(PriceType.Close),
this.GetPrice(PriceType.Volume), update);
- this.OnNewData(update);
-
double result = this.indicator[this.indicator.Count - 1].v;
this.SetValue(result, 0);
diff --git a/Quantower/Indicators/HEMA_chart.cs b/Quantower/Indicators/HEMA_chart.cs
index 47b4d369..273648fc 100644
--- a/Quantower/Indicators/HEMA_chart.cs
+++ b/Quantower/Indicators/HEMA_chart.cs
@@ -38,8 +38,6 @@ public class HEMA_chart : Indicator
period: this.Period, useNaN: false);
}
- protected void OnNewData(bool update = false) { this.indicator.Add(update); }
-
protected override void OnUpdate(UpdateArgs args)
{
bool update = !(args.Reason == UpdateReason.NewBar ||
@@ -48,8 +46,6 @@ public class HEMA_chart : Indicator
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
this.GetPrice(PriceType.Close),
this.GetPrice(PriceType.Volume), update);
- this.OnNewData(update);
-
double result = this.indicator[this.indicator.Count - 1].v;
this.SetValue(result);
}
diff --git a/Quantower/Indicators/HMA_chart.cs b/Quantower/Indicators/HMA_chart.cs
index 39aa660d..2c1f5f96 100644
--- a/Quantower/Indicators/HMA_chart.cs
+++ b/Quantower/Indicators/HMA_chart.cs
@@ -1,56 +1,56 @@
-using System.Drawing;
-using TradingPlatform.BusinessLayer;
-namespace QuanTAlib;
-
-public class HMA_chart : Indicator
-{
- #region Parameters
-
- [InputParameter("Smoothing period", 0, 1, 999, 1, 1)]
- private int Period = 10;
-
- [InputParameter("Data source", 1, variants: new object[]
- { "Open", 0, "High", 1, "Low", 2, "Close", 3, "HL2", 4, "OC2", 5,
- "OHL3", 6, "HLC3", 7, "OHLC4", 8, "Weighted (HLCC4)", 9 })]
- private int DataSource = 3;
-
- #endregion Parameters
-
- private readonly TBars bars = new();
-
- ///////
- private HMA_Series indicator;
- ///////
-
- public HMA_chart()
- {
- this.SeparateWindow = false;
- this.Name = "HMA - Hull Moving Average";
- this.Description = "Hull Moving Average description";
- this.AddLineSeries("HMA", Color.RoyalBlue, 3, LineStyle.Solid);
- }
-
- protected override void OnInit()
- {
- this.ShortName =
- "HMA (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
- this.indicator = new(source: bars.Select(this.DataSource),
- period: this.Period, useNaN: false);
- }
-
- protected void OnNewData(bool update = false) { this.indicator.Add(update); }
-
- protected override void OnUpdate(UpdateArgs args)
- {
- bool update = !(args.Reason == UpdateReason.NewBar ||
- args.Reason == UpdateReason.HistoricalBar);
- this.bars.Add(this.Time(), this.GetPrice(PriceType.Open),
- this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
- this.GetPrice(PriceType.Close),
- this.GetPrice(PriceType.Volume), update);
- this.OnNewData(update);
-
- double result = this.indicator[this.indicator.Count - 1].v;
- this.SetValue(result);
- }
-}
+using System.Diagnostics;
+using System.Drawing;
+using TradingPlatform.BusinessLayer;
+namespace QuanTAlib;
+
+public class HMA_chart : Indicator
+{
+ #region Parameters
+
+ [InputParameter("Smoothing period", 0, 1, 999, 1, 1)]
+ private int Period = 10;
+
+ [InputParameter("Data source", 1, variants: new object[]
+ { "Open", 0, "High", 1, "Low", 2, "Close", 3, "HL2", 4, "OC2", 5,
+ "OHL3", 6, "HLC3", 7, "OHLC4", 8, "Weighted (HLCC4)", 9 })]
+ private int DataSource = 3;
+
+ #endregion Parameters
+
+ private readonly TBars bars = new();
+
+ ///////
+ private HMA_Series indicator;
+ ///////
+
+ public HMA_chart()
+ {
+ this.SeparateWindow = false;
+ this.Name = "HMA - Hull Moving Average";
+ this.Description = "Hull Moving Average description";
+ this.AddLineSeries("HMA", Color.RoyalBlue, 3, LineStyle.Solid);
+ }
+
+ protected override void OnInit()
+ {
+ this.ShortName =
+ "HMA (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
+ this.indicator = new(source: bars.Select(this.DataSource),
+ period: this.Period, useNaN: false);
+ Debug.WriteLine("Send to debug output.");
+}
+
+ protected override void OnUpdate(UpdateArgs args)
+ {
+ Debug.WriteLine("Send to debug output.");
+
+ bool update = !(args.Reason == UpdateReason.NewBar ||
+ args.Reason == UpdateReason.HistoricalBar);
+ this.bars.Add(this.Time(), this.GetPrice(PriceType.Open),
+ this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
+ this.GetPrice(PriceType.Close),
+ this.GetPrice(PriceType.Volume), update);
+ double result = this.indicator[this.indicator.Count - 1].v;
+ this.SetValue(result);
+ }
+}
diff --git a/Quantower/Indicators/JMA_chart.cs b/Quantower/Indicators/JMA_chart.cs
index 92d811f6..9f9c016d 100644
--- a/Quantower/Indicators/JMA_chart.cs
+++ b/Quantower/Indicators/JMA_chart.cs
@@ -37,9 +37,6 @@ public class JMA_chart : Indicator
this.indicator = new(source: bars.Select(this.DataSource),
period: this.Period, useNaN: false);
}
-
- protected void OnNewData(bool update = false) { this.indicator.Add(update); }
-
protected override void OnUpdate(UpdateArgs args)
{
bool update = !(args.Reason == UpdateReason.NewBar ||
@@ -48,8 +45,6 @@ public class JMA_chart : Indicator
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
this.GetPrice(PriceType.Close),
this.GetPrice(PriceType.Volume), update);
- this.OnNewData(update);
-
double result = this.indicator[this.indicator.Count - 1].v;
this.SetValue(result);
}
diff --git a/Quantower/Indicators/KURT_chart.cs b/Quantower/Indicators/KURT_chart.cs
index aae895d5..81cad58d 100644
--- a/Quantower/Indicators/KURT_chart.cs
+++ b/Quantower/Indicators/KURT_chart.cs
@@ -38,8 +38,6 @@ public class KURT_chart : Indicator
period: this.Period, useNaN: true);
}
- protected void OnNewData(bool update = false) { this.indicator.Add(update); }
-
protected override void OnUpdate(UpdateArgs args)
{
bool update = !(args.Reason == UpdateReason.NewBar ||
@@ -48,7 +46,6 @@ public class KURT_chart : Indicator
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
this.GetPrice(PriceType.Close),
this.GetPrice(PriceType.Volume), update);
- this.OnNewData(update);
double result = this.indicator[this.indicator.Count - 1].v;
this.SetValue(result, 0);
}
diff --git a/Quantower/Indicators/MAD_chart.cs b/Quantower/Indicators/MAD_chart.cs
index 668c22c7..dc675d2b 100644
--- a/Quantower/Indicators/MAD_chart.cs
+++ b/Quantower/Indicators/MAD_chart.cs
@@ -38,8 +38,6 @@ public class MAD_chart : Indicator
period: this.Period, useNaN: true);
}
- protected void OnNewData(bool update = false) { this.indicator.Add(update); }
-
protected override void OnUpdate(UpdateArgs args)
{
bool update = !(args.Reason == UpdateReason.NewBar ||
@@ -48,7 +46,6 @@ public class MAD_chart : Indicator
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
this.GetPrice(PriceType.Close),
this.GetPrice(PriceType.Volume), update);
- this.OnNewData(update);
double result = this.indicator[this.indicator.Count - 1].v;
diff --git a/Quantower/Indicators/MAPE_chart.cs b/Quantower/Indicators/MAPE_chart.cs
index 2c891dab..57e47fcb 100644
--- a/Quantower/Indicators/MAPE_chart.cs
+++ b/Quantower/Indicators/MAPE_chart.cs
@@ -38,8 +38,6 @@ public class MAPE_chart : Indicator
period: this.Period, useNaN: true);
}
- protected void OnNewData(bool update = false) { this.indicator.Add(update); }
-
protected override void OnUpdate(UpdateArgs args)
{
bool update = !(args.Reason == UpdateReason.NewBar ||
@@ -48,7 +46,6 @@ public class MAPE_chart : Indicator
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
this.GetPrice(PriceType.Close),
this.GetPrice(PriceType.Volume), update);
- this.OnNewData(update);
double result = this.indicator[this.indicator.Count - 1].v;
diff --git a/Quantower/Indicators/MAX_chart.cs b/Quantower/Indicators/MAX_chart.cs
index c1cbc2c6..a0d2d851 100644
--- a/Quantower/Indicators/MAX_chart.cs
+++ b/Quantower/Indicators/MAX_chart.cs
@@ -38,8 +38,6 @@ public class MAX_chart : Indicator
new(source: bars.Select(this.DataSource), period: this.Period);
}
- protected void OnNewData(bool update = false) { this.indicator.Add(update); }
-
protected override void OnUpdate(UpdateArgs args)
{
bool update = !(args.Reason == UpdateReason.NewBar ||
@@ -48,8 +46,6 @@ public class MAX_chart : Indicator
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
this.GetPrice(PriceType.Close),
this.GetPrice(PriceType.Volume), update);
- this.OnNewData(update);
-
double result = this.indicator[this.indicator.Count - 1].v;
this.SetValue(result, 0);
diff --git a/Quantower/Indicators/MED_chart.cs b/Quantower/Indicators/MED_chart.cs
index b692a879..98fa6428 100644
--- a/Quantower/Indicators/MED_chart.cs
+++ b/Quantower/Indicators/MED_chart.cs
@@ -37,8 +37,6 @@ public class MED_chart : Indicator
this.indicator =
new(source: bars.Select(this.DataSource), period: this.Period);
}
-
- protected void OnNewData(bool update = false) { this.indicator.Add(update); }
protected override void OnUpdate(UpdateArgs args)
{
bool update = !(args.Reason == UpdateReason.NewBar ||
@@ -47,7 +45,6 @@ public class MED_chart : Indicator
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
this.GetPrice(PriceType.Close),
this.GetPrice(PriceType.Volume), update);
- this.OnNewData(update);
double result = this.indicator[this.indicator.Count - 1].v;
this.SetValue(result, 0);
}
diff --git a/Quantower/Indicators/MIN_chart.cs b/Quantower/Indicators/MIN_chart.cs
index 9ee0458d..c35a5700 100644
--- a/Quantower/Indicators/MIN_chart.cs
+++ b/Quantower/Indicators/MIN_chart.cs
@@ -38,8 +38,6 @@ public class MIN_chart : Indicator
new(source: bars.Select(this.DataSource), period: this.Period);
}
- protected void OnNewData(bool update = false) { this.indicator.Add(update); }
-
protected override void OnUpdate(UpdateArgs args)
{
bool update = !(args.Reason == UpdateReason.NewBar ||
@@ -48,8 +46,6 @@ public class MIN_chart : Indicator
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
this.GetPrice(PriceType.Close),
this.GetPrice(PriceType.Volume), update);
- this.OnNewData(update);
-
double result = this.indicator[this.indicator.Count - 1].v;
this.SetValue(result, 0);
diff --git a/Quantower/Indicators/MSE_chart.cs b/Quantower/Indicators/MSE_chart.cs
index 2bce6b72..dce7d818 100644
--- a/Quantower/Indicators/MSE_chart.cs
+++ b/Quantower/Indicators/MSE_chart.cs
@@ -38,8 +38,6 @@ public class MSE_chart : Indicator
period: this.Period, useNaN: true);
}
- protected void OnNewData(bool update = false) { this.indicator.Add(update); }
-
protected override void OnUpdate(UpdateArgs args)
{
bool update = !(args.Reason == UpdateReason.NewBar ||
@@ -48,7 +46,6 @@ public class MSE_chart : Indicator
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
this.GetPrice(PriceType.Close),
this.GetPrice(PriceType.Volume), update);
- this.OnNewData(update);
double result = this.indicator[this.indicator.Count - 1].v;
diff --git a/Quantower/Indicators/PSDEV_chart.cs b/Quantower/Indicators/PSDEV_chart.cs
index 5cb89173..d10f65b3 100644
--- a/Quantower/Indicators/PSDEV_chart.cs
+++ b/Quantower/Indicators/PSDEV_chart.cs
@@ -37,9 +37,6 @@ public class PSDEV_chart : Indicator
this.indicator = new(source: bars.Select(this.DataSource),
period: this.Period, useNaN: true);
}
-
- protected void OnNewData(bool update = false) { this.indicator.Add(update); }
-
protected override void OnUpdate(UpdateArgs args)
{
bool update = !(args.Reason == UpdateReason.NewBar ||
@@ -48,8 +45,6 @@ public class PSDEV_chart : Indicator
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
this.GetPrice(PriceType.Close),
this.GetPrice(PriceType.Volume), update);
- this.OnNewData(update);
-
double result = this.indicator[this.indicator.Count - 1].v;
this.SetValue(result, 0);
diff --git a/Quantower/Indicators/PVAR_chart.cs b/Quantower/Indicators/PVAR_chart.cs
index 20416403..2fa31678 100644
--- a/Quantower/Indicators/PVAR_chart.cs
+++ b/Quantower/Indicators/PVAR_chart.cs
@@ -38,8 +38,6 @@ public class PVAR_chart : Indicator
period: this.Period, useNaN: true);
}
- protected void OnNewData(bool update = false) { this.indicator.Add(update); }
-
protected override void OnUpdate(UpdateArgs args)
{
bool update = !(args.Reason == UpdateReason.NewBar ||
@@ -48,8 +46,6 @@ public class PVAR_chart : Indicator
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
this.GetPrice(PriceType.Close),
this.GetPrice(PriceType.Volume), update);
- this.OnNewData(update);
-
double result = this.indicator[this.indicator.Count - 1].v;
this.SetValue(result, 0);
diff --git a/Quantower/Indicators/RMA_chart.cs b/Quantower/Indicators/RMA_chart.cs
index 77f72ba6..53357414 100644
--- a/Quantower/Indicators/RMA_chart.cs
+++ b/Quantower/Indicators/RMA_chart.cs
@@ -38,8 +38,6 @@ public class RMA_chart : Indicator
period: this.Period, useNaN: false);
}
- protected void OnNewData(bool update = false) { this.indicator.Add(update); }
-
protected override void OnUpdate(UpdateArgs args)
{
bool update = !(args.Reason == UpdateReason.NewBar ||
@@ -48,8 +46,6 @@ public class RMA_chart : Indicator
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
this.GetPrice(PriceType.Close),
this.GetPrice(PriceType.Volume), update);
- this.OnNewData(update);
-
double result = this.indicator[this.indicator.Count - 1].v;
this.SetValue(result);
}
diff --git a/Quantower/Indicators/SDEV_chart.cs b/Quantower/Indicators/SDEV_chart.cs
index 1f528dc9..6a8709a0 100644
--- a/Quantower/Indicators/SDEV_chart.cs
+++ b/Quantower/Indicators/SDEV_chart.cs
@@ -37,9 +37,6 @@ public class SDEV_chart : Indicator
this.indicator = new(source: bars.Select(this.DataSource),
period: this.Period, useNaN: true);
}
-
- protected void OnNewData(bool update = false) { this.indicator.Add(update); }
-
protected override void OnUpdate(UpdateArgs args)
{
bool update = !(args.Reason == UpdateReason.NewBar ||
@@ -48,8 +45,6 @@ public class SDEV_chart : Indicator
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
this.GetPrice(PriceType.Close),
this.GetPrice(PriceType.Volume), update);
- this.OnNewData(update);
-
double result = this.indicator[this.indicator.Count - 1].v;
this.SetValue(result, 0);
diff --git a/Quantower/Indicators/SMAPE_chart.cs b/Quantower/Indicators/SMAPE_chart.cs
index 298226f0..b0005e89 100644
--- a/Quantower/Indicators/SMAPE_chart.cs
+++ b/Quantower/Indicators/SMAPE_chart.cs
@@ -38,8 +38,6 @@ public class SMAPE_chart : Indicator
period: this.Period, useNaN: true);
}
- protected void OnNewData(bool update = false) { this.indicator.Add(update); }
-
protected override void OnUpdate(UpdateArgs args)
{
bool update = !(args.Reason == UpdateReason.NewBar ||
@@ -48,8 +46,6 @@ public class SMAPE_chart : Indicator
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
this.GetPrice(PriceType.Close),
this.GetPrice(PriceType.Volume), update);
- this.OnNewData(update);
-
double result = this.indicator[this.indicator.Count - 1].v;
this.SetValue(result, 0);
diff --git a/Quantower/Indicators/SMA_chart.cs b/Quantower/Indicators/SMA_chart.cs
index baf01aca..3b1933e9 100644
--- a/Quantower/Indicators/SMA_chart.cs
+++ b/Quantower/Indicators/SMA_chart.cs
@@ -7,12 +7,12 @@ public class SMA_chart : Indicator
#region Parameters
[InputParameter("Smoothing period", 0, 1, 999, 1, 1)]
- private int Period = 10;
+ private readonly int Period = 10;
[InputParameter("Data source", 1, variants: new object[]
{ "Open", 0, "High", 1, "Low", 2, "Close", 3, "HL2", 4, "OC2", 5,
"OHL3", 6, "HLC3", 7, "OHLC4", 8, "Weighted (HLCC4)", 9 })]
- private int DataSource = 3;
+ private readonly int DataSource = 3;
#endregion Parameters
@@ -36,11 +36,9 @@ public class SMA_chart : Indicator
"SMA (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
this.indicator = new(source: bars.Select(this.DataSource),
period: this.Period, useNaN: false);
- }
-
- protected void OnNewData(bool update = false) { this.indicator.Add(update); }
-
- protected override void OnUpdate(UpdateArgs args)
+ }
+
+ protected override void OnUpdate(UpdateArgs args)
{
bool update = !(args.Reason == UpdateReason.NewBar ||
args.Reason == UpdateReason.HistoricalBar);
@@ -48,8 +46,6 @@ public class SMA_chart : Indicator
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
this.GetPrice(PriceType.Close),
this.GetPrice(PriceType.Volume), update);
- this.OnNewData(update);
-
double result = this.indicator[this.indicator.Count - 1].v;
this.SetValue(result);
}
diff --git a/Quantower/Indicators/TEMA_chart.cs b/Quantower/Indicators/TEMA_chart.cs
index f80261c6..72904f66 100644
--- a/Quantower/Indicators/TEMA_chart.cs
+++ b/Quantower/Indicators/TEMA_chart.cs
@@ -38,8 +38,6 @@ public class TEMA_chart : Indicator
period: this.Period, useNaN: false);
}
- protected void OnNewData(bool update = false) { this.indicator.Add(update); }
-
protected override void OnUpdate(UpdateArgs args)
{
bool update = !(args.Reason == UpdateReason.NewBar ||
@@ -48,8 +46,6 @@ public class TEMA_chart : Indicator
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
this.GetPrice(PriceType.Close),
this.GetPrice(PriceType.Volume), update);
- this.OnNewData(update);
-
double result = this.indicator[this.indicator.Count - 1].v;
this.SetValue(result);
}
diff --git a/Quantower/Indicators/VAR_chart.cs b/Quantower/Indicators/VAR_chart.cs
index 3af3ff87..cbb05692 100644
--- a/Quantower/Indicators/VAR_chart.cs
+++ b/Quantower/Indicators/VAR_chart.cs
@@ -37,9 +37,7 @@ public class VAR_chart : Indicator
this.indicator = new(source: bars.Select(this.DataSource),
period: this.Period, useNaN: true);
}
-
- protected void OnNewData(bool update = false) { this.indicator.Add(update); }
-
+
protected override void OnUpdate(UpdateArgs args)
{
bool update = !(args.Reason == UpdateReason.NewBar ||
@@ -48,8 +46,6 @@ public class VAR_chart : Indicator
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
this.GetPrice(PriceType.Close),
this.GetPrice(PriceType.Volume), update);
- this.OnNewData(update);
-
double result = this.indicator[this.indicator.Count - 1].v;
this.SetValue(result, 0);
diff --git a/Quantower/Indicators/WMAPE_chart.cs b/Quantower/Indicators/WMAPE_chart.cs
index 60731245..f8a66212 100644
--- a/Quantower/Indicators/WMAPE_chart.cs
+++ b/Quantower/Indicators/WMAPE_chart.cs
@@ -44,15 +44,10 @@ public class WMAPE_chart : Indicator
this.ShortName = "WMAPE (" + QuanTAlib.TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
this.indicator = new(source: this.bars.Select(this.DataSource), period: this.Period, useNaN: true);
}
-
- protected void OnNewData(bool update = false) => this.indicator.Add(update);
-
protected override void OnUpdate(UpdateArgs args)
{
bool update = !(args.Reason == UpdateReason.NewBar || args.Reason == UpdateReason.HistoricalBar);
this.bars.Add(this.Time(), this.GetPrice(PriceType.Open), this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low), this.GetPrice(PriceType.Close), this.GetPrice(PriceType.Volume), update);
- this.OnNewData(update);
-
double result = this.indicator[this.indicator.Count - 1].v;
diff --git a/Quantower/Indicators/WMA_chart.cs b/Quantower/Indicators/WMA_chart.cs
index e40bad95..fc9ab073 100644
--- a/Quantower/Indicators/WMA_chart.cs
+++ b/Quantower/Indicators/WMA_chart.cs
@@ -37,9 +37,6 @@ public class WMA_chart : Indicator
this.indicator = new(source: bars.Select(this.DataSource),
period: this.Period, useNaN: false);
}
-
- protected void OnNewData(bool update = false) { this.indicator.Add(update); }
-
protected override void OnUpdate(UpdateArgs args)
{
bool update = !(args.Reason == UpdateReason.NewBar ||
@@ -48,8 +45,6 @@ public class WMA_chart : Indicator
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
this.GetPrice(PriceType.Close),
this.GetPrice(PriceType.Volume), update);
- this.OnNewData(update);
-
double result = this.indicator[this.indicator.Count - 1].v;
this.SetValue(result);
}
diff --git a/Quantower/Indicators/ZLEMA_chart.cs b/Quantower/Indicators/ZLEMA_chart.cs
index f9f7e4c8..16ee75ee 100644
--- a/Quantower/Indicators/ZLEMA_chart.cs
+++ b/Quantower/Indicators/ZLEMA_chart.cs
@@ -37,10 +37,7 @@ public class ZLEMA_chart : Indicator
this.indicator = new(source: bars.Select(this.DataSource),
period: this.Period, useNaN: false);
}
-
- protected void OnNewData(bool update = false) { this.indicator.Add(update); }
-
- protected override void OnUpdate(UpdateArgs args)
+ protected override void OnUpdate(UpdateArgs args)
{
bool update = !(args.Reason == UpdateReason.NewBar ||
args.Reason == UpdateReason.HistoricalBar);
@@ -48,7 +45,6 @@ public class ZLEMA_chart : Indicator
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
this.GetPrice(PriceType.Close),
this.GetPrice(PriceType.Volume), update);
- this.OnNewData(update);
double result = this.indicator[this.indicator.Count - 1].v;
this.SetValue(result);
diff --git a/Quantower/Quantower.csproj b/Quantower/Quantower.csproj
index 0fbcbe7d..44a503ad 100644
--- a/Quantower/Quantower.csproj
+++ b/Quantower/Quantower.csproj
@@ -8,15 +8,33 @@
Indicator
Quantower_QTAlib
QuanTAlib
- Release
- bin\
+ embedded
+ AnyCPU
+ disable
+ False
+
+ True
+ 3
+ True
+ anycpu
+ full
+
+
+
+ embedded
+ True
+ 3
+ True
+ anycpu
+
+
-
+
-
+
diff --git a/Source/Basics/ZL_Series.cs b/Source/Basics/ZL_Series.cs
index 9eaa7ea7..c4843d19 100644
--- a/Source/Basics/ZL_Series.cs
+++ b/Source/Basics/ZL_Series.cs
@@ -1,35 +1,35 @@
-namespace QuanTAlib;
-using System;
-
-/*
-ZL: Zero Lag
- Data is de-lagged by removing the data from “lag” days ago, thus removing
- (or attempting to) the cumulative effect of the moving average.
-
-Calculation:
- Lag = (Period-1)/2
- ZL = Data + (Data - Data(Lag days ago) )
-
-Sources:
- https://mudrex.com/blog/zero-lag-ema-trading-strategy/
-
- */
-
-public class ZL_Series : Single_TSeries_Indicator
-{
- public ZL_Series(TSeries source, int period, bool useNaN = false) : base(source, period:period, useNaN:useNaN) {
- if (this._data.Count > 0) { base.Add(this._data); }
- }
-
- public override void Add((DateTime t, double v) TValue, bool update)
- {
- int _lag = (int)((_p-1) * 0.5);
- _lag = (_data.Count-_lag < 0) ? 0 : _data.Count-_lag;
-
- double _zl = TValue.v + (TValue.v - _data[_lag].v);
-
- var ret = (TValue.t, (base.Count==0 && base._NaN) ? double.NaN : _zl );
- base.Add(ret, update);
-
- }
+namespace QuanTAlib;
+using System;
+
+/*
+ZL: Zero Lag
+ Data is de-lagged by removing the data from “lag” days ago, thus removing
+ (or attempting to) the cumulative effect of the moving average.
+
+Calculation:
+ Lag = (Period-1)/2
+ ZL = Data + (Data - Data(Lag days ago) )
+
+Sources:
+ https://mudrex.com/blog/zero-lag-ema-trading-strategy/
+
+ */
+
+public class ZL_Series : Single_TSeries_Indicator
+{
+ public ZL_Series(TSeries source, int period, bool useNaN = false) : base(source, period:period, useNaN:useNaN) {
+ if (this._data.Count > 0) { base.Add(this._data); }
+ }
+
+ public override void Add((DateTime t, double v) TValue, bool update)
+ {
+ int _lag = (int)((_p-1) * 0.5);
+ _lag = (_data.Count-_lag < 0) ? 0 : _data.Count-_lag;
+
+ double _zl = TValue.v + (TValue.v - _data[_lag].v);
+
+ var ret = (TValue.t, (base.Count==0 && base._NaN) ? double.NaN : _zl );
+ base.Add(ret, update);
+
+ }
}
\ No newline at end of file
diff --git a/Source/QuanTAlib.csproj b/Source/QuanTAlib.csproj
index 92cac419..cf665210 100644
--- a/Source/QuanTAlib.csproj
+++ b/Source/QuanTAlib.csproj
@@ -13,7 +13,7 @@
readme.md
net7.0;net6.0;net48;netcoreapp3.1;netstandard2.1
disable
- 10.0
+ preview
disable
true
en-US
diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj
index 5edf051d..ac4a1d2a 100644
--- a/Tests/Tests.csproj
+++ b/Tests/Tests.csproj
@@ -10,6 +10,22 @@
AnyCPU;x64
+
+ 1701;1702;MSB3270
+
+
+
+ 1701;1702;MSB3270
+
+
+
+ 1701;1702;MSB3270
+
+
+
+ 1701;1702;MSB3270
+
+
all
@@ -26,8 +42,8 @@
-
-
+
+