SMAIndicator now works
This commit is contained in:
parent
394c9caf31
commit
de66d47c83
@ -53,6 +53,13 @@ public class MasterChart extends javax.swing.JPanel implements QuoteReceiver {
|
|||||||
|
|
||||||
class MyOHLCData extends OHLCData {
|
class MyOHLCData extends OHLCData {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int size() {
|
||||||
|
return sma.getData().size();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OHLCDataItem get(int n) {
|
public OHLCDataItem get(int n) {
|
||||||
return sma.getData().get(n);
|
return sma.getData().get(n);
|
||||||
@ -99,7 +106,7 @@ public class MasterChart extends javax.swing.JPanel implements QuoteReceiver {
|
|||||||
this.yLegend.setChartDef(chartDef);
|
this.yLegend.setChartDef(chartDef);
|
||||||
|
|
||||||
ChartPainter p;
|
ChartPainter p;
|
||||||
mydata = Globals.se.getOHLCdata(60000 * 60);
|
mydata = Globals.se.getOHLCdata(60000 * 20);
|
||||||
|
|
||||||
this.xScrollBar.setMaximum(0);
|
this.xScrollBar.setMaximum(0);
|
||||||
|
|
||||||
@ -118,8 +125,9 @@ public class MasterChart extends javax.swing.JPanel implements QuoteReceiver {
|
|||||||
chart.addChartPainter(new ChartCrossPainter());
|
chart.addChartPainter(new ChartCrossPainter());
|
||||||
|
|
||||||
sma = new sesim.SMAIndicator(mydata);
|
sma = new sesim.SMAIndicator(mydata);
|
||||||
|
MyOHLCData mysma = new MyOHLCData();
|
||||||
p = new LineChartPainter();
|
p = new LineChartPainter();
|
||||||
p.setOHLCData(sma.getData());
|
p.setOHLCData(mysma);
|
||||||
//p.setDataProvider(new SMA(get()));
|
//p.setDataProvider(new SMA(get()));
|
||||||
chart.addChartPainter(p);
|
chart.addChartPainter(p);
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ public class SMAIndicator implements Indicator {
|
|||||||
indicator = new OHLCData();
|
indicator = new OHLCData();
|
||||||
}
|
}
|
||||||
|
|
||||||
int len = 0;
|
int len = 20;
|
||||||
|
|
||||||
float getAt(int pos) {
|
float getAt(int pos) {
|
||||||
if (parent.size() == 0) {
|
if (parent.size() == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user