mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-18 10:38:05 +00:00
Tests and QT cleanup
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user