mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-17 18:18:04 +00:00
ABOVE_Series
This commit is contained in:
@@ -6,15 +6,30 @@ using TradingPlatform.BusinessLayer.Chart;
|
||||
|
||||
namespace QuanTAlib;
|
||||
|
||||
public class QuanTAlib_Indicator : Indicator {
|
||||
public abstract class QuanTAlib_Indicator : Indicator {
|
||||
protected TBars bars;
|
||||
protected IChartWindow mainWindow;
|
||||
protected Graphics graphics;
|
||||
protected int firstOnScreenBarIndex, lastOnScreenBarIndex;
|
||||
protected HistoricalData History;
|
||||
protected int HistPeriod;
|
||||
|
||||
protected override void OnInit() {
|
||||
base.OnInit();
|
||||
bars = new();
|
||||
var dur1 = this.HistoricalData.FromTime;
|
||||
var dur = this.HistoricalData.Period.Duration.TotalSeconds * (HistPeriod*4) ; //seconds of two periods
|
||||
|
||||
this.History = this.Symbol.GetHistory(period: this.HistoricalData.Period, fromTime: HistoricalData.FromTime);
|
||||
|
||||
for (int i = this.History.Count-1; i >= 0; i--) {
|
||||
|
||||
var rec = this.History[i, SeekOriginHistory.Begin];
|
||||
|
||||
bars.Add(rec.TimeLeft, rec[PriceType.Open],
|
||||
rec[PriceType.High], rec[PriceType.Low],
|
||||
rec[PriceType.Close], rec[PriceType.Volume]);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnUpdate(UpdateArgs args) {
|
||||
|
||||
@@ -14,7 +14,7 @@ public class JMA_chart : QuanTAlib_Indicator {
|
||||
private int DataSource = 3;
|
||||
|
||||
[InputParameter("Smoothing period", 1, 1, 999, 1, 1)]
|
||||
private int Period = 10;
|
||||
private int Period = 9;
|
||||
|
||||
[InputParameter("Volatility short", 2, 3, 50, 1, 1)]
|
||||
private int Vshort = 10;
|
||||
@@ -28,7 +28,7 @@ public class JMA_chart : QuanTAlib_Indicator {
|
||||
#endregion Parameters
|
||||
|
||||
///////
|
||||
private JMA_Series indicator;
|
||||
private EMA_Series indicator;
|
||||
///////
|
||||
|
||||
public JMA_chart() :base() {
|
||||
@@ -36,14 +36,15 @@ public class JMA_chart : QuanTAlib_Indicator {
|
||||
Description = "Jurik Moving Average description";
|
||||
AddLineSeries(lineName: "JMA", lineColor: Color.Yellow, lineWidth: 3,lineStyle: LineStyle.Solid);
|
||||
SeparateWindow = false;
|
||||
HistPeriod = Period;
|
||||
}
|
||||
|
||||
|
||||
protected override void OnInit() {
|
||||
base.OnInit();
|
||||
indicator = new(source: bars.Select(DataSource), period: Period,
|
||||
phase: Jphase, vshort: Vshort, vlong: Vlong,
|
||||
useNaN: false);
|
||||
// phase: Jphase, vshort: Vshort, vlong: Vlong,
|
||||
useNaN: true);
|
||||
}
|
||||
|
||||
protected override void OnUpdate(UpdateArgs args) {
|
||||
|
||||
Reference in New Issue
Block a user