mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-25 22:08:05 +00:00
Refactor charts
This commit is contained in:
+51
-74
@@ -1,74 +1,51 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.2.32210.308
|
VisualStudioVersion = 17.2.32210.308
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "Tests\Tests.csproj", "{283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QuanTAlib", "Source\QuanTAlib.csproj", "{AAE21F8A-9BC2-4647-A9EB-4DC86C569080}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
EndProject
|
||||||
{5096AEA1-81BC-46E7-9F2B-B408AFAA850C} = {5096AEA1-81BC-46E7-9F2B-B408AFAA850C}
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Quantower", "Quantower\Quantower.csproj", "{5096AEA1-81BC-46E7-9F2B-B408AFAA850C}"
|
||||||
EndProjectSection
|
EndProject
|
||||||
EndProject
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "Tests\Tests.csproj", "{283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}"
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QuanTAlib", "Source\QuanTAlib.csproj", "{AAE21F8A-9BC2-4647-A9EB-4DC86C569080}"
|
EndProject
|
||||||
EndProject
|
Global
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{3AA87FFE-4EEE-4C1B-82E0-2A5E40E2254D}"
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
ProjectSection(SolutionItems) = preProject
|
Debug|Any CPU = Debug|Any CPU
|
||||||
Docs\bars_and_HMA.dib = Docs\bars_and_HMA.dib
|
Debug|x64 = Debug|x64
|
||||||
Docs\Comparing_w_TALIB.ipynb = Docs\Comparing_w_TALIB.ipynb
|
Release|Any CPU = Release|Any CPU
|
||||||
Docs\getting_started.ipynb = Docs\getting_started.ipynb
|
Release|x64 = Release|x64
|
||||||
Docs\Indicators.md = Docs\Indicators.md
|
EndGlobalSection
|
||||||
Docs\LICENSE = Docs\LICENSE
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
Docs\ma-comparison.dib = Docs\ma-comparison.dib
|
{AAE21F8A-9BC2-4647-A9EB-4DC86C569080}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
Docs\macd_example.ipynb = Docs\macd_example.ipynb
|
{AAE21F8A-9BC2-4647-A9EB-4DC86C569080}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
Docs\QuanTAlib_Indicators.dib = Docs\QuanTAlib_Indicators.dib
|
{AAE21F8A-9BC2-4647-A9EB-4DC86C569080}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
Docs\QuanTAlib_test.ipynb = Docs\QuanTAlib_test.ipynb
|
{AAE21F8A-9BC2-4647-A9EB-4DC86C569080}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
Docs\README.md = Docs\README.md
|
{AAE21F8A-9BC2-4647-A9EB-4DC86C569080}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
EndProjectSection
|
{AAE21F8A-9BC2-4647-A9EB-4DC86C569080}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndProject
|
{AAE21F8A-9BC2-4647-A9EB-4DC86C569080}.Release|x64.ActiveCfg = Release|x64
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Source", "Source", "{8D8CD223-7A8C-46C4-A326-58E0B735FBA4}"
|
{AAE21F8A-9BC2-4647-A9EB-4DC86C569080}.Release|x64.Build.0 = Release|x64
|
||||||
EndProject
|
{5096AEA1-81BC-46E7-9F2B-B408AFAA850C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Quantower", "Quantower\Quantower.csproj", "{5096AEA1-81BC-46E7-9F2B-B408AFAA850C}"
|
{5096AEA1-81BC-46E7-9F2B-B408AFAA850C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
EndProject
|
{5096AEA1-81BC-46E7-9F2B-B408AFAA850C}.Debug|x64.ActiveCfg = Release|Any CPU
|
||||||
Global
|
{5096AEA1-81BC-46E7-9F2B-B408AFAA850C}.Debug|x64.Build.0 = Release|Any CPU
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
{5096AEA1-81BC-46E7-9F2B-B408AFAA850C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
Debug|Any CPU = Debug|Any CPU
|
{5096AEA1-81BC-46E7-9F2B-B408AFAA850C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
Debug|x64 = Debug|x64
|
{5096AEA1-81BC-46E7-9F2B-B408AFAA850C}.Release|x64.ActiveCfg = Release|x64
|
||||||
Release|Any CPU = Release|Any CPU
|
{5096AEA1-81BC-46E7-9F2B-B408AFAA850C}.Release|x64.Build.0 = Release|x64
|
||||||
Release|x64 = Release|x64
|
{283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
EndGlobalSection
|
{283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
{283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Debug|Any CPU.ActiveCfg = Debug|x64
|
{283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Debug|x64.Build.0 = Debug|x64
|
||||||
{283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Debug|Any CPU.Build.0 = Debug|x64
|
{283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Debug|x64.ActiveCfg = Debug|x64
|
{283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Debug|x64.Build.0 = Debug|x64
|
{283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Release|x64.ActiveCfg = Release|x64
|
||||||
{283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Release|x64.Build.0 = Release|x64
|
||||||
{283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Release|Any CPU.Build.0 = Release|Any CPU
|
EndGlobalSection
|
||||||
{283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Release|x64.ActiveCfg = Release|x64
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
{283EACC9-3AF6-4DAE-9C1C-0F7F8C8CD70D}.Release|x64.Build.0 = Release|x64
|
HideSolutionNode = FALSE
|
||||||
{AAE21F8A-9BC2-4647-A9EB-4DC86C569080}.Debug|Any CPU.ActiveCfg = Release|Any CPU
|
EndGlobalSection
|
||||||
{AAE21F8A-9BC2-4647-A9EB-4DC86C569080}.Debug|Any CPU.Build.0 = Release|Any CPU
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
{AAE21F8A-9BC2-4647-A9EB-4DC86C569080}.Debug|x64.ActiveCfg = Debug|Any CPU
|
SolutionGuid = {E5592DC2-0542-45B2-A0CF-C6B1EDC72B87}
|
||||||
{AAE21F8A-9BC2-4647-A9EB-4DC86C569080}.Debug|x64.Build.0 = Debug|Any CPU
|
EndGlobalSection
|
||||||
{AAE21F8A-9BC2-4647-A9EB-4DC86C569080}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
EndGlobal
|
||||||
{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
|
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -38,8 +38,6 @@ public class BIAS_chart : Indicator
|
|||||||
new(source: bars.Select(this.DataSource), period: this.Period);
|
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)
|
protected override void OnUpdate(UpdateArgs args)
|
||||||
{
|
{
|
||||||
bool update = !(args.Reason == UpdateReason.NewBar ||
|
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.High), this.GetPrice(PriceType.Low),
|
||||||
this.GetPrice(PriceType.Close),
|
this.GetPrice(PriceType.Close),
|
||||||
this.GetPrice(PriceType.Volume), update);
|
this.GetPrice(PriceType.Volume), update);
|
||||||
this.OnNewData(update);
|
|
||||||
double result = this.indicator[this.indicator.Count - 1].v;
|
double result = this.indicator[this.indicator.Count - 1].v;
|
||||||
this.SetValue(result, 0);
|
this.SetValue(result, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ public class DEMA_chart : Indicator
|
|||||||
period: this.Period, useNaN: false);
|
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 ||
|
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.High), this.GetPrice(PriceType.Low),
|
||||||
this.GetPrice(PriceType.Close),
|
this.GetPrice(PriceType.Close),
|
||||||
this.GetPrice(PriceType.Volume), update);
|
this.GetPrice(PriceType.Volume), update);
|
||||||
this.OnNewData(update);
|
|
||||||
|
|
||||||
double result = this.indicator[this.indicator.Count - 1].v;
|
double result = this.indicator[this.indicator.Count - 1].v;
|
||||||
this.SetValue(result);
|
this.SetValue(result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ public class EMA_chart : Indicator
|
|||||||
period: this.Period, useNaN: false);
|
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 ||
|
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.High), this.GetPrice(PriceType.Low),
|
||||||
this.GetPrice(PriceType.Close),
|
this.GetPrice(PriceType.Close),
|
||||||
this.GetPrice(PriceType.Volume), update);
|
this.GetPrice(PriceType.Volume), update);
|
||||||
this.OnNewData(update);
|
|
||||||
|
|
||||||
double result = this.indicator[this.indicator.Count - 1].v;
|
double result = this.indicator[this.indicator.Count - 1].v;
|
||||||
this.SetValue(result);
|
this.SetValue(result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ public class ENTP_chart : Indicator
|
|||||||
period: this.Period, useNaN: true);
|
period: this.Period, useNaN: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 ||
|
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.High), this.GetPrice(PriceType.Low),
|
||||||
this.GetPrice(PriceType.Close),
|
this.GetPrice(PriceType.Close),
|
||||||
this.GetPrice(PriceType.Volume), update);
|
this.GetPrice(PriceType.Volume), update);
|
||||||
this.OnNewData(update);
|
|
||||||
|
|
||||||
double result = this.indicator[this.indicator.Count - 1].v;
|
double result = this.indicator[this.indicator.Count - 1].v;
|
||||||
|
|
||||||
this.SetValue(result, 0);
|
this.SetValue(result, 0);
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ public class HEMA_chart : Indicator
|
|||||||
period: this.Period, useNaN: false);
|
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 ||
|
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.High), this.GetPrice(PriceType.Low),
|
||||||
this.GetPrice(PriceType.Close),
|
this.GetPrice(PriceType.Close),
|
||||||
this.GetPrice(PriceType.Volume), update);
|
this.GetPrice(PriceType.Volume), update);
|
||||||
this.OnNewData(update);
|
|
||||||
|
|
||||||
double result = this.indicator[this.indicator.Count - 1].v;
|
double result = this.indicator[this.indicator.Count - 1].v;
|
||||||
this.SetValue(result);
|
this.SetValue(result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,56 +1,56 @@
|
|||||||
using System.Drawing;
|
using System.Diagnostics;
|
||||||
using TradingPlatform.BusinessLayer;
|
using System.Drawing;
|
||||||
namespace QuanTAlib;
|
using TradingPlatform.BusinessLayer;
|
||||||
|
namespace QuanTAlib;
|
||||||
public class HMA_chart : Indicator
|
|
||||||
{
|
public class HMA_chart : Indicator
|
||||||
#region Parameters
|
{
|
||||||
|
#region Parameters
|
||||||
[InputParameter("Smoothing period", 0, 1, 999, 1, 1)]
|
|
||||||
private int Period = 10;
|
[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,
|
[InputParameter("Data source", 1, variants: new object[]
|
||||||
"OHL3", 6, "HLC3", 7, "OHLC4", 8, "Weighted (HLCC4)", 9 })]
|
{ "Open", 0, "High", 1, "Low", 2, "Close", 3, "HL2", 4, "OC2", 5,
|
||||||
private int DataSource = 3;
|
"OHL3", 6, "HLC3", 7, "OHLC4", 8, "Weighted (HLCC4)", 9 })]
|
||||||
|
private int DataSource = 3;
|
||||||
#endregion Parameters
|
|
||||||
|
#endregion Parameters
|
||||||
private readonly TBars bars = new();
|
|
||||||
|
private readonly TBars bars = new();
|
||||||
///////
|
|
||||||
private HMA_Series indicator;
|
///////
|
||||||
///////
|
private HMA_Series indicator;
|
||||||
|
///////
|
||||||
public HMA_chart()
|
|
||||||
{
|
public HMA_chart()
|
||||||
this.SeparateWindow = false;
|
{
|
||||||
this.Name = "HMA - Hull Moving Average";
|
this.SeparateWindow = false;
|
||||||
this.Description = "Hull Moving Average description";
|
this.Name = "HMA - Hull Moving Average";
|
||||||
this.AddLineSeries("HMA", Color.RoyalBlue, 3, LineStyle.Solid);
|
this.Description = "Hull Moving Average description";
|
||||||
}
|
this.AddLineSeries("HMA", Color.RoyalBlue, 3, LineStyle.Solid);
|
||||||
|
}
|
||||||
protected override void OnInit()
|
|
||||||
{
|
protected override void OnInit()
|
||||||
this.ShortName =
|
{
|
||||||
"HMA (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
this.ShortName =
|
||||||
this.indicator = new(source: bars.Select(this.DataSource),
|
"HMA (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
||||||
period: this.Period, useNaN: false);
|
this.indicator = new(source: bars.Select(this.DataSource),
|
||||||
}
|
period: this.Period, useNaN: false);
|
||||||
|
Debug.WriteLine("Send to debug output.");
|
||||||
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 ||
|
Debug.WriteLine("Send to debug output.");
|
||||||
args.Reason == UpdateReason.HistoricalBar);
|
|
||||||
this.bars.Add(this.Time(), this.GetPrice(PriceType.Open),
|
bool update = !(args.Reason == UpdateReason.NewBar ||
|
||||||
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
|
args.Reason == UpdateReason.HistoricalBar);
|
||||||
this.GetPrice(PriceType.Close),
|
this.bars.Add(this.Time(), this.GetPrice(PriceType.Open),
|
||||||
this.GetPrice(PriceType.Volume), update);
|
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
|
||||||
this.OnNewData(update);
|
this.GetPrice(PriceType.Close),
|
||||||
|
this.GetPrice(PriceType.Volume), update);
|
||||||
double result = this.indicator[this.indicator.Count - 1].v;
|
double result = this.indicator[this.indicator.Count - 1].v;
|
||||||
this.SetValue(result);
|
this.SetValue(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,9 +37,6 @@ public class JMA_chart : Indicator
|
|||||||
this.indicator = new(source: bars.Select(this.DataSource),
|
this.indicator = new(source: bars.Select(this.DataSource),
|
||||||
period: this.Period, useNaN: false);
|
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 ||
|
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.High), this.GetPrice(PriceType.Low),
|
||||||
this.GetPrice(PriceType.Close),
|
this.GetPrice(PriceType.Close),
|
||||||
this.GetPrice(PriceType.Volume), update);
|
this.GetPrice(PriceType.Volume), update);
|
||||||
this.OnNewData(update);
|
|
||||||
|
|
||||||
double result = this.indicator[this.indicator.Count - 1].v;
|
double result = this.indicator[this.indicator.Count - 1].v;
|
||||||
this.SetValue(result);
|
this.SetValue(result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ public class KURT_chart : Indicator
|
|||||||
period: this.Period, useNaN: true);
|
period: this.Period, useNaN: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 ||
|
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.High), this.GetPrice(PriceType.Low),
|
||||||
this.GetPrice(PriceType.Close),
|
this.GetPrice(PriceType.Close),
|
||||||
this.GetPrice(PriceType.Volume), update);
|
this.GetPrice(PriceType.Volume), update);
|
||||||
this.OnNewData(update);
|
|
||||||
double result = this.indicator[this.indicator.Count - 1].v;
|
double result = this.indicator[this.indicator.Count - 1].v;
|
||||||
this.SetValue(result, 0);
|
this.SetValue(result, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ public class MAD_chart : Indicator
|
|||||||
period: this.Period, useNaN: true);
|
period: this.Period, useNaN: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 ||
|
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.High), this.GetPrice(PriceType.Low),
|
||||||
this.GetPrice(PriceType.Close),
|
this.GetPrice(PriceType.Close),
|
||||||
this.GetPrice(PriceType.Volume), update);
|
this.GetPrice(PriceType.Volume), update);
|
||||||
this.OnNewData(update);
|
|
||||||
|
|
||||||
double result = this.indicator[this.indicator.Count - 1].v;
|
double result = this.indicator[this.indicator.Count - 1].v;
|
||||||
|
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ public class MAPE_chart : Indicator
|
|||||||
period: this.Period, useNaN: true);
|
period: this.Period, useNaN: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 ||
|
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.High), this.GetPrice(PriceType.Low),
|
||||||
this.GetPrice(PriceType.Close),
|
this.GetPrice(PriceType.Close),
|
||||||
this.GetPrice(PriceType.Volume), update);
|
this.GetPrice(PriceType.Volume), update);
|
||||||
this.OnNewData(update);
|
|
||||||
|
|
||||||
double result = this.indicator[this.indicator.Count - 1].v;
|
double result = this.indicator[this.indicator.Count - 1].v;
|
||||||
|
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ public class MAX_chart : Indicator
|
|||||||
new(source: bars.Select(this.DataSource), period: this.Period);
|
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)
|
protected override void OnUpdate(UpdateArgs args)
|
||||||
{
|
{
|
||||||
bool update = !(args.Reason == UpdateReason.NewBar ||
|
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.High), this.GetPrice(PriceType.Low),
|
||||||
this.GetPrice(PriceType.Close),
|
this.GetPrice(PriceType.Close),
|
||||||
this.GetPrice(PriceType.Volume), update);
|
this.GetPrice(PriceType.Volume), update);
|
||||||
this.OnNewData(update);
|
|
||||||
|
|
||||||
double result = this.indicator[this.indicator.Count - 1].v;
|
double result = this.indicator[this.indicator.Count - 1].v;
|
||||||
|
|
||||||
this.SetValue(result, 0);
|
this.SetValue(result, 0);
|
||||||
|
|||||||
@@ -37,8 +37,6 @@ public class MED_chart : Indicator
|
|||||||
this.indicator =
|
this.indicator =
|
||||||
new(source: bars.Select(this.DataSource), period: this.Period);
|
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)
|
protected override void OnUpdate(UpdateArgs args)
|
||||||
{
|
{
|
||||||
bool update = !(args.Reason == UpdateReason.NewBar ||
|
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.High), this.GetPrice(PriceType.Low),
|
||||||
this.GetPrice(PriceType.Close),
|
this.GetPrice(PriceType.Close),
|
||||||
this.GetPrice(PriceType.Volume), update);
|
this.GetPrice(PriceType.Volume), update);
|
||||||
this.OnNewData(update);
|
|
||||||
double result = this.indicator[this.indicator.Count - 1].v;
|
double result = this.indicator[this.indicator.Count - 1].v;
|
||||||
this.SetValue(result, 0);
|
this.SetValue(result, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ public class MIN_chart : Indicator
|
|||||||
new(source: bars.Select(this.DataSource), period: this.Period);
|
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)
|
protected override void OnUpdate(UpdateArgs args)
|
||||||
{
|
{
|
||||||
bool update = !(args.Reason == UpdateReason.NewBar ||
|
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.High), this.GetPrice(PriceType.Low),
|
||||||
this.GetPrice(PriceType.Close),
|
this.GetPrice(PriceType.Close),
|
||||||
this.GetPrice(PriceType.Volume), update);
|
this.GetPrice(PriceType.Volume), update);
|
||||||
this.OnNewData(update);
|
|
||||||
|
|
||||||
double result = this.indicator[this.indicator.Count - 1].v;
|
double result = this.indicator[this.indicator.Count - 1].v;
|
||||||
|
|
||||||
this.SetValue(result, 0);
|
this.SetValue(result, 0);
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ public class MSE_chart : Indicator
|
|||||||
period: this.Period, useNaN: true);
|
period: this.Period, useNaN: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 ||
|
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.High), this.GetPrice(PriceType.Low),
|
||||||
this.GetPrice(PriceType.Close),
|
this.GetPrice(PriceType.Close),
|
||||||
this.GetPrice(PriceType.Volume), update);
|
this.GetPrice(PriceType.Volume), update);
|
||||||
this.OnNewData(update);
|
|
||||||
|
|
||||||
double result = this.indicator[this.indicator.Count - 1].v;
|
double result = this.indicator[this.indicator.Count - 1].v;
|
||||||
|
|
||||||
|
|||||||
@@ -37,9 +37,6 @@ public class PSDEV_chart : Indicator
|
|||||||
this.indicator = new(source: bars.Select(this.DataSource),
|
this.indicator = new(source: bars.Select(this.DataSource),
|
||||||
period: this.Period, useNaN: true);
|
period: this.Period, useNaN: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 ||
|
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.High), this.GetPrice(PriceType.Low),
|
||||||
this.GetPrice(PriceType.Close),
|
this.GetPrice(PriceType.Close),
|
||||||
this.GetPrice(PriceType.Volume), update);
|
this.GetPrice(PriceType.Volume), update);
|
||||||
this.OnNewData(update);
|
|
||||||
|
|
||||||
double result = this.indicator[this.indicator.Count - 1].v;
|
double result = this.indicator[this.indicator.Count - 1].v;
|
||||||
|
|
||||||
this.SetValue(result, 0);
|
this.SetValue(result, 0);
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ public class PVAR_chart : Indicator
|
|||||||
period: this.Period, useNaN: true);
|
period: this.Period, useNaN: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 ||
|
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.High), this.GetPrice(PriceType.Low),
|
||||||
this.GetPrice(PriceType.Close),
|
this.GetPrice(PriceType.Close),
|
||||||
this.GetPrice(PriceType.Volume), update);
|
this.GetPrice(PriceType.Volume), update);
|
||||||
this.OnNewData(update);
|
|
||||||
|
|
||||||
double result = this.indicator[this.indicator.Count - 1].v;
|
double result = this.indicator[this.indicator.Count - 1].v;
|
||||||
|
|
||||||
this.SetValue(result, 0);
|
this.SetValue(result, 0);
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ public class RMA_chart : Indicator
|
|||||||
period: this.Period, useNaN: false);
|
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 ||
|
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.High), this.GetPrice(PriceType.Low),
|
||||||
this.GetPrice(PriceType.Close),
|
this.GetPrice(PriceType.Close),
|
||||||
this.GetPrice(PriceType.Volume), update);
|
this.GetPrice(PriceType.Volume), update);
|
||||||
this.OnNewData(update);
|
|
||||||
|
|
||||||
double result = this.indicator[this.indicator.Count - 1].v;
|
double result = this.indicator[this.indicator.Count - 1].v;
|
||||||
this.SetValue(result);
|
this.SetValue(result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,9 +37,6 @@ public class SDEV_chart : Indicator
|
|||||||
this.indicator = new(source: bars.Select(this.DataSource),
|
this.indicator = new(source: bars.Select(this.DataSource),
|
||||||
period: this.Period, useNaN: true);
|
period: this.Period, useNaN: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 ||
|
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.High), this.GetPrice(PriceType.Low),
|
||||||
this.GetPrice(PriceType.Close),
|
this.GetPrice(PriceType.Close),
|
||||||
this.GetPrice(PriceType.Volume), update);
|
this.GetPrice(PriceType.Volume), update);
|
||||||
this.OnNewData(update);
|
|
||||||
|
|
||||||
double result = this.indicator[this.indicator.Count - 1].v;
|
double result = this.indicator[this.indicator.Count - 1].v;
|
||||||
|
|
||||||
this.SetValue(result, 0);
|
this.SetValue(result, 0);
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ public class SMAPE_chart : Indicator
|
|||||||
period: this.Period, useNaN: true);
|
period: this.Period, useNaN: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 ||
|
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.High), this.GetPrice(PriceType.Low),
|
||||||
this.GetPrice(PriceType.Close),
|
this.GetPrice(PriceType.Close),
|
||||||
this.GetPrice(PriceType.Volume), update);
|
this.GetPrice(PriceType.Volume), update);
|
||||||
this.OnNewData(update);
|
|
||||||
|
|
||||||
double result = this.indicator[this.indicator.Count - 1].v;
|
double result = this.indicator[this.indicator.Count - 1].v;
|
||||||
|
|
||||||
this.SetValue(result, 0);
|
this.SetValue(result, 0);
|
||||||
|
|||||||
@@ -7,12 +7,12 @@ public class SMA_chart : Indicator
|
|||||||
#region Parameters
|
#region Parameters
|
||||||
|
|
||||||
[InputParameter("Smoothing period", 0, 1, 999, 1, 1)]
|
[InputParameter("Smoothing period", 0, 1, 999, 1, 1)]
|
||||||
private int Period = 10;
|
private readonly int Period = 10;
|
||||||
|
|
||||||
[InputParameter("Data source", 1, variants: new object[]
|
[InputParameter("Data source", 1, variants: new object[]
|
||||||
{ "Open", 0, "High", 1, "Low", 2, "Close", 3, "HL2", 4, "OC2", 5,
|
{ "Open", 0, "High", 1, "Low", 2, "Close", 3, "HL2", 4, "OC2", 5,
|
||||||
"OHL3", 6, "HLC3", 7, "OHLC4", 8, "Weighted (HLCC4)", 9 })]
|
"OHL3", 6, "HLC3", 7, "OHLC4", 8, "Weighted (HLCC4)", 9 })]
|
||||||
private int DataSource = 3;
|
private readonly int DataSource = 3;
|
||||||
|
|
||||||
#endregion Parameters
|
#endregion Parameters
|
||||||
|
|
||||||
@@ -36,11 +36,9 @@ public class SMA_chart : Indicator
|
|||||||
"SMA (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
"SMA (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
||||||
this.indicator = new(source: bars.Select(this.DataSource),
|
this.indicator = new(source: bars.Select(this.DataSource),
|
||||||
period: this.Period, useNaN: false);
|
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 ||
|
bool update = !(args.Reason == UpdateReason.NewBar ||
|
||||||
args.Reason == UpdateReason.HistoricalBar);
|
args.Reason == UpdateReason.HistoricalBar);
|
||||||
@@ -48,8 +46,6 @@ public class SMA_chart : Indicator
|
|||||||
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
|
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
|
||||||
this.GetPrice(PriceType.Close),
|
this.GetPrice(PriceType.Close),
|
||||||
this.GetPrice(PriceType.Volume), update);
|
this.GetPrice(PriceType.Volume), update);
|
||||||
this.OnNewData(update);
|
|
||||||
|
|
||||||
double result = this.indicator[this.indicator.Count - 1].v;
|
double result = this.indicator[this.indicator.Count - 1].v;
|
||||||
this.SetValue(result);
|
this.SetValue(result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ public class TEMA_chart : Indicator
|
|||||||
period: this.Period, useNaN: false);
|
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 ||
|
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.High), this.GetPrice(PriceType.Low),
|
||||||
this.GetPrice(PriceType.Close),
|
this.GetPrice(PriceType.Close),
|
||||||
this.GetPrice(PriceType.Volume), update);
|
this.GetPrice(PriceType.Volume), update);
|
||||||
this.OnNewData(update);
|
|
||||||
|
|
||||||
double result = this.indicator[this.indicator.Count - 1].v;
|
double result = this.indicator[this.indicator.Count - 1].v;
|
||||||
this.SetValue(result);
|
this.SetValue(result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,9 +37,7 @@ public class VAR_chart : Indicator
|
|||||||
this.indicator = new(source: bars.Select(this.DataSource),
|
this.indicator = new(source: bars.Select(this.DataSource),
|
||||||
period: this.Period, useNaN: true);
|
period: this.Period, useNaN: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 ||
|
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.High), this.GetPrice(PriceType.Low),
|
||||||
this.GetPrice(PriceType.Close),
|
this.GetPrice(PriceType.Close),
|
||||||
this.GetPrice(PriceType.Volume), update);
|
this.GetPrice(PriceType.Volume), update);
|
||||||
this.OnNewData(update);
|
|
||||||
|
|
||||||
double result = this.indicator[this.indicator.Count - 1].v;
|
double result = this.indicator[this.indicator.Count - 1].v;
|
||||||
|
|
||||||
this.SetValue(result, 0);
|
this.SetValue(result, 0);
|
||||||
|
|||||||
@@ -44,15 +44,10 @@ public class WMAPE_chart : Indicator
|
|||||||
this.ShortName = "WMAPE (" + QuanTAlib.TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
this.ShortName = "WMAPE (" + QuanTAlib.TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
||||||
this.indicator = new(source: this.bars.Select(this.DataSource), period: this.Period, useNaN: true);
|
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)
|
protected override void OnUpdate(UpdateArgs args)
|
||||||
{
|
{
|
||||||
bool update = !(args.Reason == UpdateReason.NewBar || args.Reason == UpdateReason.HistoricalBar);
|
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.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;
|
double result = this.indicator[this.indicator.Count - 1].v;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -37,9 +37,6 @@ public class WMA_chart : Indicator
|
|||||||
this.indicator = new(source: bars.Select(this.DataSource),
|
this.indicator = new(source: bars.Select(this.DataSource),
|
||||||
period: this.Period, useNaN: false);
|
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 ||
|
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.High), this.GetPrice(PriceType.Low),
|
||||||
this.GetPrice(PriceType.Close),
|
this.GetPrice(PriceType.Close),
|
||||||
this.GetPrice(PriceType.Volume), update);
|
this.GetPrice(PriceType.Volume), update);
|
||||||
this.OnNewData(update);
|
|
||||||
|
|
||||||
double result = this.indicator[this.indicator.Count - 1].v;
|
double result = this.indicator[this.indicator.Count - 1].v;
|
||||||
this.SetValue(result);
|
this.SetValue(result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,10 +37,7 @@ public class ZLEMA_chart : Indicator
|
|||||||
this.indicator = new(source: bars.Select(this.DataSource),
|
this.indicator = new(source: bars.Select(this.DataSource),
|
||||||
period: this.Period, useNaN: false);
|
period: this.Period, useNaN: false);
|
||||||
}
|
}
|
||||||
|
protected override void OnUpdate(UpdateArgs args)
|
||||||
protected void OnNewData(bool update = false) { this.indicator.Add(update); }
|
|
||||||
|
|
||||||
protected override void OnUpdate(UpdateArgs args)
|
|
||||||
{
|
{
|
||||||
bool update = !(args.Reason == UpdateReason.NewBar ||
|
bool update = !(args.Reason == UpdateReason.NewBar ||
|
||||||
args.Reason == UpdateReason.HistoricalBar);
|
args.Reason == UpdateReason.HistoricalBar);
|
||||||
@@ -48,7 +45,6 @@ public class ZLEMA_chart : Indicator
|
|||||||
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
|
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
|
||||||
this.GetPrice(PriceType.Close),
|
this.GetPrice(PriceType.Close),
|
||||||
this.GetPrice(PriceType.Volume), update);
|
this.GetPrice(PriceType.Volume), update);
|
||||||
this.OnNewData(update);
|
|
||||||
|
|
||||||
double result = this.indicator[this.indicator.Count - 1].v;
|
double result = this.indicator[this.indicator.Count - 1].v;
|
||||||
this.SetValue(result);
|
this.SetValue(result);
|
||||||
|
|||||||
@@ -8,15 +8,33 @@
|
|||||||
<AlgoType>Indicator</AlgoType>
|
<AlgoType>Indicator</AlgoType>
|
||||||
<AssemblyName>Quantower_QTAlib</AssemblyName>
|
<AssemblyName>Quantower_QTAlib</AssemblyName>
|
||||||
<RootNamespace>QuanTAlib</RootNamespace>
|
<RootNamespace>QuanTAlib</RootNamespace>
|
||||||
<Configurations>Release</Configurations>
|
<DebugType>embedded</DebugType>
|
||||||
<BaseOutputPath>bin\</BaseOutputPath>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
|
<Nullable>disable</Nullable>
|
||||||
|
<SignAssembly>False</SignAssembly>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
<Optimize>True</Optimize>
|
||||||
|
<WarningLevel>3</WarningLevel>
|
||||||
|
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
|
||||||
|
<PlatformTarget>anycpu</PlatformTarget>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||||
|
<DebugType>embedded</DebugType>
|
||||||
|
<Optimize>True</Optimize>
|
||||||
|
<WarningLevel>3</WarningLevel>
|
||||||
|
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
|
||||||
|
<PlatformTarget>anycpu</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="..\Source\**\*.cs" Exclude="..\Source\obj\**"/>
|
<Compile Include="..\Source\**\*.cs" Exclude="..\Source\obj\**" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="CopyCustomContent" AfterTargets="AfterBuild" >
|
<Target Name="CopyCustomContent" AfterTargets="AfterBuild">
|
||||||
<Copy SourceFiles=".\bin\$(Configuration)\net48\Quantower_QTAlib.dll" DestinationFolder="\Quantower\Settings\Scripts\Indicators\QuanTAlib" />
|
<Copy SourceFiles=".\bin\$(Configuration)\net48\Quantower_QTAlib.dll" DestinationFolder="\Quantower\Settings\Scripts\Indicators\QuanTAlib" />
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
|
|||||||
+34
-34
@@ -1,35 +1,35 @@
|
|||||||
namespace QuanTAlib;
|
namespace QuanTAlib;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
/* <summary>
|
/* <summary>
|
||||||
ZL: Zero Lag
|
ZL: Zero Lag
|
||||||
Data is de-lagged by removing the data from “lag” days ago, thus removing
|
Data is de-lagged by removing the data from “lag” days ago, thus removing
|
||||||
(or attempting to) the cumulative effect of the moving average.
|
(or attempting to) the cumulative effect of the moving average.
|
||||||
|
|
||||||
Calculation:
|
Calculation:
|
||||||
Lag = (Period-1)/2
|
Lag = (Period-1)/2
|
||||||
ZL = Data + (Data - Data(Lag days ago) )
|
ZL = Data + (Data - Data(Lag days ago) )
|
||||||
|
|
||||||
Sources:
|
Sources:
|
||||||
https://mudrex.com/blog/zero-lag-ema-trading-strategy/
|
https://mudrex.com/blog/zero-lag-ema-trading-strategy/
|
||||||
|
|
||||||
</summary> */
|
</summary> */
|
||||||
|
|
||||||
public class ZL_Series : Single_TSeries_Indicator
|
public class ZL_Series : Single_TSeries_Indicator
|
||||||
{
|
{
|
||||||
public ZL_Series(TSeries source, int period, bool useNaN = false) : base(source, period:period, useNaN:useNaN) {
|
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); }
|
if (this._data.Count > 0) { base.Add(this._data); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Add((DateTime t, double v) TValue, bool update)
|
public override void Add((DateTime t, double v) TValue, bool update)
|
||||||
{
|
{
|
||||||
int _lag = (int)((_p-1) * 0.5);
|
int _lag = (int)((_p-1) * 0.5);
|
||||||
_lag = (_data.Count-_lag < 0) ? 0 : _data.Count-_lag;
|
_lag = (_data.Count-_lag < 0) ? 0 : _data.Count-_lag;
|
||||||
|
|
||||||
double _zl = TValue.v + (TValue.v - _data[_lag].v);
|
double _zl = TValue.v + (TValue.v - _data[_lag].v);
|
||||||
|
|
||||||
var ret = (TValue.t, (base.Count==0 && base._NaN) ? double.NaN : _zl );
|
var ret = (TValue.t, (base.Count==0 && base._NaN) ? double.NaN : _zl );
|
||||||
base.Add(ret, update);
|
base.Add(ret, update);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
<PackageReadmeFile>readme.md</PackageReadmeFile>
|
<PackageReadmeFile>readme.md</PackageReadmeFile>
|
||||||
<TargetFrameworks>net7.0;net6.0;net48;netcoreapp3.1;netstandard2.1</TargetFrameworks>
|
<TargetFrameworks>net7.0;net6.0;net48;netcoreapp3.1;netstandard2.1</TargetFrameworks>
|
||||||
<ImplicitUsings>disable</ImplicitUsings>
|
<ImplicitUsings>disable</ImplicitUsings>
|
||||||
<LangVersion>10.0</LangVersion>
|
<LangVersion>preview</LangVersion>
|
||||||
<Nullable>disable</Nullable>
|
<Nullable>disable</Nullable>
|
||||||
<DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>
|
<DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>
|
||||||
<NeutralLanguage>en-US</NeutralLanguage>
|
<NeutralLanguage>en-US</NeutralLanguage>
|
||||||
|
|||||||
+18
-2
@@ -10,6 +10,22 @@
|
|||||||
<Platforms>AnyCPU;x64</Platforms>
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
<NoWarn>1701;1702;MSB3270</NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||||
|
<NoWarn>1701;1702;MSB3270</NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<NoWarn>1701;1702;MSB3270</NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<NoWarn>1701;1702;MSB3270</NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="JetBrains.dotCover.CommandLineTools" Version="2022.1.0-eap10">
|
<PackageReference Include="JetBrains.dotCover.CommandLineTools" Version="2022.1.0-eap10">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
@@ -26,8 +42,8 @@
|
|||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Source\QuanTAlib.csproj" />
|
<ProjectReference Include="..\Source\QuanTAlib.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Reference in New Issue
Block a user