Candlestick related Problem! Please help
Posted: Sat Mar 14, 2009 12:43 pm
hello everyone, i got a project that will be due next week and i still have some problems regarding the display of the dates foe the candlestick chart. I have a .txt file while i read in all the highs, lows, open, close, volume and the respective dates. However, the code given by JFreeChart uses something like a manual input for every single day which i have already replace by my codes below:
public static OHLCDataset createDataset() {
int j = 245;
Date[] date = new Date[j];
double[] high = new double[j];
double[] low = new double[j];
double[] open = new double[j];
double[] close = new double[j];
double[] volume = new double[j];
int[] actualdate = new int[j];
int i =0;
int mnth = 9;
try {
File f = new File("data.txt");
Scanner input = new Scanner(f);
while (input.hasNextLine()) {
high = input.nextDouble();
low = input.nextDouble();
open = input.nextDouble();
close = input.nextDouble();
volume = input.nextDouble();
actualdate = input.nextInt();
date = DateUtilities.createDate(2007, mnth, 3+i, 12, 0);
i++;
}
}
catch (IOException ex) {
System.err.println(ex);
}
return new DefaultHighLowDataset("Candlestick", date, high, low, open,
close, volume);
}
As we can see from the above code, the dates add on everyday, without taking into consideration of the weekends. How is it possible to plot the candlesticks with respect to my dates? (which are stored under actualdates) Please help, any kind soul!! thanks thanks..really appreciated for any help
public static OHLCDataset createDataset() {
int j = 245;
Date[] date = new Date[j];
double[] high = new double[j];
double[] low = new double[j];
double[] open = new double[j];
double[] close = new double[j];
double[] volume = new double[j];
int[] actualdate = new int[j];
int i =0;
int mnth = 9;
try {
File f = new File("data.txt");
Scanner input = new Scanner(f);
while (input.hasNextLine()) {
high = input.nextDouble();
low = input.nextDouble();
open = input.nextDouble();
close = input.nextDouble();
volume = input.nextDouble();
actualdate = input.nextInt();
date = DateUtilities.createDate(2007, mnth, 3+i, 12, 0);
i++;
}
}
catch (IOException ex) {
System.err.println(ex);
}
return new DefaultHighLowDataset("Candlestick", date, high, low, open,
close, volume);
}
As we can see from the above code, the dates add on everyday, without taking into consideration of the weekends. How is it possible to plot the candlesticks with respect to my dates? (which are stored under actualdates) Please help, any kind soul!! thanks thanks..really appreciated for any help