Signed-off-by: Miha Kralj <miha@kraljfamily.net>

workflow

workflow

Signed-off-by: Miha Kralj <miha@kraljfamily.net>

Refactor charts


KAMA


build

build

build

build
This commit is contained in:
Miha Kralj
2022-04-23 20:10:30 -07:00
parent ee8b07bb37
commit 2a73615161
36 changed files with 599 additions and 288 deletions
+73
View File
@@ -0,0 +1,73 @@
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
+131 -15
View File
@@ -1,13 +1,15 @@
name: Main
name: Stage/build/test/release/publish
on:
workflow_dispatch:
push:
branches: [ main ]
branches:
- '*'
pull_request:
branches: [ main ]
branches:
- '*'
jobs:
build:
build_test:
runs-on: windows-latest
steps:
- name: Checkout
@@ -31,29 +33,29 @@ jobs:
- name: Install JetBrains
run: dotnet tool install JetBrains.dotCover.GlobalTool --global
- name: Install Sonar Scanner
run: dotnet tool install dotnet-sonarscanner --global
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:
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"
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
run: dotnet build ./Source/QuanTAlib.csproj --verbosity normal --configuration Debug --nologo
- name: Build Quantower DLL
run: dotnet build ./Quantower/Quantower.csproj --verbosity normal --configuration Release --nologo
run: dotnet build ./Quantower/Quantower.csproj --verbosity normal --configuration Debug --nologo
- name: dotnet Test
run: dotnet test ./Tests/Tests.csproj --verbosity normal --configuration Release --nologo
run: dotnet test ./Tests/Tests.csproj --verbosity normal --configuration Debug --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
@@ -62,7 +64,7 @@ jobs:
# run: dotnet-coverage collect 'dotnet test' -f xml -o './coverage.xml'
- name: Sonar reporter
env:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
@@ -76,6 +78,120 @@ jobs:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: ./coveragereport.xml
release_publish:
runs-on: windows-latest
needs: [build_test]
if: ${{ github.ref == 'refs/heads/main' }}
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 --configuration Release --nologo
- name: Build Quantower DLL
run: dotnet build ./Quantower/Quantower.csproj --configuration Release --nologo
- name: Release
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "Latest Build"
files: /Quantower/Settings/Scripts/Indicators/QuanTAlib/*.dll
- 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
- 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
# 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
# uses: thedoctor0/zip-release@master
# with:
@@ -91,7 +207,7 @@ jobs:
# 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 }}
@@ -102,4 +218,4 @@ jobs:
# 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
# --skip-duplicate
+54
View File
@@ -0,0 +1,54 @@
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
+51 -74
View File
@@ -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
+46
View File
@@ -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);
}
}
-3
View File
@@ -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);
}
-4
View File
@@ -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);
}
-4
View File
@@ -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);
}
-4
View File
@@ -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);
-4
View File
@@ -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);
}
+56 -56
View File
@@ -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);
}
}
-5
View File
@@ -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);
}
+52
View File
@@ -0,0 +1,52 @@
using System.Diagnostics;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class KAMA_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 KAMA_Series indicator;
///////
public KAMA_chart()
{
this.SeparateWindow = false;
this.Name = "KAMA - Kaufman's Adaptive Moving Average";
this.Description = "Kaufman's Adaptive Moving Average description";
this.AddLineSeries("KAMA", Color.RoyalBlue, 3, LineStyle.Solid);
}
protected override void OnInit()
{
this.ShortName =
"KAMA (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
this.indicator = new(source: bars.Select(this.DataSource), period: this.Period, useNaN: false);
Debug.WriteLine($"KAMA on-init. indicator.Count: {indicator.Count}");
}
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);
}
}
-3
View File
@@ -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);
}
-3
View File
@@ -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;
-3
View File
@@ -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;
-4
View File
@@ -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);
-3
View File
@@ -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);
}
-4
View File
@@ -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);
-3
View File
@@ -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;
-5
View File
@@ -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);
-4
View File
@@ -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);
-4
View File
@@ -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);
}
-5
View File
@@ -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);
-4
View File
@@ -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);
+5 -9
View File
@@ -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);
}
-4
View File
@@ -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);
}
+1 -5
View File
@@ -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);
-5
View File
@@ -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;
-5
View File
@@ -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);
}
+1 -5
View File
@@ -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);
+22 -4
View File
@@ -8,15 +8,33 @@
<AlgoType>Indicator</AlgoType>
<AssemblyName>Quantower_QTAlib</AssemblyName>
<RootNamespace>QuanTAlib</RootNamespace>
<Configurations>Release</Configurations>
<BaseOutputPath>bin\</BaseOutputPath>
<DebugType>embedded</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<Nullable>disable</Nullable>
<SignAssembly>False</SignAssembly>
</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>
<Compile Include="..\Source\**\*.cs" Exclude="..\Source\obj\**"/>
<Compile Include="..\Source\**\*.cs" Exclude="..\Source\obj\**" />
</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" />
</Target>
+34 -34
View File
@@ -1,35 +1,35 @@
namespace QuanTAlib;
using System;
/* <summary>
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/
</summary> */
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;
/* <summary>
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/
</summary> */
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);
}
}
+53
View File
@@ -0,0 +1,53 @@
namespace QuanTAlib;
using System;
/* <summary>
KAMA: Kaufman's Adaptive Moving Average
Created in 1988 by American quantitative finance theorist Perry J. Kaufman and is known as
Kaufman's Adaptive Moving Average (KAMA). Even though the method was developed as early as 1972,
it was not until the popular book titled "Trading Systems and Methods" that it was made widely
available to the public. Unlike other conventional moving averages systems, the Kaufman's Adaptive
Moving Average, considers market volatility apart from price fluctuations.
KAMAi = KAMAi - 1 + SC * ( price - KAMAi-1 )
Sources:
https://www.tutorialspoint.com/kaufman-s-adaptive-moving-average-kama-formula-and-how-does-it-work
https://corporatefinanceinstitute.com/resources/knowledge/trading-investing/kaufmans-adaptive-moving-average-kama/
https://www.technicalindicators.net/indicators-technical-analysis/152-kama-kaufman-adaptive-moving-average
Remark:
If useNaN:true argument is provided, KAMA starts calculating values from [period] bar onwards.
Without useNaN argument (default setting), KAMA starts calculating values from bar 1 - and yields
slightly different results for the first 50 bars - and then converges with the other one.
</summary> */
public class KAMA_Series : Single_TSeries_Indicator
{
private static double _scFast, _scSlow;
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);
_scSlow = 2.0 / (slow+1);
if (base._data.Count > 0) { base.Add(base._data); }
}
public override void Add((System.DateTime t, double v) TValue, bool update) {
//if (update) { } else { }
double _change = Math.Abs( TValue.v - _data[(this.Count>_p)?this.Count-_p : 0].v);
double _sumpv = 0;
double _kama = TValue.v;
for (int i = (this.Count-_p+1>0)?this.Count-_p+1:0; i <= this.Count; i++) {
_sumpv += Math.Abs(_data[(i>0)?i:0].v- _data[(i>1)?i-1:0].v);
}
if (_sumpv != 0) {
double _er = _change/_sumpv;
double _sc = (_er * (_scFast - _scSlow)) + _scSlow;
double _prevKama = (this.Count > 0) ? this[this.Count-1].v : TValue.v;
if (double.IsNaN(_prevKama)) { _prevKama = TValue.v; }
_kama = (_prevKama + (_sc * _sc * (TValue.v - _prevKama)));
}
var result = (TValue.t, (this.Count < this._p - 1 && this._NaN) ? double.NaN : _kama);
base.Add(result, update);
}
}
+1 -1
View File
@@ -13,7 +13,7 @@
<PackageReadmeFile>readme.md</PackageReadmeFile>
<TargetFrameworks>net7.0;net6.0;net48;netcoreapp3.1;netstandard2.1</TargetFrameworks>
<ImplicitUsings>disable</ImplicitUsings>
<LangVersion>10.0</LangVersion>
<LangVersion>preview</LangVersion>
<Nullable>disable</Nullable>
<DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>
<NeutralLanguage>en-US</NeutralLanguage>
+19 -2
View File
@@ -10,6 +10,22 @@
<Platforms>AnyCPU;x64</Platforms>
</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>
<PackageReference Include="JetBrains.dotCover.CommandLineTools" Version="2022.1.0-eap10">
<PrivateAssets>all</PrivateAssets>
@@ -25,8 +41,9 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Source\QuanTAlib.csproj" />
<ItemGroup>
<ProjectReference Include="..\Source\QuanTAlib.csproj" />
</ItemGroup>
</Project>