mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-16 17:48:05 +00:00
Sonarcloud changes
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user