Quantower adaptation

This commit is contained in:
Miha Kralj
2022-12-21 07:24:21 -08:00
parent 9f01df0e65
commit 9ad467cd5a
28 changed files with 3493 additions and 3204 deletions
+59
View File
@@ -0,0 +1,59 @@
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class AAA_chart : Indicator {
#region Parameters
[InputParameter("Smoothing period", 0, 1, 999, 1, 1)]
private readonly int Period = 10;
#endregion Parameters
private TBars bars;
private TSeries series;
private JMA_Series jma;
private DWMA_Series dwma;
public AAA_chart() : base()
{
this.SeparateWindow = true;
this.Name = "AAA - Test indicator";
this.Description = "Test indicator";
this.AddLineSeries("JMA", Color.RoyalBlue, 3, LineStyle.Solid);
this.AddLineSeries("DWMA", Color.OrangeRed, 3, LineStyle.Solid);
this.SeparateWindow = false;
}
protected override void OnInit()
{
this.ShortName = "AAA (" + this.Period + ")";
this.bars = new();
this.series = new();
this.jma = new(source: bars.HLC3, period: this.Period, useNaN: false);
this.dwma = new(source: bars.HLC3, period: this.Period, useNaN: false);
}
protected override void OnUpdate(UpdateArgs args)
{
Debug.WriteLine($"{args.Reason}");
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.series.Add(0.25*(this.GetPrice(PriceType.Open)+ this.GetPrice(PriceType.High)+ this.GetPrice(PriceType.Low)+ this.GetPrice(PriceType.Close)), update);
this.SetValue(this.jma.v.Last(), 0);
this.SetValue(this.dwma.v.Last(), 1);
}
}
+2 -5
View File
@@ -43,14 +43,11 @@ public class HMA_chart : Indicator
protected override void OnUpdate(UpdateArgs args)
{
Debug.WriteLine("Send to debug output.");
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.GetPrice(PriceType.Close),this.GetPrice(PriceType.Volume), update);
double result = this.indicator[this.indicator.Count - 1].v;
this.SetValue(result);
}
+48 -46
View File
@@ -1,50 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<LangVersion>preview</LangVersion>
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
<Platforms>AnyCPU</Platforms>
<AlgoType>Indicator</AlgoType>
<AssemblyName>Quantower_QTAlib</AssemblyName>
<RootNamespace>QuanTAlib</RootNamespace>
<DebugType>embedded</DebugType>
<LangVersion>preview</LangVersion>
<PlatformTarget>AnyCPU</PlatformTarget>
<Nullable>disable</Nullable>
<SignAssembly>False</SignAssembly>
<CodeAnalysisRuleSet>..\.sonarlint\mihakralj_quantalibcsharp.ruleset</CodeAnalysisRuleSet>
</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\**;..\Source\Feeds\**">
<Link>QuanTAlib\%(RecursiveDir)%(Filename)%(Extension)</Link>
</Compile>
</ItemGroup>
<!--
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<LangVersion>preview</LangVersion>
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
<Platforms>AnyCPU</Platforms>
<AlgoType>Indicator</AlgoType>
<AssemblyName>Quantower_QTAlib</AssemblyName>
<RootNamespace>QuanTAlib</RootNamespace>
<DebugType>embedded</DebugType>
<LangVersion>preview</LangVersion>
<PlatformTarget>AnyCPU</PlatformTarget>
<Nullable>disable</Nullable>
<SignAssembly>False</SignAssembly>
<CodeAnalysisRuleSet>..\.sonarlint\mihakralj_quantalibcsharp.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<Optimize>True</Optimize>
<WarningLevel>3</WarningLevel>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<PlatformTarget>anycpu</PlatformTarget>
<DebugType>full</DebugType>
<OutputPath>C:\Quantower\TradingPlatform\v1.128.18\..\..\Settings\Scripts\Indicators\Quantower</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DebugType>embedded</DebugType>
<Optimize>True</Optimize>
<WarningLevel>3</WarningLevel>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<PlatformTarget>anycpu</PlatformTarget>
<OutputPath>C:\Quantower\TradingPlatform\v1.128.18\..\..\Settings\Scripts\Indicators\Quantower</OutputPath>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Source\**\*.cs" Exclude="..\Source\obj\**;..\Source\Feeds\**">
<Link>QuanTAlib\%(RecursiveDir)%(Filename)%(Extension)</Link>
</Compile>
</ItemGroup>
<!--
<Target Name="CopyCustomContent" AfterTargets="AfterBuild">
<Copy SourceFiles=".\bin\$(Configuration)\net48\Quantower_QTAlib.dll" DestinationFolder="\Quantower\Settings\Scripts\Indicators\QuanTAlib" />
</Target>
-->
<ItemGroup>
<AdditionalFiles Include="..\.sonarlint\mihakralj_quantalib\CSharp\SonarLint.xml" Link="SonarLint.xml" />
</ItemGroup>
<ItemGroup>
<Reference Include="TradingPlatform.BusinessLayer">
<HintPath>C:\Quantower\TradingPlatform\v1.124.6\bin\TradingPlatform.BusinessLayer.dll</HintPath>
</Reference>
</ItemGroup>
-->
<ItemGroup>
<AdditionalFiles Include="..\.sonarlint\mihakralj_quantalib\CSharp\SonarLint.xml" Link="SonarLint.xml" />
</ItemGroup>
<ItemGroup>
<Reference Include="TradingPlatform.BusinessLayer">
<HintPath>C:\Quantower\TradingPlatform\v1.128.18\bin\TradingPlatform.BusinessLayer.dll</HintPath>
</Reference>
</ItemGroup>
</Project>