class pro{
int[] code=new int[10000];
int[] year=new int[10000];
int[] month=new int[10000];
int[] day=new int[10000];
int[] oprice=new int[10000];
int[] hprice=new int[10000];
int[] lprice=new int[10000];
int[] cprice=new int[10000];
int[] rprice=new int[10000];
int[] volume=new int[10000];
int tsecode[]=new int[10000];
int tsenumber;
int datanumber;
int ph,pl,pc,po;
int s,c,sx;
int h;
int stock;
int money;
int n,p;
String file;
public static void main(String [] args) {
pro tset=new pro();
}
pro(){
getcode gc=new getcode();
gc.makedata();
tsecode=gc.tsecode;
tsenumber=gc.tsenumber;
p=0;
for(c=1;c<tsenumber+1;c++){
file="data/"+tsecode[c]+".txt";
tsedata cd=new tsedata();
cd.makedata(file);
datanumber=cd.datanumber;
hprice=cd.hprice;
lprice=cd.lprice;
oprice=cd.oprice;
cprice=cd.cprice;
rprice=cd.rprice;
year=cd.year;
month=cd.month;
day=cd.day;
volume=cd.volume;
money=10000;
stock=0;
for(s=100;s<datanumber;s++){
h=0;
if(stock==0)h=h+1;
if(psy(s)<25)h=h+1;
if(money>100000000)h=0;
if(h==2)stock=money/rprice[s];
if(h==2)money=money-stock*rprice[s];
h=0;
if(stock>0)h=h+1;
if(psy(s)>75)h=h+1;
if(h==2)money=money+stock*rprice[s];
if(h==2)stock=0;
}
money=money+stock*rprice[datanumber];
p=p+money;
System.out.println(c);
System.out.println(money);
}
System.out.println(p/tsenumber);
}
int psy(int s){
int t,tx,ps,h;
tx=s-12;
h=0;
for(t=tx;t<s;t++){
if(rprice[t]>rprice[t-1])h=h+1;
}
ps=100*h/12;
return ps;
}
}
最終更新:2011年04月17日 15:23