mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-21 03:58:04 +00:00
readme
Signed-off-by: Miha Kralj <miha@kraljfamily.net> workflow workflow Signed-off-by: Miha Kralj <miha@kraljfamily.net> Refactor charts KAMA build build build build
This commit is contained in:
@@ -7,12 +7,12 @@ public class SMA_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, "High", 1, "Low", 2, "Close", 3, "HL2", 4, "OC2", 5,
|
||||
"OHL3", 6, "HLC3", 7, "OHLC4", 8, "Weighted (HLCC4)", 9 })]
|
||||
private int DataSource = 3;
|
||||
private readonly int DataSource = 3;
|
||||
|
||||
#endregion Parameters
|
||||
|
||||
@@ -36,11 +36,9 @@ public class SMA_chart : Indicator
|
||||
"SMA (" + TBars.SelectStr(this.DataSource) + ", " + this.Period + ")";
|
||||
this.indicator = new(source: bars.Select(this.DataSource),
|
||||
period: this.Period, useNaN: false);
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -48,8 +46,6 @@ public class SMA_chart : Indicator
|
||||
this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low),
|
||||
this.GetPrice(PriceType.Close),
|
||||
this.GetPrice(PriceType.Volume), update);
|
||||
this.OnNewData(update);
|
||||
|
||||
double result = this.indicator[this.indicator.Count - 1].v;
|
||||
this.SetValue(result);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user