SMA Indicator, tests ...

This commit is contained in:
7u83 2017-11-18 14:24:09 +01:00
parent db42dfd43c
commit 35a6bf4e45
3 changed files with 20 additions and 48 deletions

View File

@ -36,6 +36,7 @@
<file>file:/home/tube/NetBeansProjects/SeSim/src/sesim/AutoTraderLoader.java</file> <file>file:/home/tube/NetBeansProjects/SeSim/src/sesim/AutoTraderLoader.java</file>
<file>file:/home/tube/NetBeansProjects/SeSim/src/traders/ManTrader/ManTrader.java</file> <file>file:/home/tube/NetBeansProjects/SeSim/src/traders/ManTrader/ManTrader.java</file>
<file>file:/home/tube/NetBeansProjects/SeSim/src/chart/painter/ChartPainter.java</file> <file>file:/home/tube/NetBeansProjects/SeSim/src/chart/painter/ChartPainter.java</file>
<file>file:/home/tube/NetBeansProjects/SeSim/src/sesim/OHLCDataProvider.java</file>
<file>file:/home/tube/NetBeansProjects/SeSim/src/traders/RandomTraderB.java</file> <file>file:/home/tube/NetBeansProjects/SeSim/src/traders/RandomTraderB.java</file>
<file>file:/home/tube/NetBeansProjects/SeSim/src/sesim/Logger.java</file> <file>file:/home/tube/NetBeansProjects/SeSim/src/sesim/Logger.java</file>
<file>file:/home/tube/NetBeansProjects/SeSim/src/gui/EditPreferencesDialog.java</file> <file>file:/home/tube/NetBeansProjects/SeSim/src/gui/EditPreferencesDialog.java</file>

View File

@ -1,7 +1,6 @@
package chart; package chart;
import chart.painter.ChartPainter; import chart.painter.ChartPainter;
import chart.painter.XLegendPainter;
import gui.Globals; import gui.Globals;
import java.awt.Cursor; import java.awt.Cursor;
@ -16,9 +15,6 @@ import java.awt.event.AdjustmentListener;
import java.util.ArrayList; import java.util.ArrayList;
import javax.swing.JScrollBar; import javax.swing.JScrollBar;
import sesim.OHLCData;
/** /**
* *
* @author 7u83 <7u83@mail.ru> * @author 7u83 <7u83@mail.ru>
@ -29,7 +25,6 @@ public class ChartPanel extends javax.swing.JPanel implements AdjustmentListener
ChartDef chartDef; ChartDef chartDef;
public boolean mouseEntered = false; public boolean mouseEntered = false;
/** /**
* Creates new form Chart1 * Creates new form Chart1
*/ */
@ -42,15 +37,18 @@ public class ChartPanel extends javax.swing.JPanel implements AdjustmentListener
/** /**
* Add a horizontal scrollbar * Add a horizontal scrollbar
*
* @param x_scrollbar * @param x_scrollbar
*/ */
public void setXSCrollBar(JScrollBar x_scrollbar) { public void setXSCrollBar(JScrollBar x_scrollbar) {
if (this.x_scrollbar!=null) if (this.x_scrollbar != null) {
this.x_scrollbar.removeAdjustmentListener(this); this.x_scrollbar.removeAdjustmentListener(this);
}
this.x_scrollbar = x_scrollbar; this.x_scrollbar = x_scrollbar;
if (this.x_scrollbar!=null) if (this.x_scrollbar != null) {
this.x_scrollbar.addAdjustmentListener(this); this.x_scrollbar.addAdjustmentListener(this);
} }
}
public void setChartDef(ChartDef def) { public void setChartDef(ChartDef def) {
chartDef = def; chartDef = def;
@ -74,8 +72,6 @@ public class ChartPanel extends javax.swing.JPanel implements AdjustmentListener
return true; return true;
} }
// OHLCData data;
@Override @Override
protected void paintComponent(Graphics g) { protected void paintComponent(Graphics g) {
super.paintComponent(g); super.paintComponent(g);
@ -84,14 +80,6 @@ public class ChartPanel extends javax.swing.JPanel implements AdjustmentListener
return; return;
} }
//this.x_scrollbar.setMaximum(994000);
// XLegendPainter p = new XLegendPainter();
//data = Globals.se.getOHLCdata(60000 * 60);
// ChartDef def = new ChartDef();
// def.x_unit_width = 1.0;
// def.x_scrollbar = x_scrollbar;
for (ChartPainter painter : chartPainters) { for (ChartPainter painter : chartPainters) {
painter.drawChart((Graphics2D) g, this, chartDef); painter.drawChart((Graphics2D) g, this, chartDef);
} }
@ -158,7 +146,6 @@ public class ChartPanel extends javax.swing.JPanel implements AdjustmentListener
this.repaint(); this.repaint();
} }
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
} }

View File

@ -249,26 +249,10 @@ public class MasterChart extends javax.swing.JPanel implements QuoteReceiver {
@Override @Override
public void UpdateQuote(Quote q) { public void UpdateQuote(Quote q) {
// OHLCData data = this.get();
int s = data.size(); int s = data.size();
this.xScrollBar.setMaximum(s); this.xScrollBar.setMaximum(s);
repaint(); repaint();
} }
OHLCData mydata = null;
/*
public OHLCData get() {
OHLCData re = Globals.se.getOHLCdata(60000 * 10);
if (re != mydata) {
System.out.printf("re != a\n");
}
if (mydata == null) {
mydata = Globals.se.getOHLCdata(60000 * 10);
}
return mydata;
} }
*/
}