mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-23 13:08:04 +00:00
Reworked KAMA & Charts
This commit is contained in:
@@ -1,73 +0,0 @@
|
|||||||
name: Build
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: windows-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Install .NET 7.0
|
|
||||||
uses: actions/setup-dotnet@v1
|
|
||||||
with:
|
|
||||||
dotnet-version: |
|
|
||||||
7.0.x
|
|
||||||
5.0.x
|
|
||||||
include-prerelease: true
|
|
||||||
|
|
||||||
- name: Install JDK11 for Sonar Scanner
|
|
||||||
uses: actions/setup-java@v1
|
|
||||||
with:
|
|
||||||
java-version: 1.11
|
|
||||||
|
|
||||||
- name: Install JetBrains
|
|
||||||
run: dotnet tool install JetBrains.dotCover.GlobalTool --global
|
|
||||||
- name: Install Sonar Scanner
|
|
||||||
run: dotnet tool install dotnet-sonarscanner --global
|
|
||||||
- name: Install dotnet-coverage
|
|
||||||
run: dotnet tool install dotnet-coverage --global
|
|
||||||
- name: Install CodeCov
|
|
||||||
run: dotnet tool install --global Codecov.Tool
|
|
||||||
|
|
||||||
- name: Sonar start
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
||||||
#run: dotnet sonarscanner begin /o:"mihakralj" /k:"mihakralj_QuanTAlib" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths="./coverage.xml"
|
|
||||||
run: dotnet sonarscanner begin /o:"mihakralj" /k:"mihakralj_QuanTAlib"
|
|
||||||
/d:sonar.login="${{ secrets.SONAR_TOKEN }}"
|
|
||||||
/d:sonar.host.url="https://sonarcloud.io"
|
|
||||||
/d:sonar.cs.dotcover.reportsPaths=./coveragereport.html
|
|
||||||
|
|
||||||
- name: Build Core DLL
|
|
||||||
run: dotnet build ./Source/QuanTAlib.csproj --verbosity normal --configuration Release --nologo
|
|
||||||
- name: Build Quantower DLL
|
|
||||||
run: dotnet build ./Quantower/Quantower.csproj --verbosity normal --configuration Release --nologo
|
|
||||||
|
|
||||||
- name: dotnet Test
|
|
||||||
run: dotnet test ./Tests/Tests.csproj --verbosity normal --configuration Release --nologo
|
|
||||||
- name: DotCover Test XML
|
|
||||||
run: dotnet dotcover test ./Tests/Tests.csproj --verbosity normal --framework net7.0 --dcReportType=DetailedXML --dcoutput=./coveragereport.xml
|
|
||||||
- name: DotCover Test HTML
|
|
||||||
run: dotnet dotcover test ./Tests/Tests.csproj --verbosity normal --framework net7.0 --dcReportType=HTML --dcoutput=./coveragereport.html
|
|
||||||
# - name: dotnet-coverage
|
|
||||||
# run: dotnet-coverage collect 'dotnet test' -f xml -o './coverage.xml'
|
|
||||||
|
|
||||||
- name: Sonar reporter
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
||||||
run: dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
|
|
||||||
|
|
||||||
- name: CodeCov run
|
|
||||||
run: codecov -f ./coveragereport.xml -v -t ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
|
|
||||||
- name: Codacy coverage reporter
|
|
||||||
uses: codacy/codacy-coverage-reporter-action@v1
|
|
||||||
with:
|
|
||||||
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
|
||||||
coverage-reports: ./coveragereport.xml
|
|
||||||
@@ -114,7 +114,7 @@ jobs:
|
|||||||
run: dotnet nuget push '.\Source\bin\Release\QuanTAlib.*.nupkg'
|
run: dotnet nuget push '.\Source\bin\Release\QuanTAlib.*.nupkg'
|
||||||
--api-key ${{ secrets.GITHUB_TOKEN }}
|
--api-key ${{ secrets.GITHUB_TOKEN }}
|
||||||
--source https://nuget.pkg.github.com/mihakralj/index.json
|
--source https://nuget.pkg.github.com/mihakralj/index.json
|
||||||
--skip-duplicate
|
# --skip-duplicate
|
||||||
|
|
||||||
- name: Push package to nuget.org
|
- name: Push package to nuget.org
|
||||||
run: dotnet nuget push '.\Source\bin\Release\QuanTAlib.*.nupkg'
|
run: dotnet nuget push '.\Source\bin\Release\QuanTAlib.*.nupkg'
|
||||||
@@ -123,74 +123,7 @@ jobs:
|
|||||||
--skip-duplicate
|
--skip-duplicate
|
||||||
|
|
||||||
|
|
||||||
# build:
|
|
||||||
# runs-on: windows-latest
|
|
||||||
# steps:
|
|
||||||
# - name: Checkout
|
|
||||||
# uses: actions/checkout@v2
|
|
||||||
# with:
|
|
||||||
# fetch-depth: 0
|
|
||||||
|
|
||||||
# - name: Install .NET 7.0
|
|
||||||
# uses: actions/setup-dotnet@v1
|
|
||||||
# with:
|
|
||||||
# dotnet-version: |
|
|
||||||
# 7.0.x
|
|
||||||
# 5.0.x
|
|
||||||
# include-prerelease: true
|
|
||||||
|
|
||||||
# - name: Install JDK11 for Sonar Scanner
|
|
||||||
# uses: actions/setup-java@v1
|
|
||||||
# with:
|
|
||||||
# java-version: 1.11
|
|
||||||
|
|
||||||
# - name: Install JetBrains
|
|
||||||
# run: dotnet tool install JetBrains.dotCover.GlobalTool --global
|
|
||||||
# - name: Install Sonar Scanner
|
|
||||||
# run: dotnet tool install dotnet-sonarscanner --global
|
|
||||||
# - name: Install dotnet-coverage
|
|
||||||
# run: dotnet tool install dotnet-coverage --global
|
|
||||||
# - name: Install CodeCov
|
|
||||||
# run: dotnet tool install --global Codecov.Tool
|
|
||||||
|
|
||||||
# - name: Sonar start
|
|
||||||
# env:
|
|
||||||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
||||||
# #run: dotnet sonarscanner begin /o:"mihakralj" /k:"mihakralj_QuanTAlib" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths="./coverage.xml"
|
|
||||||
# run: dotnet sonarscanner begin /o:"mihakralj" /k:"mihakralj_QuanTAlib"
|
|
||||||
# /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
|
|
||||||
# /d:sonar.host.url="https://sonarcloud.io"
|
|
||||||
# /d:sonar.cs.dotcover.reportsPaths=./coveragereport.html
|
|
||||||
|
|
||||||
# - name: Build Core DLL
|
|
||||||
# run: dotnet build ./Source/QuanTAlib.csproj --verbosity normal --configuration Release --nologo
|
|
||||||
# - name: Build Quantower DLL
|
|
||||||
# run: dotnet build ./Quantower/Quantower.csproj --verbosity normal --configuration Release --nologo
|
|
||||||
|
|
||||||
# - name: dotnet Test
|
|
||||||
# run: dotnet test ./Tests/Tests.csproj --verbosity normal --configuration Release --nologo
|
|
||||||
# - name: DotCover Test XML
|
|
||||||
# run: dotnet dotcover test ./Tests/Tests.csproj --verbosity normal --framework net7.0 --dcReportType=DetailedXML --dcoutput=./coveragereport.xml
|
|
||||||
# - name: DotCover Test HTML
|
|
||||||
# run: dotnet dotcover test ./Tests/Tests.csproj --verbosity normal --framework net7.0 --dcReportType=HTML --dcoutput=./coveragereport.html
|
|
||||||
# # - name: dotnet-coverage
|
|
||||||
# # run: dotnet-coverage collect 'dotnet test' -f xml -o './coverage.xml'
|
|
||||||
|
|
||||||
# - name: Sonar reporter
|
|
||||||
# env:
|
|
||||||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
||||||
# run: dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
|
|
||||||
|
|
||||||
# - name: CodeCov run
|
|
||||||
# run: codecov -f ./coveragereport.xml -v -t ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
|
|
||||||
# - name: Codacy coverage reporter
|
|
||||||
# uses: codacy/codacy-coverage-reporter-action@v1
|
|
||||||
# with:
|
|
||||||
# project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
|
||||||
# coverage-reports: ./coveragereport.xml
|
|
||||||
|
|
||||||
# - name: Zip DLLs
|
# - name: Zip DLLs
|
||||||
# uses: thedoctor0/zip-release@master
|
# uses: thedoctor0/zip-release@master
|
||||||
|
|||||||
@@ -1,54 +0,0 @@
|
|||||||
name: Publish
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
publish:
|
|
||||||
runs-on: windows-latest
|
|
||||||
needs: build
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Install .NET 7.0
|
|
||||||
uses: actions/setup-dotnet@v1
|
|
||||||
with:
|
|
||||||
dotnet-version: |
|
|
||||||
7.0.x
|
|
||||||
5.0.x
|
|
||||||
include-prerelease: true
|
|
||||||
|
|
||||||
- name: Build Core DLL
|
|
||||||
run: dotnet build ./Source/QuanTAlib.csproj --verbosity normal --configuration Release --nologo
|
|
||||||
- name: Build Quantower DLL
|
|
||||||
run: dotnet build ./Quantower/Quantower.csproj --verbosity normal --configuration Release --nologo
|
|
||||||
|
|
||||||
- name: Zip DLLs
|
|
||||||
uses: thedoctor0/zip-release@master
|
|
||||||
with:
|
|
||||||
type: 'zip'
|
|
||||||
directory: \Quantower\Settings\Scripts\Indicators\QuanTAlib
|
|
||||||
filename: QL_Quantower.zip
|
|
||||||
|
|
||||||
- name: Release
|
|
||||||
uses: marvinpinto/action-automatic-releases@latest
|
|
||||||
with:
|
|
||||||
repo_token: "${{ secrets.GITHUB_TOKEN }}"
|
|
||||||
automatic_release_tag: "latest"
|
|
||||||
prerelease: true
|
|
||||||
title: "Pre-release Build"
|
|
||||||
files: /Quantower/Settings/Scripts/Indicators/QuanTAlib/*.zip
|
|
||||||
|
|
||||||
- name: Push package to nuget.org
|
|
||||||
run: dotnet nuget push '.\Source\bin\Release\QuanTAlib.*.nupkg'
|
|
||||||
--api-key ${{ secrets.NUGET_DEPLOY_KEY_QUANTLIB }}
|
|
||||||
--source https://api.nuget.org/v3/index.json
|
|
||||||
--skip-duplicate
|
|
||||||
|
|
||||||
- name: Push package to github
|
|
||||||
run: dotnet nuget push '.\Source\bin\Release\QuanTAlib.*.nupkg'
|
|
||||||
--api-key ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
--source https://nuget.pkg.github.com/mihakralj/index.json
|
|
||||||
--skip-duplicate
|
|
||||||
@@ -11,7 +11,7 @@ public class ATR_chart : Indicator
|
|||||||
|
|
||||||
#endregion Parameters
|
#endregion Parameters
|
||||||
|
|
||||||
private readonly TBars bars = new();
|
private TBars bars;
|
||||||
|
|
||||||
///////
|
///////
|
||||||
private ATR_Series indicator;
|
private ATR_Series indicator;
|
||||||
@@ -27,9 +27,9 @@ public class ATR_chart : Indicator
|
|||||||
|
|
||||||
protected override void OnInit()
|
protected override void OnInit()
|
||||||
{
|
{
|
||||||
this.ShortName =
|
this.ShortName = "ATR (" + this.Period + ")";
|
||||||
"ATR (" + this.Period + ")";
|
this.bars = new();
|
||||||
this.indicator = new(source: bars, period: this.Period, useNaN: false);
|
this.indicator = new(source: bars, period: this.Period, useNaN: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnUpdate(UpdateArgs args)
|
protected override void OnUpdate(UpdateArgs args)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class BIAS_chart : Indicator
|
|||||||
|
|
||||||
#endregion Parameters
|
#endregion Parameters
|
||||||
|
|
||||||
private readonly TBars bars = new();
|
private TBars bars;
|
||||||
|
|
||||||
///////
|
///////
|
||||||
private BIAS_Series indicator;
|
private BIAS_Series indicator;
|
||||||
@@ -32,10 +32,9 @@ public class BIAS_chart : Indicator
|
|||||||
|
|
||||||
protected override void OnInit()
|
protected override void OnInit()
|
||||||
{
|
{
|
||||||
this.ShortName =
|
this.ShortName = "BIAS (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
||||||
"BIAS (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
this.bars = new();
|
||||||
this.indicator =
|
this.indicator = new(source: bars.Select(this.DataSource), period: this.Period);
|
||||||
new(source: bars.Select(this.DataSource), period: this.Period);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnUpdate(UpdateArgs args)
|
protected override void OnUpdate(UpdateArgs args)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class DEMA_chart : Indicator
|
|||||||
|
|
||||||
#endregion Parameters
|
#endregion Parameters
|
||||||
|
|
||||||
private readonly TBars bars = new();
|
private TBars bars ;
|
||||||
|
|
||||||
///////
|
///////
|
||||||
private DEMA_Series indicator;
|
private DEMA_Series indicator;
|
||||||
@@ -34,7 +34,8 @@ public class DEMA_chart : Indicator
|
|||||||
{
|
{
|
||||||
this.ShortName =
|
this.ShortName =
|
||||||
"DEMA (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
"DEMA (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
||||||
this.indicator = new(source: bars.Select(this.DataSource),
|
this.bars = new();
|
||||||
|
this.indicator = new(source: bars.Select(this.DataSource),
|
||||||
period: this.Period, useNaN: false);
|
period: this.Period, useNaN: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class EMA_chart : Indicator
|
|||||||
|
|
||||||
#endregion Parameters
|
#endregion Parameters
|
||||||
|
|
||||||
private readonly TBars bars = new();
|
private TBars bars;
|
||||||
|
|
||||||
///////
|
///////
|
||||||
private EMA_Series indicator;
|
private EMA_Series indicator;
|
||||||
@@ -32,10 +32,9 @@ public class EMA_chart : Indicator
|
|||||||
|
|
||||||
protected override void OnInit()
|
protected override void OnInit()
|
||||||
{
|
{
|
||||||
this.ShortName =
|
this.ShortName = "EMA (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
||||||
"EMA (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
this.bars = new();
|
||||||
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 override void OnUpdate(UpdateArgs args)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class ENTP_chart : Indicator
|
|||||||
|
|
||||||
#endregion Parameters
|
#endregion Parameters
|
||||||
|
|
||||||
private readonly TBars bars = new();
|
private TBars bars;
|
||||||
|
|
||||||
///////
|
///////
|
||||||
private ENTP_Series indicator;
|
private ENTP_Series indicator;
|
||||||
@@ -32,10 +32,9 @@ public class ENTP_chart : Indicator
|
|||||||
|
|
||||||
protected override void OnInit()
|
protected override void OnInit()
|
||||||
{
|
{
|
||||||
this.ShortName =
|
this.ShortName = "ENTP (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
||||||
"ENTP (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
this.bars = new();
|
||||||
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 override void OnUpdate(UpdateArgs args)
|
protected override void OnUpdate(UpdateArgs args)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class HEMA_chart : Indicator
|
|||||||
|
|
||||||
#endregion Parameters
|
#endregion Parameters
|
||||||
|
|
||||||
private readonly TBars bars = new();
|
private TBars bars;
|
||||||
|
|
||||||
///////
|
///////
|
||||||
private HEMA_Series indicator;
|
private HEMA_Series indicator;
|
||||||
@@ -34,7 +34,8 @@ public class HEMA_chart : Indicator
|
|||||||
{
|
{
|
||||||
this.ShortName =
|
this.ShortName =
|
||||||
"HEMA (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
"HEMA (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
||||||
this.indicator = new(source: bars.Select(this.DataSource),
|
this.bars = new();
|
||||||
|
this.indicator = new(source: bars.Select(this.DataSource),
|
||||||
period: this.Period, useNaN: false);
|
period: this.Period, useNaN: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class HMA_chart : Indicator
|
|||||||
|
|
||||||
#endregion Parameters
|
#endregion Parameters
|
||||||
|
|
||||||
private readonly TBars bars = new();
|
private TBars bars;
|
||||||
|
|
||||||
///////
|
///////
|
||||||
private HMA_Series indicator;
|
private HMA_Series indicator;
|
||||||
@@ -35,7 +35,8 @@ public class HMA_chart : Indicator
|
|||||||
{
|
{
|
||||||
this.ShortName =
|
this.ShortName =
|
||||||
"HMA (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
"HMA (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
||||||
this.indicator = new(source: bars.Select(this.DataSource),
|
this.bars = new();
|
||||||
|
this.indicator = new(source: bars.Select(this.DataSource),
|
||||||
period: this.Period, useNaN: false);
|
period: this.Period, useNaN: false);
|
||||||
Debug.WriteLine("Send to debug output.");
|
Debug.WriteLine("Send to debug output.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class JMA_chart : Indicator
|
|||||||
|
|
||||||
#endregion Parameters
|
#endregion Parameters
|
||||||
|
|
||||||
private readonly TBars bars = new();
|
private TBars bars ;
|
||||||
|
|
||||||
///////
|
///////
|
||||||
private JMA_Series indicator;
|
private JMA_Series indicator;
|
||||||
@@ -34,7 +34,8 @@ public class JMA_chart : Indicator
|
|||||||
{
|
{
|
||||||
this.ShortName =
|
this.ShortName =
|
||||||
"JMA (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
"JMA (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
||||||
this.indicator = new(source: bars.Select(this.DataSource),
|
this.bars = new();
|
||||||
|
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 override void OnUpdate(UpdateArgs args)
|
||||||
|
|||||||
@@ -9,15 +9,19 @@ public class KAMA_chart : Indicator
|
|||||||
|
|
||||||
[InputParameter("Smoothing period", 0, 1, 999, 1, 1)]
|
[InputParameter("Smoothing period", 0, 1, 999, 1, 1)]
|
||||||
private int Period = 10;
|
private int Period = 10;
|
||||||
|
[InputParameter("Fastest EMA", 1, 1, 999, 1, 1)]
|
||||||
|
private int Fast = 2;
|
||||||
|
[InputParameter("Slowest EMA", 2, 1, 999, 1, 1)]
|
||||||
|
private int Slow = 30;
|
||||||
|
|
||||||
[InputParameter("Data source", 1, variants: new object[]
|
[InputParameter("Data source", 3, 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 int DataSource = 3;
|
||||||
|
|
||||||
#endregion Parameters
|
#endregion Parameters
|
||||||
|
|
||||||
private readonly TBars bars = new();
|
private TBars bars;
|
||||||
|
|
||||||
///////
|
///////
|
||||||
private KAMA_Series indicator;
|
private KAMA_Series indicator;
|
||||||
@@ -33,10 +37,9 @@ public class KAMA_chart : Indicator
|
|||||||
|
|
||||||
protected override void OnInit()
|
protected override void OnInit()
|
||||||
{
|
{
|
||||||
this.ShortName =
|
this.ShortName = "KAMA (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ":" + this.Fast + ":" + this.Slow + ")";
|
||||||
"KAMA (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
this.bars = new();
|
||||||
this.indicator = new(source: bars.Select(this.DataSource), period: this.Period, useNaN: false);
|
this.indicator = new(source: bars.Select(this.DataSource), period: this.Period, fast: this.Fast, slow: this.Slow, useNaN: false);
|
||||||
Debug.WriteLine($"KAMA on-init. indicator.Count: {indicator.Count}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnUpdate(UpdateArgs args)
|
protected override void OnUpdate(UpdateArgs args)
|
||||||
@@ -46,7 +49,8 @@ public class KAMA_chart : Indicator
|
|||||||
this.bars.Add(this.Time(), this.GetPrice(PriceType.Open),
|
this.bars.Add(this.Time(), this.GetPrice(PriceType.Open),
|
||||||
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
|
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
|
||||||
this.GetPrice(PriceType.Close), this.GetPrice(PriceType.Volume), update);
|
this.GetPrice(PriceType.Close), this.GetPrice(PriceType.Volume), update);
|
||||||
double result = this.indicator[this.indicator.Count - 1].v;
|
double result = this.indicator;
|
||||||
this.SetValue(result);
|
this.SetValue(result);
|
||||||
|
Debug.WriteLine($"{this.indicator[0].v}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class KURT_chart : Indicator
|
|||||||
|
|
||||||
#endregion Parameters
|
#endregion Parameters
|
||||||
|
|
||||||
private readonly TBars bars = new();
|
private TBars bars;
|
||||||
|
|
||||||
///////
|
///////
|
||||||
private KURT_Series indicator;
|
private KURT_Series indicator;
|
||||||
@@ -34,7 +34,8 @@ public class KURT_chart : Indicator
|
|||||||
{
|
{
|
||||||
this.ShortName =
|
this.ShortName =
|
||||||
"KURT (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
"KURT (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
||||||
this.indicator = new(source: bars.Select(this.DataSource),
|
this.bars = new();
|
||||||
|
this.indicator = new(source: bars.Select(this.DataSource),
|
||||||
period: this.Period, useNaN: true);
|
period: this.Period, useNaN: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class MAD_chart : Indicator
|
|||||||
|
|
||||||
#endregion Parameters
|
#endregion Parameters
|
||||||
|
|
||||||
private readonly TBars bars = new();
|
private TBars bars;
|
||||||
|
|
||||||
///////
|
///////
|
||||||
private MAD_Series indicator;
|
private MAD_Series indicator;
|
||||||
@@ -34,7 +34,8 @@ public class MAD_chart : Indicator
|
|||||||
{
|
{
|
||||||
this.ShortName =
|
this.ShortName =
|
||||||
"MAD (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
"MAD (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
||||||
this.indicator = new(source: bars.Select(this.DataSource),
|
this.bars = new();
|
||||||
|
this.indicator = new(source: bars.Select(this.DataSource),
|
||||||
period: this.Period, useNaN: true);
|
period: this.Period, useNaN: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class MAPE_chart : Indicator
|
|||||||
|
|
||||||
#endregion Parameters
|
#endregion Parameters
|
||||||
|
|
||||||
private readonly TBars bars = new();
|
private TBars bars;
|
||||||
|
|
||||||
///////dotnet
|
///////dotnet
|
||||||
private MAPE_Series indicator;
|
private MAPE_Series indicator;
|
||||||
@@ -32,7 +32,8 @@ public class MAPE_chart : Indicator
|
|||||||
|
|
||||||
protected override void OnInit()
|
protected override void OnInit()
|
||||||
{
|
{
|
||||||
this.ShortName =
|
this.bars = new();
|
||||||
|
this.ShortName =
|
||||||
"MAPE (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
"MAPE (" + 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: true);
|
period: this.Period, useNaN: true);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class MAX_chart : Indicator
|
|||||||
|
|
||||||
#endregion Parameters
|
#endregion Parameters
|
||||||
|
|
||||||
private readonly TBars bars = new();
|
private TBars bars;
|
||||||
|
|
||||||
///////
|
///////
|
||||||
private MAX_Series indicator;
|
private MAX_Series indicator;
|
||||||
@@ -32,7 +32,8 @@ public class MAX_chart : Indicator
|
|||||||
|
|
||||||
protected override void OnInit()
|
protected override void OnInit()
|
||||||
{
|
{
|
||||||
this.ShortName =
|
this.bars = new();
|
||||||
|
this.ShortName =
|
||||||
"MAX (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
"MAX (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
||||||
this.indicator =
|
this.indicator =
|
||||||
new(source: bars.Select(this.DataSource), period: this.Period);
|
new(source: bars.Select(this.DataSource), period: this.Period);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class MED_chart : Indicator
|
|||||||
|
|
||||||
#endregion Parameters
|
#endregion Parameters
|
||||||
|
|
||||||
private readonly TBars bars = new();
|
private TBars bars;
|
||||||
|
|
||||||
///////
|
///////
|
||||||
private MED_Series indicator;
|
private MED_Series indicator;
|
||||||
@@ -32,7 +32,8 @@ public class MED_chart : Indicator
|
|||||||
|
|
||||||
protected override void OnInit()
|
protected override void OnInit()
|
||||||
{
|
{
|
||||||
this.ShortName =
|
this.bars = new();
|
||||||
|
this.ShortName =
|
||||||
"MED (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
"MED (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
||||||
this.indicator =
|
this.indicator =
|
||||||
new(source: bars.Select(this.DataSource), period: this.Period);
|
new(source: bars.Select(this.DataSource), period: this.Period);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class MIN_chart : Indicator
|
|||||||
|
|
||||||
#endregion Parameters
|
#endregion Parameters
|
||||||
|
|
||||||
private readonly TBars bars = new();
|
private TBars bars;
|
||||||
|
|
||||||
///////
|
///////
|
||||||
private MIN_Series indicator;
|
private MIN_Series indicator;
|
||||||
@@ -32,7 +32,8 @@ public class MIN_chart : Indicator
|
|||||||
|
|
||||||
protected override void OnInit()
|
protected override void OnInit()
|
||||||
{
|
{
|
||||||
this.ShortName =
|
this.bars = new();
|
||||||
|
this.ShortName =
|
||||||
"MIN (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
"MIN (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
||||||
this.indicator =
|
this.indicator =
|
||||||
new(source: bars.Select(this.DataSource), period: this.Period);
|
new(source: bars.Select(this.DataSource), period: this.Period);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class MSE_chart : Indicator
|
|||||||
|
|
||||||
#endregion Parameters
|
#endregion Parameters
|
||||||
|
|
||||||
private readonly TBars bars = new();
|
private TBars bars;
|
||||||
|
|
||||||
///////
|
///////
|
||||||
private MSE_Series indicator;
|
private MSE_Series indicator;
|
||||||
@@ -32,7 +32,8 @@ public class MSE_chart : Indicator
|
|||||||
|
|
||||||
protected override void OnInit()
|
protected override void OnInit()
|
||||||
{
|
{
|
||||||
this.ShortName =
|
this.bars = new();
|
||||||
|
this.ShortName =
|
||||||
"MSE (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
"MSE (" + 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: true);
|
period: this.Period, useNaN: true);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class PSDEV_chart : Indicator
|
|||||||
|
|
||||||
#endregion Parameters
|
#endregion Parameters
|
||||||
|
|
||||||
private readonly TBars bars = new();
|
private TBars bars;
|
||||||
|
|
||||||
///////dotnet
|
///////dotnet
|
||||||
private PSDEV_Series indicator;
|
private PSDEV_Series indicator;
|
||||||
@@ -32,7 +32,8 @@ public class PSDEV_chart : Indicator
|
|||||||
|
|
||||||
protected override void OnInit()
|
protected override void OnInit()
|
||||||
{
|
{
|
||||||
this.ShortName =
|
this.bars = new();
|
||||||
|
this.ShortName =
|
||||||
"PSDEV (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
"PSDEV (" + 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: true);
|
period: this.Period, useNaN: true);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class PVAR_chart : Indicator
|
|||||||
|
|
||||||
#endregion Parameters
|
#endregion Parameters
|
||||||
|
|
||||||
private readonly TBars bars = new();
|
private TBars bars;
|
||||||
|
|
||||||
///////dotnet
|
///////dotnet
|
||||||
private PVAR_Series indicator;
|
private PVAR_Series indicator;
|
||||||
@@ -32,7 +32,8 @@ public class PVAR_chart : Indicator
|
|||||||
|
|
||||||
protected override void OnInit()
|
protected override void OnInit()
|
||||||
{
|
{
|
||||||
this.ShortName =
|
this.bars = new();
|
||||||
|
this.ShortName =
|
||||||
"PVAR (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
"PVAR (" + 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: true);
|
period: this.Period, useNaN: true);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class RMA_chart : Indicator
|
|||||||
|
|
||||||
#endregion Parameters
|
#endregion Parameters
|
||||||
|
|
||||||
private readonly TBars bars = new();
|
private TBars bars;
|
||||||
|
|
||||||
///////
|
///////
|
||||||
private RMA_Series indicator;
|
private RMA_Series indicator;
|
||||||
@@ -32,7 +32,8 @@ public class RMA_chart : Indicator
|
|||||||
|
|
||||||
protected override void OnInit()
|
protected override void OnInit()
|
||||||
{
|
{
|
||||||
this.ShortName =
|
this.bars = new();
|
||||||
|
this.ShortName =
|
||||||
"RMA (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
"RMA (" + 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);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class SDEV_chart : Indicator
|
|||||||
|
|
||||||
#endregion Parameters
|
#endregion Parameters
|
||||||
|
|
||||||
private readonly TBars bars = new();
|
private TBars bars;
|
||||||
|
|
||||||
///////dotnet
|
///////dotnet
|
||||||
private SDEV_Series indicator;
|
private SDEV_Series indicator;
|
||||||
@@ -32,7 +32,8 @@ public class SDEV_chart : Indicator
|
|||||||
|
|
||||||
protected override void OnInit()
|
protected override void OnInit()
|
||||||
{
|
{
|
||||||
this.ShortName =
|
this.bars = new();
|
||||||
|
this.ShortName =
|
||||||
"SDEV (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
"SDEV (" + 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: true);
|
period: this.Period, useNaN: true);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class SMAPE_chart : Indicator
|
|||||||
|
|
||||||
#endregion Parameters
|
#endregion Parameters
|
||||||
|
|
||||||
private readonly TBars bars = new();
|
private TBars bars;
|
||||||
|
|
||||||
///////dotnet
|
///////dotnet
|
||||||
private SMAPE_Series indicator;
|
private SMAPE_Series indicator;
|
||||||
@@ -32,7 +32,8 @@ public class SMAPE_chart : Indicator
|
|||||||
|
|
||||||
protected override void OnInit()
|
protected override void OnInit()
|
||||||
{
|
{
|
||||||
this.ShortName =
|
this.bars = new();
|
||||||
|
this.ShortName =
|
||||||
"SMAPE (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
"SMAPE (" + 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: true);
|
period: this.Period, useNaN: true);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class SMA_chart : Indicator
|
|||||||
|
|
||||||
#endregion Parameters
|
#endregion Parameters
|
||||||
|
|
||||||
private readonly TBars bars = new();
|
private TBars bars;
|
||||||
|
|
||||||
///////
|
///////
|
||||||
private SMA_Series indicator;
|
private SMA_Series indicator;
|
||||||
@@ -32,7 +32,8 @@ public class SMA_chart : Indicator
|
|||||||
|
|
||||||
protected override void OnInit()
|
protected override void OnInit()
|
||||||
{
|
{
|
||||||
this.ShortName =
|
this.bars = new();
|
||||||
|
this.ShortName =
|
||||||
"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);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class TEMA_chart : Indicator
|
|||||||
|
|
||||||
#endregion Parameters
|
#endregion Parameters
|
||||||
|
|
||||||
private readonly TBars bars = new();
|
private TBars bars;
|
||||||
|
|
||||||
///////
|
///////
|
||||||
private TEMA_Series indicator;
|
private TEMA_Series indicator;
|
||||||
@@ -32,7 +32,8 @@ public class TEMA_chart : Indicator
|
|||||||
|
|
||||||
protected override void OnInit()
|
protected override void OnInit()
|
||||||
{
|
{
|
||||||
this.ShortName =
|
this.bars = new();
|
||||||
|
this.ShortName =
|
||||||
"TEMA (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
"TEMA (" + 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);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class VAR_chart : Indicator
|
|||||||
|
|
||||||
#endregion Parameters
|
#endregion Parameters
|
||||||
|
|
||||||
private readonly TBars bars = new();
|
private TBars bars;
|
||||||
|
|
||||||
///////dotnet
|
///////dotnet
|
||||||
private VAR_Series indicator;
|
private VAR_Series indicator;
|
||||||
@@ -32,7 +32,8 @@ public class VAR_chart : Indicator
|
|||||||
|
|
||||||
protected override void OnInit()
|
protected override void OnInit()
|
||||||
{
|
{
|
||||||
this.ShortName =
|
this.bars = new();
|
||||||
|
this.ShortName =
|
||||||
"VAR (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
"VAR (" + 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: true);
|
period: this.Period, useNaN: true);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class WMAPE_chart : Indicator
|
|||||||
|
|
||||||
#endregion Parameters
|
#endregion Parameters
|
||||||
|
|
||||||
private readonly QuanTAlib.TBars bars = new();
|
private TBars bars;
|
||||||
|
|
||||||
///////dotnet
|
///////dotnet
|
||||||
private QuanTAlib.WMAPE_Series indicator;
|
private QuanTAlib.WMAPE_Series indicator;
|
||||||
@@ -41,8 +41,9 @@ public class WMAPE_chart : Indicator
|
|||||||
|
|
||||||
protected override void OnInit()
|
protected override void OnInit()
|
||||||
{
|
{
|
||||||
this.ShortName = "WMAPE (" + QuanTAlib.TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
this.bars = new();
|
||||||
this.indicator = new(source: this.bars.Select(this.DataSource), period: this.Period, useNaN: true);
|
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 override void OnUpdate(UpdateArgs args)
|
protected override void OnUpdate(UpdateArgs args)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class WMA_chart : Indicator
|
|||||||
|
|
||||||
#endregion Parameters
|
#endregion Parameters
|
||||||
|
|
||||||
private readonly TBars bars = new();
|
private TBars bars;
|
||||||
|
|
||||||
///////
|
///////
|
||||||
private WMA_Series indicator;
|
private WMA_Series indicator;
|
||||||
@@ -32,7 +32,8 @@ public class WMA_chart : Indicator
|
|||||||
|
|
||||||
protected override void OnInit()
|
protected override void OnInit()
|
||||||
{
|
{
|
||||||
this.ShortName =
|
this.bars = new();
|
||||||
|
this.ShortName =
|
||||||
"WMA (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
"WMA (" + 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);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class ZLEMA_chart : Indicator
|
|||||||
|
|
||||||
#endregion Parameters
|
#endregion Parameters
|
||||||
|
|
||||||
private readonly TBars bars = new();
|
private TBars bars;
|
||||||
|
|
||||||
///////
|
///////
|
||||||
private ZLEMA_Series indicator;
|
private ZLEMA_Series indicator;
|
||||||
@@ -32,10 +32,9 @@ public class ZLEMA_chart : Indicator
|
|||||||
|
|
||||||
protected override void OnInit()
|
protected override void OnInit()
|
||||||
{
|
{
|
||||||
this.ShortName =
|
this.bars = new();
|
||||||
"ZLEMA (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
this.ShortName = "ZLEMA (" + 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 override void OnUpdate(UpdateArgs args)
|
protected override void OnUpdate(UpdateArgs args)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,11 +9,12 @@
|
|||||||
<AssemblyName>Quantower_QTAlib</AssemblyName>
|
<AssemblyName>Quantower_QTAlib</AssemblyName>
|
||||||
<RootNamespace>QuanTAlib</RootNamespace>
|
<RootNamespace>QuanTAlib</RootNamespace>
|
||||||
<DebugType>embedded</DebugType>
|
<DebugType>embedded</DebugType>
|
||||||
|
<LangVersion>preview</LangVersion>
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
<Nullable>disable</Nullable>
|
<Nullable>disable</Nullable>
|
||||||
<SignAssembly>False</SignAssembly>
|
<SignAssembly>False</SignAssembly>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
<Optimize>True</Optimize>
|
<Optimize>True</Optimize>
|
||||||
<WarningLevel>3</WarningLevel>
|
<WarningLevel>3</WarningLevel>
|
||||||
@@ -31,7 +32,9 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="..\Source\**\*.cs" Exclude="..\Source\obj\**" />
|
<Compile Include="..\Source\**\*.cs" Exclude="..\Source\obj\**" >
|
||||||
|
<Link>QuanTAlib\%(RecursiveDir)%(Filename)%(Extension)</Link>
|
||||||
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="CopyCustomContent" AfterTargets="AfterBuild">
|
<Target Name="CopyCustomContent" AfterTargets="AfterBuild">
|
||||||
|
|||||||
@@ -26,28 +26,38 @@ Remark:
|
|||||||
public class KAMA_Series : Single_TSeries_Indicator
|
public class KAMA_Series : Single_TSeries_Indicator
|
||||||
{
|
{
|
||||||
private static double _scFast, _scSlow;
|
private static double _scFast, _scSlow;
|
||||||
|
private readonly System.Collections.Generic.List<double> _buffer = new();
|
||||||
|
private double _lastkama = double.NaN;
|
||||||
|
private double _lastlastkama;
|
||||||
|
|
||||||
public KAMA_Series(TSeries source, int period, int fast = 2, int slow= 30, bool useNaN = false) : base(source, period, useNaN) {
|
public KAMA_Series(TSeries source, int period, int fast = 2, int slow= 30, bool useNaN = false) : base(source, period, useNaN) {
|
||||||
_scFast = 2.0 / (fast+1);
|
_scFast = 2.0 / (fast+1);
|
||||||
_scSlow = 2.0 / (slow+1);
|
_scSlow = 2.0 / (slow+1);
|
||||||
if (base._data.Count > 0) { base.Add(base._data); }
|
if (base._data.Count > 0) { base.Add(base._data); }
|
||||||
}
|
}
|
||||||
public override void Add((System.DateTime t, double v) TValue, bool update) {
|
public override void Add((System.DateTime t, double v) TValue, bool update) {
|
||||||
//if (update) { } else { }
|
if (update) {
|
||||||
double _change = Math.Abs( TValue.v - _data[(this.Count>_p)?this.Count-_p : 0].v);
|
_buffer[_buffer.Count - 1] = TValue.v;
|
||||||
double _sumpv = 0;
|
this._lastkama = this._lastlastkama;
|
||||||
double _kama = TValue.v;
|
}
|
||||||
for (int i = (this.Count-_p+1>0)?this.Count-_p+1:0; i <= this.Count; i++) {
|
else {
|
||||||
_sumpv += Math.Abs(_data[(i>0)?i:0].v- _data[(i>1)?i-1:0].v);
|
_buffer.Add(TValue.v);
|
||||||
}
|
}
|
||||||
if (_sumpv != 0) {
|
if (_buffer.Count>_p+1) { _buffer.RemoveAt(0); }
|
||||||
double _er = _change/_sumpv;
|
double _kama = TValue.v;
|
||||||
double _sc = (_er * (_scFast - _scSlow)) + _scSlow;
|
double _change = Math.Abs( _buffer[_buffer.Count-1] - _buffer[(_buffer.Count>_p+1)?1:0]);
|
||||||
double _prevKama = (this.Count > 0) ? this[this.Count-1].v : TValue.v;
|
double _sumpv = 0;
|
||||||
if (double.IsNaN(_prevKama)) { _prevKama = TValue.v; }
|
for (int i = 1; i < _buffer.Count; i++) {
|
||||||
_kama = (_prevKama + (_sc * _sc * (TValue.v - _prevKama)));
|
_sumpv += Math.Abs(_buffer[(_buffer.Count>0)?i:0]- _buffer[i-1]);
|
||||||
}
|
}
|
||||||
|
double _er = (_sumpv==0)?0:_change/_sumpv;
|
||||||
|
double _sc = (_er * (_scFast - _scSlow)) + _scSlow;
|
||||||
|
if (_buffer.Count==1) { _lastkama = _buffer[0]; }
|
||||||
|
|
||||||
var result = (TValue.t, (this.Count < this._p - 1 && this._NaN) ? double.NaN : _kama);
|
_kama = (_lastkama + (_sc * _sc * (TValue.v - _lastkama)));
|
||||||
base.Add(result, update);
|
_lastlastkama = _lastkama;
|
||||||
|
_lastkama = _kama;
|
||||||
|
var result = (TValue.t, (this.Count < this._p - 1 && this._NaN) ? double.NaN : _kama);
|
||||||
|
base.Add(result, update);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user