Tests and QT cleanup

This commit is contained in:
Miha Kralj
2022-12-21 12:31:29 -08:00
parent 9ad467cd5a
commit 5844547a79
31 changed files with 188 additions and 243 deletions
+13 -15
View File
@@ -13,47 +13,45 @@ public class AAA_chart : Indicator {
#endregion Parameters
private TBars bars;
private TSeries series;
private JMA_Series jma;
private DWMA_Series dwma;
private JMA_Series ind_a;
private DWMA_Series ind_b;
public override string ShortName => $"AAA ({this.Period})";
public AAA_chart() : base()
{
this.SeparateWindow = true;
this.SeparateWindow = false;
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);
this.ind_a = new(source: bars.Close, period: this.Period, useNaN: false);
this.ind_b = new(source: bars.OHLC4, 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.bars.Add(this.Time(),
this.GetPrice(PriceType.Open),
this.GetPrice(PriceType.High),
this.GetPrice(PriceType.Low),
this.GetPrice(PriceType.Close),
this.GetPrice(PriceType.Volume),
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);
this.SetValue(this.ind_a.v.Last(), 0);
this.SetValue(this.ind_b.v.Last(), 1);
}
}