From 38de535f32893afb53f5c3d40e275d431d9472cd Mon Sep 17 00:00:00 2001 From: 7u83 <7u83@maiol.ru> Date: Sat, 18 Nov 2017 08:06:54 +0100 Subject: [PATCH] Fixed SMAIndicator (not reversing results anymore) --- src/chart/MasterChart.java | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/chart/MasterChart.java b/src/chart/MasterChart.java index a2a3630..d56b072 100644 --- a/src/chart/MasterChart.java +++ b/src/chart/MasterChart.java @@ -34,7 +34,9 @@ import chart.painter.YLegendPainter; import gui.Globals; import sesim.Exchange.QuoteReceiver; import sesim.Indicator; +import sesim.MinMax; import sesim.OHLCData; +import sesim.OHLCDataItem; import sesim.Quote; import sesim.SMAIndicator; @@ -65,18 +67,39 @@ public class MasterChart extends javax.swing.JPanel implements QuoteReceiver, Ch this.xLegend.setChartDef(chartDef); this.yLegend.setChartDef(chartDef); - class SMA implements ChartPainter.DataProvider { + class SMA extends OHLCData implements ChartPainter.DataProvider { SMAIndicator sma; - SMA(OHLCData data){ + OHLCData data; + + SMA(OHLCData data) { sma = new SMAIndicator(data); + this.data = data; + } + + @Override + public MinMax getMinMax(int first, int last) { + return data.getMinMax(first, last); + } + + @Override + public float getMax() { + return data.getMax(); } @Override public OHLCData get() { - return sma.getData(); - + return this; //sm + //.getData(); + } + @Override + public OHLCDataItem get(int n) { + OHLCData d = sma.getData(); + return d.get(n); //To change body of generated methods, choose Tools | Templates. + } + + }