Sonarcloud changes

This commit is contained in:
Miha
2022-04-20 00:01:33 -07:00
parent df9023b4d6
commit bbea1afb71
34 changed files with 110 additions and 1033 deletions
+7 -10
View File
@@ -1,3 +1,4 @@
namespace QuanTAlib;
using System.Drawing;
using TradingPlatform.BusinessLayer;
@@ -6,7 +7,7 @@ public class WMAPE_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,
@@ -20,7 +21,7 @@ public class WMAPE_chart : Indicator
"OHLC4", 8,
"Weighted (HLCC4)", 9
})]
private int DataSource = 8;
private readonly int DataSource = 8;
#endregion Parameters
@@ -40,17 +41,13 @@ public class WMAPE_chart : Indicator
protected override void OnInit()
{
this.ShortName = "WMAPE (" + QuantLib.TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
this.indicator = new(source: 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 void OnNewData(bool update = false)
{
this.indicator.Add(update);
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);
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);